Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shapes Properties Binding 2001.08.14 Chung Ji Hye.

Similar presentations


Presentation on theme: "Shapes Properties Binding 2001.08.14 Chung Ji Hye."— Presentation transcript:

1 Shapes Properties Binding 2001.08.14 Chung Ji Hye

2 Graphics Laboratory Korea University -2- chung ji hye Content Use a variety of shapes in the scene Indexed shapes specify their own order Different effects for color values, shininess and transparency Render a scene using different drawing styles Create a scene with fog Use the shape hints Material and normal binding

3 Graphics Laboratory Korea University -3- chung ji hye Shapes All shape nodes are derived from the abstract base class SoShape Simple shape Complex shapes CubeCube Face set Cone Line set Sphere Tirangle strip set Cylinder Quad mesh

4 Graphics Laboratory Korea University -4- chung ji hye Complex Shapes [FaceSet] SoFaceSet is a shape node Represents a polygonal object Current coordinates, normals, materials, textures Uses the values within each node in the order they are given SoIndexedFaceSet Represents a polygonal object formed by constructing faces Uses those values in any order Contains four field

5 Graphics Laboratory Korea University -5- chung ji hye Complex Shapes [FaceSet] Four Fields coordIndex Contains indices into the coordinates list SO_END_FACE_INDEX(-1) materialIndex Contains indices into the current material for the materials of the face set Use only when some type of indexed material binding is specified in the SoMaterialBinding node NormalIndex Contains indices into the current normals SoNormalBinding node TextureCoordIndex Contains indices of the texture coordinates

6 Graphics Laboratory Korea University -6- chung ji hye Complex Shapes Triangle Strip Set SoTriangleStripSet constructs triangle strips out of the vertices One of the fastest ways to draw polygonal object Starting by startIndex field (in order) Static long numvertices[2] ={32, 8}; SoTriangleStripSet *myStrips = new SoTriangleStripSet; myStrips->numbertices.setValues(0,2, numVertices); //32 triangle stripset, 8 triangle stripset //face 0 determined the vertex ordering

7 Graphics Laboratory Korea University -7- chung ji hye Triangle Strip Set Triangle Strip Set Example

8 Graphics Laboratory Korea University -8- chung ji hye Complex Shapes Quad Mesh SoQuadMesh Constructs quadrilaterals from the vertices located at the current coordinates Use the coordinates in order Starting at the index specified by the startIndex field verticesPerColume : number of vertices in the columns VerticesPerRow : number of vertices in the rows

9 Graphics Laboratory Korea University -9- chung ji hye Complex Shapes Examples SoQuadMesh *myQuadMesh = new soQuadMesh; myQuadMesh->verticesPerRow = 12 myquadMesh ->VerticesPerColumn = 5 Static float vertexPositions[160][3] = { //1 st row { }, // Add 11 rows }; Each row in this quad mesh contains 12 vertices. Each column contains 5 vertices

10 Graphics Laboratory Korea University -10- chung ji hye Quad Mesh

11 Graphics Laboratory Korea University -11- chung ji hye Property Nodes Property classes SoMaterial Sets ambient, diffuse, specular, emissive color, shininess, transparency SoDrawStyle Drawing technique to use during rendering SolightModel Shape nodes show to compute lighting calculations during rendering SoEnvironment Simulate various atmospheric effects (fog, haze, pollution … )

12 Graphics Laboratory Korea University -12- chung ji hye Property Nodes Property classes SoShapeHints Additional information regarding vertex shapes to allow inventor to optimize certain rendering features SoUnits Define a standard unit of measurement for all subsequent shapes in the scene graph All of which are derived from SoNode Each of these classes affects different elements of the rendering state

13 Graphics Laboratory Korea University -13- chung ji hye Material Node SoMaterial node includes the following fields ambientColor(SoMFColor) Reflected color of an object in response to the ambient lighting in the scene diffuseColor Object ’ s base color specularColor Reflective quality of an Object ’ s highlights

14 Graphics Laboratory Korea University -14- chung ji hye Material Node SoMaterial node includes the following fields emissiveColor Light produced by an objcet Shininess Degree of shininess of an object ’ s surface 0.0 : no shininess Transparency Degree of transparency of an object ’ s surface( 0.0 : opaque)

15 Graphics Laboratory Korea University -15- chung ji hye Material Node Examples //set material values SoMaterial *Gold = new soMaterial; Gold -> ambientColor.setValue(.3,.3,.1); Gold ->diffuseColor.setValue(.8,.7,.2); Gold ->specularcolor.setValue(.4,.3,.1); Gold -> shininess =.4; Gold -> transparency =.0; //gold is opaque

16 Graphics Laboratory Korea University -16- chung ji hye Draw Style Node SoDrawStyle node include Style Current drawing style SoDrawStyle::FILLED Filled regions(default) SoDrawStyle::LINES Nonfilled outlines SoDrawStyle::POINTS Points SoDrawStyle::INVISIBLE Not drawn at all

17 Graphics Laboratory Korea University -17- chung ji hye Draw Style Node solid point line

18 Graphics Laboratory Korea University -18- chung ji hye Draw Style Node SoDrawStyle node include pointSize radius of points, in printer ’ s points 0.0 indicates to use the fastest value for rendering lineWidth Line width in printer ’ s points Values can range from 0.0 to 256.0 linePattern Line-stipple pattern Values can range from 0 to 0xffff

19 Graphics Laboratory Korea University -19- chung ji hye Light-Model Node SoLightModel node includes field Model Tells the shape node how to compute lighting calculations during rendering SoLightModel::BASE_COLOR Ignore light source Uses only diffuse color and transparency of the current material SoLightModel::PHONG Uses the OpenGL Phong lighting model Account all light sources in the scene

20 Graphics Laboratory Korea University -20- chung ji hye Environment Node SoEnvironment node Simulate various atmospheric effects – fog, haze, pollution and so on Allows you to specify color, intensity, ambient lighting, many factor for fog Includes fields ambientIntensity intensity of ambient light in the screen Used with phong lighting attenuation Defines how light drops off the distance from a light source Used with phong lighting

21 Graphics Laboratory Korea University -21- chung ji hye Environment Node SoEnvironment node Includes fields fogType SoEnvironment::NONE SoEnvironment::HAZE Opacity of the fog Increases linearly with the distance from the camera SoEnvironment::FOG Opacity of the fog Increases exponentially with the distance from the camera fogColor Color of the fog

22 Graphics Laboratory Korea University -22- chung ji hye Shape-Hint Node Use the SoShapeHints node to notify Inventor It can optimize certain rendering features Includes fields vertexOrdering Provides hints about the ordering of the faces of a vertex based shaped derived from SoVertexShape Describes the ordering of all the vertices of all the faces SoShapeHints::COLCKWISE SoShapeHints::COUNTERCLOCKWISE SoShapeHints::UNKNOWN_ORDERING

23 Graphics Laboratory Korea University -23- chung ji hye Shape-Hint Node Includes fields shapeType SoShapeHints::UNKNOWN_SHAPE_TYPE SoShapeHints::SOLID(not an open surface) Turns on backface culling & turn off two sided lighting faceType SoShapeHints::UNKNOWN_SHAPE_TYPE SoShapeHints::CONVEX

24 Graphics Laboratory Korea University -24- chung ji hye Complexity Node SoComplexity node Amout of subdivision into polygons for subsequent shape node in the scene graph Three fields Type General type of complexity SoComplexity::SCREEN_SPACE SoComplexity::OBJECT_SPACE Value Provides a hint about the amount of subdivision desired textureQuality Hint about the quality of texture mapping used on the object

25 Graphics Laboratory Korea University -25- chung ji hye Complexity Node example OBJECT_SPACESCREEN_SPACE

26 Graphics Laboratory Korea University -26- chung ji hye Units Node SoUnits node Define your data in a variety of different units Acts like a scale node by scaling subsequent shapes into the specified units SoUnits::METERS SoUnits::CENTIMETERS SoUnits::MILLIMETERS SoUnits::KILOMETERS SoUnits::YARDS

27 Graphics Laboratory Korea University -27- chung ji hye Binding Nodes SoMaterialBinding How to bind materials to shapes SoMaterialBinding::DEFAULT Uses the best binding for each shape SoMaterialBinding::OVERALL Uses the first current material for the entire shape SoMaterialBinding::PER_PART Binds one material to each part in the shape SoMaterialBinding::PER_PART_INDEXED Binds one material to each part by index And so on …

28 Graphics Laboratory Korea University -28- chung ji hye Thinking If the number of current materials is greater than the number of parts? Simply ignore the extra materials if they ’ re not required If the current material contains fewer values than the binding requires? Cycles through the current values as often as needed

29 Graphics Laboratory Korea University -29- chung ji hye Indexed Binding Use the current material values in a new order Inventor refer to the materials-index field of the shape node(SoIndexdFaceSet, SoIndexedLineSet) PER_FACE_INDEX, PER_VERTEX_INDEX … Example SoIndexedFaceSet Material List 0 peach 1 khaki 2 white Material Index 1, 1, 0, 2

30 Graphics Laboratory Korea University -30- chung ji hye Indexed Binding Specify PER_FACE Ignores the materialIndex field, cycles in order Face1 peach (0) Face2 khaki (1) Face3 white (2) Face4 peach (0) Specify PER_FACE_INDEXED Face1 khaki (1) Face2 khaki (1) Face3 peach(0) Face4 white (2)

31 Graphics Laboratory Korea University -31- chung ji hye Binding per Vertex PER_VERTEX Selects materials in order from the materials list PER_VERTEX_INDEXED Selects materials in order from the materials index

32 Graphics Laboratory Korea University -32- chung ji hye Normal Binding SoNormalBinding node Type of normal binding specified Hint to the shape node about how to apply the current normals to that shape SoIndexedFaceSet, SoIndexedTriangleStripSet Contain a normalIndex field normalIndex field store indices into the normals list Ginding specifed does not require indices, the normalindex field is not used Indexed normals do not cycle

33 Graphics Laboratory Korea University -33- chung ji hye Generating normals Automatically SoVertexShape Normals can be generated automatically for any shape derived Generating normals DEFAULT normal binding is used Do not specify any normals The number of normals is different from the number of vertices

34 Graphics Laboratory Korea University -34- chung ji hye Transformations Cumulative effect on the current geometric transformation SoTransform Node Translation Translation in x, y, z Rotation Rotation in terms of an axis and angle : x, y, z, angle scaleFactor Scaling factor in x, y, z ScaleOrientation Ratation to apply before the scale is applied Center Center point for rotation and scaling

35 Graphics Laboratory Korea University -35- chung ji hye Order of Transformations Last field in the node affects the shape object first The groups with transformations in different order

36 Graphics Laboratory Korea University -36- chung ji hye Order of Transformations Effects of ordering transformation


Download ppt "Shapes Properties Binding 2001.08.14 Chung Ji Hye."

Similar presentations


Ads by Google