Introduction to Java 3D

Size: px
Start display at page:

Download "Introduction to Java 3D"

Transcription

1 Bern University of Applied Sciences School of Engineering and Information Technology Claude Fuhrer October Part I Introduction Introduction - 2

2 What is Java 3D Java 3D is a high level, object oriented 3D API. It provides high level classes to create, manipulate and display object that compose a scene. With Java 3D, programmers should only think and works in the world coordinates system. Java 3D is built on top of low level API such as OpenGL, Direct3D or JOGL. Java 3D is cross platform. It runs on Windows, Linux and MacOSX. Java 3D is an open source project. Introduction - Introduction 3 Some historical notes Development started in 1997 First release in December 1998 (altough a public beta was available since March 1998) Sun stopped the development of Java 3D mid 2003 During the summer of 2004 Java 3D was released as a community source project Version 1.4 (released on February 24, 2006) was first a bug-fix of the last version released by Sun. Version (released on December 13, 2006) was the first version based on communitiy wishes. Actual version is (November 2008) Next version should be 2.0, with an important refactoring of the API Introduction - Introduction 4

3 Some Features I Multithreaded scene graph structure Platform independent Generic Real-time API, usable for both visualization and gaming Support for retained, compiled-retained, and immediate mode rendering Includes hardware-accelerated JOGL, OpenGL and Direct3D renderers (depending on platform) Sophisticated virtual-reality-based view model with support for stereoscopic rendering and complex multi-display configurations Native support for head-mounted display and CAVE (multiple screen projectors) Introduction - Introduction 5 Some Features II 3D spatial sound Programmable shaders, supporting both GLSL and CG Importers for most mainstream formats, like 3DS, OBJ, VRML, X3D, NWN, and FLT Introduction - Introduction 6

4 Introduction - Introduction 7 Part II The Scenegraph The Scenegraph - 8

5 The scene graph The scene-graph is a structure that arranges the logical and often (but not necessarily) spatial representation of a graphical scene. The definition of a scene-graph is fuzzy, due to the fact that programmers who implement scene-graphs in applications and in particular the games industry take the basic principles and adapt these to suit a particular application. This means there is no hard and fast rule as to what a scene-graph should or should not be. The Scenegraph - The scene graph 9 The scene graph Scene-graphs are a collection of nodes in a graph or tree structure. A node may have many children but often only a single parent (i.e. at most a directed acyclic graph), with the effect of a parent apparent to all its child nodes; an operation applied to a group automatically propagates its effect to all of its members. In many programs, associating a geometrical transformation matrix at each group level and concatenating such matrices together is an efficient and natural way to process such operations. A common feature, for instance, is the ability to group related shapes/objects into a compound object which can then be moved, transformed, selected, etc. as easily as a single object. The Scenegraph - The scene graph 10

6 Some historical notes Scene graph is one of the most important development of computer graphics during the last 20 years One of the first API using a scene graph is Iris Inventor of SGI (about ). The Scenegraph - The scene graph 11 The elements of a scenegraph (Java3D) The Scenegraph - The scene graph 12

7 A Java 3D scene graph The Scenegraph - The scene graph 13 The SimpleUniverse The Scenegraph - The scene graph 14

8 Examples of scenes 1 The Scenegraph - The scene graph 15 Examples of scenes 2 The Scenegraph - The scene graph 16

9 Examples of scenes 3 The Scenegraph - The scene graph 17 The Java 3D scene graph (cont d) Java 3D refines the Node object class into two subclasses: Group and Leaf node objects. Group node objects group together one or more child nodes. A group node can point to zero or more children but can have only one parent (exception SharedNode). A leaf node has no children and only one parent. The Scenegraph - The scene graph 18

10 The Scenegraph - The scene graph 19 Part III How to create a Java3D program How to create a Java3D program - 20

11 Recipe for writing Java 3D programs 1. Create a Canvas3D object 2. Create a VirtualUniverse object 3. Create a Locale object, attaching it to the VirtualUniverse object 4. Construct a view branch graph 4.1 Create a View object 4.2 Create a ViewPlatform object 4.3 Create a PhysicalBody object 4.4 Create a PhysicalEnvironment object 4.5 Attach ViewPlatform, PhysicalBody, PhysicalEnvironment, and Canvas3D objects to View object 5. Construct content branch graph(s) 6. Compile branch graph(s) 7. Insert subgraphs into the Locale How to create a Java3D program - How to create a Java3D program 21 The standard structure of a Java3D program I Typically, most Java3D of the Java3D program have a similar structure. This structure is neither a norm nor mandatory. A Java3D mostly extends extends the Applet class. But, to be usable as a standard application, it also have a Main method wich create an instance of the MainFrame class. Simple Java3D programs use the SimpleUniverse class to create the viewing part of the application. For basic application, it offer a sufficient platform to display the object of the scene. The SimpleUniverse object is displayed into an Canvas3D object. This object takes GraphicsConfiguration object. How to create a Java3D program - How to create a Java3D program 22

12 The standard structure of a Java3D program II One should add a single child to the SimpleUniverse object, using the addbranchgraph(). This method adds the part of the scene graph which contain the description of the objects. The root of this scene graph is normally a BranchGroup object. How to create a Java3D program - How to create a Java3D program 23 Simplified recipe for writing Java 3D programs 1. Create a Canvas3D Object 2. Create a SimpleUniverse object which references the earlier Canvas3D object 3. Customize the SimpleUniverse object 4. Construct content branch 5. Compile content branch graph 6. Insert content branch graph into the Locale of the SimpleUniverse How to create a Java3D program - How to create a Java3D program 24

13 Compile a scene The BranchGroup object has a compile method. Compiling a BranchGroup converts the entire branch graph below the branch group to the Java 3D internal representation of the branch graph. It may also optimize some part of the graph and may improve performance. Compiling a branch graph may make some elements inaccessible How to create a Java3D program - How to create a Java3D program 25 Compile a scene (cont d) How to create a Java3D program - How to create a Java3D program 26

14 Capabilities Making the transformation to the internal representation fix the value of transformations and other objects in the scene graph. Unless specifically provided for in the program, the program no longer has the capability to change the values of the scene graph objects after they are live. If a program still needs the capability to change values in a scene graph object after it becomes live (e.g changing the value of a TransformGroup object creates animations) Java 3D provides a functionnality called the capabilities of the object. Three SceneGraphObject methods are responsible for the handling of these capabilities: 1. void clearcapability(int bit) 2. boolean getcapability(int bit) 3. void setcapability(int bit) How to create a Java3D program - How to create a Java3D program 27 The class GeometryArray The base class for creating geometry is the abstract class Geometry. The abstract class GeometryArray provides tools for manipulating and creating 3D object. The classes PointArray, LineArray, TriangleArray or QuadArray are concrete implementation of this class. All these classes require to defines they base components by giving the coordinates of the edges, i.e. edges would be given more than once. How to create a Java3D program - Creating geometry 28

15 The class IndexedGeometryArray I The class GeometryArray (and its direct subclasses) require that every vertex is given many times. This is not a very efficient way to manage memory. The abstract class IndexedGeometryArray implement the Indexed face-set model seen previously. The concrete implementation of IndexedGeometry are IndexedPointArray, IndexedLineArray, IndexedTriangleArray and IndexedQuadArray The vertices of the model are specified using the setcoordinate() or setcoordinates() methods. How to create a Java3D program - Creating geometry 29 The class IndexedGeometryArray II As all faces are homogeneous (i.e. all triangles or all quads) it is not necessary to specify the number of vertices participating to a face. The faces are described using the method setcoordinateindices How to create a Java3D program - Creating geometry 30

16 The Icosahedron class Let have a look to the Icosahedron class. Remember that the regular icosahedron is one of the five Platonic solids. It is a convex regular polyhedron composed of twenty triangular faces, with five meeting at each of the twelve vertices. It has 30 edges and 12 vertices. How to create a Java3D program - An example : the icosahedron 31 The Icosahedron class (cont d) First, one should define a IndexedTriangleArray object. The constructor of this object needs some informations: The number of vertices for the object The format how the vertices are given (for example if one only gives the coordinates, or the normals too, the type of colors and so on. The max numbers of vertices to be rendered i.e. the length of the index table. The index table is stored as a flat array and since one use a TriangleArray, the length is normally the number of faces 3. In our case, this means that this length would be 60. How to create a Java3D program - An example : the icosahedron: How to define the geometry 32

17 The Icosahedron class (cont d) The IndexedTriangleArray for our icosahedron would be defined as: IndexedTriangleArray icosahedrongeometry = new IndexedTriangleArray ( numberofvertices, GeometryArray.COORDINATES GeometryArray.COLOR_3, 3*numberOfFaces ); How to create a Java3D program - An example : the icosahedron: How to define the geometry 33 The Icosahedron class (cont d) To define this object, one should first define its edges. One can either compute the coordinates of these points or find them in any geometry book. The coordinates of the edges are defined as Point3f, one object for each edge. Point3f vertex[] = new Point3f[12]; vertex[0] = new Point3f(-0.692f, 0.000f, 0.427f)); vertex[1] = new Point3f(0.000f, 0.427f, f)); vertex[2] = new Point3f(0.000f, 0.427f, 0.692f));... Once one have define theses vertices, one can includes them into the IndexedTriangleArray object using the setcoordinates() method as one would see further.. How to create a Java3D program - An example : the icosahedron: How to define the geometry 34

18 The Icosahedron class (cont d) The second step is to define the faces. The simplest way to do that is to define a two-dimensionnal array of int where each line contains the list of vertices indices and the total number of lines is the number of faces. For example, for the icosahedron, one should define an array of 20 lines of 3 columns each. This array can be defined statically if needed. int faces[][] = // Faces {{9,2,6}, {1, 11, 5}, {11, 1, 8}, {0, 11, 4}, // Faces {3, 1, 7}, {3, 8, 1}, {9, 3, 7}, {0, 6, 2}, // Faces {6, 4, 10}, {1, 5, 7}, {7, 5, 2}, {8, 3, 10}, // Faces {4, 11, 8}, {9, 7, 2}, {10, 9, 6}, {0, 5, 11}, {0, 2, 5}, {8, 10, 4}, {3, 9, 10}, {6, 0, 4}}; How to create a Java3D program - An example : the icosahedron: How to define the geometry 35 The Icosahedron class (cont d) One should then add the indices to the indices array. Remember that this array is externally viewed as a flat array, that means that the indices values should be added sequentially. For example: for (int i = 0; i < numberoffaces; ++i) { icosahedrongeometry.setcoordinateindices(i*3, faces[i]); } How to create a Java3D program - An example : the icosahedron: How to define the geometry 36

19 The Icosahedron class (cont d) Per default each vertex is assigned with the white color. To change this, one should create a structure similar to the structure used for the vertices and faces. First one should define some colors and assign them to the structure using the setcolor() method. As the flag COLOR 3 was used to create the IndexedGeometryArray one should define colors of type Color3f. For each vertex of the geometry, one can assign a color using the setcolorindex() method. How to create a Java3D program - An example : the icosahedron: Adding colors 37 The Icosahedron class (cont d) Now one have define the geometry of an icosahedron, but a IndexedTriangleArray is not an object which may be added directly to a scene graph. In a scene graph, one can only add object of type Node or Leaf which is a subclass of Node. Subclasses of Node are divided into 2 categories: 1. Group : These objects are middle nodes of a graph, i.e. they may have childs. These are for example TransformGroup or BranchGroup objects 2. Leaf : These objects are at the end of a graph branch. They contain the object one would add to the scene and display. For example in our case our icosahedron would be a Shape3D How to create a Java3D program - An example : the icosahedron: Creating a Shape3D 38

20 The Icosahedron class (cont d) Our class Icosahdron extends the class Shape3D To be able to display the object, one should explicitly define the geometry of this Shape3D object. This geometry is stored into our IndexedTriangleArray. The Shape3D class provides a method called setgeometry() to add the geometry. The Icosahedron objet may now be added to a scene graph. How to create a Java3D program - An example : the icosahedron: Creating a Shape3D 39 Lights To be able to see the objects composing a scene, one should add some lights sources. Java 3D provides 4 kinds of lights types. These a modelized by the four classes AmbientLight, DirectionalLight, PointLight and SpotLight (which a subclass of PointLight. Every kind of light share three common parameters, its colour, its influencing bounds and its on/off state. How to create a Java3D program - Lighting the scene 40

21 Influencing bounds of a light The portion of a scene where visual objects are illuminated by a particular light source is called that light object s region of influence. The simplest region of influence for a light source uses a Bounds object and the setinfluencingbounds() method of the light. When a light source object s influencing bounds intersects the bounds of a visual object, the light is used in shading the entire object. The influencing bounds of a light determines which objects to light, not which portions of objects to light. How to create a Java3D program - Lighting the scene 41 Java 3D shading model The shading model used by Java 3D remain very simple (this may change in a near future). Basically there is two modes available : 1. Flat mode (defined by the constant SHADE FLAT of class ColorintAttributes) : this shading model does not interpolate the color across the face. 2. Gouraud mode (defined by the constant SHADE GOURAUD) : this shading model interpolate the color across the face (but not the normal vector). Along with these two models, Java 3D provides two virtual shading model called FASTEST and NICEST. The rendering of these two model may depend of the installed hardware. To be able to render an object using the right model, Java 3D needs to have the normals of each faces to be defined. How to create a Java3D program - Lighting the scene 42

22 Viewing the icosahedron Now one have define an Icosahedron. The next step is to build a scene graph containing this object and all other object needed to view it. As it was previouly mentionned, most of the Java3D application extends the class Applet. To create the application, one should define a Canvas3D object which has some specific configuration. The next step is to create the SimpleUniverse object which contains all parameter for the camera and the viewing transformations. There is generally a method (called createscenegraph() in our example) which create the world, that is a subgraph containing the objects one would display.this method returns a BranchGroup object which is added to the main scene graph using the method addbranchgraph() of the VirtualUniverse object. How to create a Java3D program - Lighting the scene: Displaying the objects 43 The createscenegraph() method Even if for some case one would be able to change the parameter of the camera, the viewing transformations and other parameters, the main method is mostly the createscenegraph() method. This method build a subgraph with all the needed geometrical transformations, the objects, the materials of the object and all other attributes. It returns a BranchGroup object. How to create a Java3D program - Lighting the scene: Displaying the objects 44

23 The createscenegraph() method (cont d) The four main steps for creating the scene graph for our demo are: 1. Create an Icosahedron object 2. Create an Appeareance object. This object defines some attributes on how the icosahedron would be displayed. The Appearance object may also contain informations about the texture applied to the object or the colors for the ambient diffuse and specular reflection (Material). 3. Create a TranformGroup object to place the object into the scene. 4. Create some light source (at least an ambient light). Once all these objects have been added to the scene graph, one may compile it to do some optimisations. How to create a Java3D program - Lighting the scene: Displaying the objects 45 The main() method As it was mentionned earlier, the TestIcosahedron class extends the Applet class. If one would like to be able to start this class as a standard application, one should only add a main() method with the following content: Frame frame = new MainFrame(new TestIcosahedron(), framesizex, framesizey); How to create a Java3D program - Lighting the scene: Displaying the objects 46

24 Part IV The Geometry classes The Geometry classes - 47 Geometry and Java 3D Basic geometry shapes of Java 3D objects are modeled as points (vertices), lines (edges) and surfaces (faces). To simplify the differents computations mades on these objects, the edges are mainly segment of straight lines and the faces triangles or planary polygons. The Geometry classes - Java3D Geometry: Geometry in space 48

25 Geometry and Java 3D (cont d) 3D objects are mathematically defined as surfaces given by their implicit functionnal definition or by their set of parametric equations. The implicit equation of a suface is of the form: F (x, y, z) = 0 The parametric equations of a 3D object is something like: x = f (u, v) y = g(u, v) z = h(u, v) The Geometry classes - Java3D Geometry: Geometry in space 49 Example of a sphere The implicit equation of a sphere of radius r centered at C = (x 0 ; y 0 ; z 0 ) is given by: F (x, y, z) := (x x 0 ) 2 + (y y 0 ) 2 + (z z 0 ) 2 r 2 = 0 The parametric equations of a sphere of radius ρ is given by: x = ρ cos ϕ sin θ y = ρ sin ϕ sin θ z = ρ cos θ where 0 φ 2π and π/2 θ π/2 The Geometry classes - Java3D Geometry: Geometry in space 50

26 Example of a sphere The Geometry classes - Java3D Geometry: Geometry in space 51 Example of a torus The implicit equation of a torus with main radius c (the radius from the center of the hole to the center of the tube) and the radius of the tube being a is given by F (x, y, z) := ( c x 2 + y 2 ) 2 + z 2 a 2 = 0 The parametric equation of the same torus is given by: where 0 ϕ, θ 2π x = (c + a cos ϕ) cos θ y = (c + a cos ϕ) sin θ z = a sin ϕ The Geometry classes - Java3D Geometry: Geometry in space 52

27 Example of a torus The Geometry classes - Java3D Geometry: Geometry in space 53 Hierarchy of geometry classes Geometry LineStripArray GeometryArray GeometryStripArray TriangleFanArray CompressedGeometry TriangleStripArray Raster IndexedGeometryArray IndexedLineArray Text3D LineArray IndexedPointArray PointArray IndexedQuadArray QuadArray IndexedTriangleArray TriangleArray IndexedGeometryStripArray IndexedLineStripArray IndexedTriangleFanArray IndexedTriangleStripArray The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 54

28 The abstract class GeometryArray The constructors of the class GeometryArray all need to define the way the geometry is given. For that goal, one need to use the defined constants: 1. COORDINATES : the coordinates of the vertices 2. NORMALS : The normal of vertices 3. COLOR 3 : The RGB colors of the vertices 4. COLOR 4 : The RGB color with the α-channel 5. TEXTURE COORDINATE 2 : 2D texture coordinates 6. TEXTURE COORDINATE 3 : 3D texture coordinates 7. TEXTURE COORDINATE 4 : 4D texture coordinates The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 55 Non indexed geometry classes The classes PointArray, LineArray, TriangleArray and QuadArray define a non indexed geometry. For these classes each vertices appear as many time as it appear in the model Example: TriangleArray ta = new TriangleArray(6, GeometryArray.COORDINATES); ta.setcoordinate(0, new Point3f(0.0f, 0.0f, 0.0f); ta.setcoordinate(1, new Point3f(1.0f, 1.0f, 0.0f); ta.setcoordinate(2, new Point3f(1.0f, 0.0f, 0.0f); ta.setcoordinate(3, new Point3f(1.0f, 0.0f, 0.0f); ta.setcoordinate(4, new Point3f(2.0f, 1.0f, 0.0f); ta.setcoordinate(5, new Point3f(3.0f, 0.0f, 0.0f); The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 56

29 Non indexed geometry classes The example above gives: The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 57 The PointArray class The PointArray class defines a geometry consisting of a set of points. Each vertex specification corresponds to a point in the geometry The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 58

30 The LineArray class The LineArray class defines a geometry of line segments. Eery two points specified sequentially correspond to a line segment in the geometry. The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 59 The TriangleArray class The TriangleArray class defines a surface consisting of triangle patches. Every three vertices defines a triangle, that mean that the total number of points to be specified is 3 number of faces. For example to geometrically define a tetrahedron, one only need 4 points in space, but, to model a tetrahedron using a TriangleArray one need to give a list of 12 vertices, 3 for each faces of the tetrahedron. The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 60

31 The QuadArray class The QuadArray class defines a surface of quadrilateral patches (i.e. surfaces elements) Every four sequential vertex define a quadrilateral. The four vertices are required to be on a plane The constructor of this class throws a java.lang.illegalargumentexception if vertexcount is less than 4 or vertexcount is not a multiple of 4 ; The Geometry classes - Java3D Geometry: Java3D geometry classes hierarchy 61 The GeometryStripArray class Often a vertex in a array is shared by several different polygon. The abstract class GeometryStripArray would allow to shares vertices (or even edges) between many faces, and thus reduce the number of data stored into the geometry description of the object. One may specify many separate strips using the setstripvertexcount() method. Concrete implementation of this abstract class are realized by the classes LineStripArray, TriangleFanArray and TriangleStripArray. The Geometry classes - Java3D Geometry: Stripped geometry 62

32 The LineStripArray class The LineStripArray classe realize a polyline. A sequence of points is used to specify a strip, without duplicating the internal points. For example the code: int[] stripvertexcounts = {2,3} LineStripArray lsa = new LineStripArray (5,GeometryArray.COORDINATES, stripvertexcounts); lsa.setcoordinate(0, new Point3f(0.0f, 1.0f, 0.0f);... lsa.setcoordinate(4, new Point3f(3.0f, 0.0f, 0.0f); The Geometry classes - Java3D Geometry: Stripped geometry 63 The LineStripArray class (cont d) The code give above defines a figure like: The Geometry classes - Java3D Geometry: Stripped geometry 64

33 The TriangleStripArray class The TriangleStripArray class defines strips of triangles. In each strips, every three consecutive vertices define a triangle. One may specify many strips using the same stripvertexcounts structure as above. For example (strip vertex count 5,4): V4 V7 V2 V5 V8 V3 V6 V0 V1 The Geometry classes - Java3D Geometry: Stripped geometry 65 The TriangleFanArray class The TriangleFanArray class offer a special kind of triangle strips. In each strip, the first vertex with two consecutives vertices form a triangle. For example (strip vertex count 6,4): V8 V4 V3 V5 V2 V9 V7 V0 V1 V6 The Geometry classes - Java3D Geometry: Stripped geometry 66

34 Indexed Geometry The classes IndexedPointArray, IndexedLineArray, IndexedTriangleArray and IndexedQuadArray define the objects with an indexed geometry. This means that the coordinates of the vertices and the lists of vertices composing a faces are two distinct structure. In the constructor one have not only to specify the number of vertices but also the number of faces. The coordinates of the vertices are given using the setcoordinate or the setcoordinates methods. The list of vertices composing a face are given using the setcoordinateindex or the setcoordinatesindices methods; See example Icosahedron.java for more informations. The Geometry classes - Java3D Geometry: Stripped geometry 67 Indexed Geometry (cont d) This way to describe an object is exactly the indexed face set model one have previously studied. As the vertices are only given once, one may expect that for complex objects, this structure use less memory than the other geometry classes Nevertheless, when the performance (in time) of rendering is critical, one should prefer the use of strips. The Geometry classes - Java3D Geometry: Stripped geometry 68

35 An example : The IndexedQuadArray class The Geometry classes - Java3D Geometry: Stripped geometry 69 Giving the normals If the constructor of the GeometryArray class use the flag NORMALS, one should give the normal at each vertices. For each vertices one can give the value of the normal using the setnormal or the setnormals methods. This normal vector is normally a vector of norm 1 (normalized vector). As one have previously seen, it is possible to compute the normal of a face using the cross product. Nevertheless, an algorithm like the Newell-algorithm is mostly much more numerically stable. The Geometry classes - Computing the normals 70

36 Giving the normals (cont d) When a surface is given by it parametrical equations, one can use this knowledge to compute the normal. For exemple, let be a sphere given by: x = ρ cos ϕ sin θ y = ρ sin ϕ sin θ z = ρ cos θ Two vectors in a tangent plane can be obtained for the derivatives: x/ ϕ x/ θ v 1 = y/ ϕ and v 2 = y/ θ z/ ϕ z/ θ The Geometry classes - Computing the normals 71 Giving the normals (cont d) Computing the values of theses derivatives gives: ρ sin(ϕ) sin(θ) ρ cos(ϕ) cos(θ) v 1 = ρ cos(ϕ) sin(θ) and v 2 = ρ sin(ϕ) sin(θ) 0 ρ sin(θ) If one use the same values of ϕ and θ used to compute the meshing, one can give an exact value of the derivatives. The Geometry classes - Computing the normals 72

37 The GeometryInfo class An alternative to GeometryArray classes for generating geometry is the GeometryInfo class. It provides a more flexible way to define more general polygons. For example, with the class GeometryInfo one may define a mesh where not all the faces are the same kind of polygon (triangle, quad or pentagon) The utility class NormalGenerator allow to automatically generate the surfaces normals. The utility class Stripifier can stripify a geometry to enhance the velocity of rendering. The Geometry classes - Computing the normals 73 The GeometryInfo class (cont d) The class provides two constructors: public GeometryInfo (GeometryArray ga) and public GeometryInfo (int primitivetype) The primitivetype is one of TRIANGLE ARRAY, TRIANGLE FAN ARRAY, TRIANGLE STRIP ARRAY, QUAD ARRAY or POLYGON ARRAY. The last one should be used if one need to define inhomogeneous meshes. The Geometry classes - Computing the normals 74

38 The GeometryInfo class (cont d) To define inhomogeneous meshes, one should give the following informations: 1. The coordinates of vertices (Point3f) 2. The indices of vertices defining each face 3. The number of strip counts (setstripcounts()) 4. The number of contour counts if one needs to defines meshes with holes (setcontourcount()) Internally, the GeometryInfo class will convert a POLYGON ARRAY primitive to triangle. This done automatically using the class Triangulator The Geometry classes - The GeometryInfo class 75 The GeometryInfo class (cont d) For example, a GeometryInfo object with strip counts = 5,4,3,4 and contour counts = 1, 3 can be: V4 V8 V7 V11 V15 V14 V0 V3 V9 V10 V12 V13 V1 V2 V5 V6 The Geometry classes - The GeometryInfo class 76

39 The primitives For convenience, Java3D offers utility classes for commonly used geometric primitives. These primitives (where size can be given in th constructors) are: 1. Box (float xdim, float ydim, float zdim, Appearance app) 2. Cone (float radius, float height) 3. Cylinder (float radius, float height) 4. Sphere (float radius) For all these primitive, one can access the geometry informations, using getshape() method. The Geometry classes - The primitives 77 Part V Lighting and Texturing Lighting and Texturing - 78

40 The Lights classes Java 3D provides four forms of lights 1. AmbientLight : a light which diffuse equally in all directions 2. DirectionnalLight : a light with a fixed direction where all ray are parrallel 3. PointLight : a light having a position in the virtual world. It emits light rays in all directions. One may also specify an attenuation wich depends of the distance between the illuminated object and the PointLight 4. SpotLight : a subclass of the point light. It emits light ray in a restricted cone-shaped direction. SpotLight define two attenuation factors. One depend on the distance between the light source and the object and the other depends on the angle between the light ray and the axis of the cone. Lighting and Texturing - Lighting: Lights sources 79 The Light class I Every Light inherit from the abstract class Light. This class defines if a light is on or off (method setenable(boolean). Lighting needs to be explicitly enabled with the setenable method or with the lighton parameter in the constructor before any of the child light sources have any effect on illuminating the scene. One can define an influencing bound of the Light object, which help to define which object of the scene should integrate this Light object into its illumination computation. Any object which intersect the influencing bound (even partially) is used to compute the illumination due to this light source. Lighting and Texturing - Lighting: Lights sources 80

41 The Light class II One can restrict the action of the Light object to a given set of object defined by the scope of the light. The scope is a group of nodes defined by a Group object. For example, one may want to limit the scope of a light source to the objects present in a room, even if the influencing bounds of this lighe source include object being in other rooms. Lighting and Texturing - Lighting: Lights sources 81 The abstract Bound class I A Bound object represent a convex closed volume. Many classes of Java3D uses Bound object to limit their domain of influence (and hence speed up the rendering). The API of Java3D provides three concrete implementation of the abstract Bound class: 1. BoundingSphere : the simplest of the three. A BoundingSphere object is defined by Point3d as center and a double as radius. It may also be possible to build a BoundingSphere from another Bound object. 2. The BoundingBox class define an axis-aligned box. This mean that the sides of the box are parrallel to the xy, yz and xz planes. This kind of bounding boxes are commonly used to compute collisions of objects. It is easy and fast to build such an object and the collision of two object of this kind is easy too. Lighting and Texturing - Lighting: Lights sources 82

42 The abstract Bound class II 3. The BoundingPolytope defines a polyhedral bounding region using the intersection of four or more half spaces. The region defined by a BoundingPolytope is always convex and must be closed. For some kind of real objects, using this type of bounding volume may help to reduce the number of false positive intersection. The BoundingBox object may be seen as a special case of BoundingPolytope where 8 planes are used (the minimum of planes one may use to define a polytope). Lighting and Texturing - Lighting: Lights sources 83 The AmbientLight class The AmbientLight class is the simplest light source It my be used as simplified representation of the numerous weak interobject reflections existing in the real world. It is defined by a color (Color3f) and an on/off position (boolean). The lighting it provide is uniform in all direction and location of the scene. Lighting and Texturing - Lighting: Lights sources 84

43 The DirectionalLight class The DirectionalLight class may be used for the modelling light sources that are far-away of the scene (like the sun for a human sized scene) Beside the color and the on/off status, it define also a direction attribute of type Vector3f. All light rays of the DirectionalLight are parallel to the direction vector. Lighting and Texturing - Lighting: Lights sources 85 The PointLight class The PointLight class may be used to model a light source which is into the scene. Beside it color and on/off status, it define a position attribute of type Point3f and an attenuation attribute (Point3f) Am mentionned above, the attenuation attribute is defined with a quadratic model based on the following equation: Att(d) = 1 a 0 + a 1 d + a 2 2 d where a 0, a 1 and a 2 are the coordinates of the Point3f given as attenuation factor. Lighting and Texturing - Lighting: Lights sources 86

44 The SpotLight class I The SpotLight is the more realistic class to model a real light source like a lamp. As it is a subclass of the PointLight class it use all attributes of its super-class. Moreover, it define two supplementary attributes, a spread angle (float) and a concentration (float). The spread angle (in radians) is the half angle of the cone of light. Therefore value lower than 0 are clamped to 0 and values over pi/2 are clamped to π/2. The default spread angle is π/2 radians. Lighting and Texturing - Lighting: Lights sources 87 The SpotLight class II The concentration attributes specify how quickly the light intensity attenuates as a function of the angle of radiation as measured from the direction of radiation. It use the mathematical model: Att(θ) = cos n (θ) where n is the concentration factor. The range of values for n is 0.0 n 128.0, the default value being 0.0 Lighting and Texturing - Lighting: Lights sources 88

45 The Phong equation As one already have seen previously, the most common illumination model is defined by the Phong equation. This model is: I = I a k a + I p k d cosθ + I p k s cos n α where I a is the intensity of the ambient light, I p the intensity of pointlike (i.e. DirectionalLight, PointLight and SpotLight), k a the ambient reflection coefficient, k d the diffuse reflection coefficient and k s the specular reflection coefficient. The diffuse reflection depends on the angle θ between the direction of the light and the normal to the surface, but not on the position of the viewer. The specular reflection depends on the angle α between the reflection direction and the direction of the viewer. This model should be applied to every light source and every wavelength. Lighting and Texturing - Lighting: Java 3D lighting model 89 Java 3D lighting model Java 3D support the Phong illumination model (not the Phong shading model). The Material node component class represent the material properties of the visual object. The ambient, diffuse and specular are represented using the RGB color model. The specular reflection exponent n correspond to the shininess. The Material class define also an emissive coefficient that define the light emitted by the object. One can modify the color behavior of an object using the setambientcolor, setdiffusecolor, setspecularcolor and setemissivecolor methods. Lighting and Texturing - Lighting: Java 3D lighting model 90

46 Coloring rules I There a three different coloring specification for a visual object. 1. The vertex color specification in its Geometry 2. The Material specification in its Appearance 3. The ColoringAttributes specification in its Appearance. The selection of the coloring method is determined as follows: 1. If the vertex colors ars specified in the geometry, they are used to define the object coloring. 2. If the Material node component is defined for the object, the object is lit. The coloring of the object is defined by the lighting model. 3. If the ColoringAttributes is defined for the appearance of the object, its color is used for the coloring of the object. 4. Otherwise the object is colored white. Lighting and Texturing - Lighting: Java 3D lighting model 91 Coloring rules II The decision for the coloring is made individually for each object. It is allowed to have both lit and unlit object in the same scene. The example program Lighting.java gives shows how the coloring is computed. Lighting and Texturing - Lighting: Java 3D lighting model 92

47 Atmospheric attenuation and depth cueing I In the real life, the closer object appear sharper and clearer than objects far away. This phenomenon is the result of atmospheric evaluation. To improve realism in computer graphics, the atmospheric attenuation may be simulated using the depth cueing method. The final color of a rendered point is given by: C = f C 0 + (1 f ) C f where C 0 is the original color of the object and C f the fog color. Lighting and Texturing - Lighting: Java 3D lighting model 93 Atmospheric attenuation and depth cueing II The fog factor f is a decreasing function of the distance of the viewer. The function f is typically a linear function, an exponential function or a Gaussian function of the distance. Lighting and Texturing - Lighting: Java 3D lighting model 94

48 The Fog class hierachy Fog LinearFog ExponentialFog Lighting and Texturing - Lighting: Java 3D lighting model 95 The LinearFog class The LinearFog class defines a fog with a linear f function. The attenuation function is given by: f (z) = back z back front where the front and back are constant defining the bounds where f vary from 1.0 to 0.0 Lighting and Texturing - Lighting: Java 3D lighting model 96

49 The ExponentialFog class The ExponentialFog class uses an exponential function to compute the value of the color of the point. The f function is defined as: f (z) = e density z where the density parameter controls the speed of decrease of function f. Lighting and Texturing - Lighting: Java 3D lighting model 97 Lighting and Texturing - Lighting: Java 3D lighting model 98

50 Texture mapping Real life objects contain many small details, impossible to model with the usual geometric structures. Digital images are relatively inexpensive in providing complex details. Texture mapping is a method that utilize images in graphics rendering. Lighting and Texturing - Texture Mapping 99 Magnification and minification The mapping between pixels and texels is clearly not a one-to-one in general. In a pixel correspond to only a portion a texel, one should use a magnification rule or magnification filter. If a pixel covers many texels, one should use a minification rule or minification filter. Commonly used filters include the selection of the closest texel and the linear interpolation (or combination) of neighboring texels. Lighting and Texturing - Texture Mapping 100

51 Magnification If a texel spread out on many pixels, one speak of magnification. Lighting and Texturing - Texture Mapping 101 Minification If a pixel contain many texels, one speak of minification Lighting and Texturing - Texture Mapping 102

52 Java 3D and the texture Java 3D support texture mapping through the textures-coordinates setting in the geometry of the objects. Creating a texture mapping on a shape involve two steps 1. Assign texture coordinates to the vertices of the geometry 2. Create a Texture object in the appearance bundle The class Texture2D is a NodeComponent. The actual image for a Texture2D is represented by the class ImageComponent2D which may receive its image from a BufferedImage or a RenderedImage. Lighting and Texturing - Texture Mapping 103 Texture Coordinates Texture coordinates in a geometry control the mapping from the texture image to the surface. The coordinates of the texture are always between (0; 0) and (1; 1). The size (in pixel) of a texture image must be a power of 2 in both direction Lighting and Texturing - Texture Mapping 104

53 Texture Coordinates (cont d) (0;1) (1;1) (0;0) (1;0) Lighting and Texturing - Texture Mapping 105 Textures Coordinates : an example I One need to create a die, using the following texture file: Lighting and Texturing - Texture Mapping 106

54 Textures Coordinates : an example II (0;1) (1/3;1) (2/3;1) (1,1) (0; 1/2) (1;1/2) (0;0) (1/3; 0) (2/3;0) (1,0) Lighting and Texturing - Texture Mapping 107 Textures Coordinates : an example III To map this texture onto the cube, one should first define the texture coordinates (TexCoord2f objects), and then map these textures coordinates to the vertices of the cube. (see example Die.java). When the texture coordinates have been mapped, one can apply the texture image using for example a Texture2D object (see below) Lighting and Texturing - Texture Mapping 108

55 Automatic computing of texture coordinates If the object is complex (thousands of faces), it may be a big work to manually define the texture coordinates. Java3D offer a mechanism to define theses coordinates. For that goal one should use a TexCoordGeneration object. This TexCoordGeneration object is then linked to the appearance of the object using the settexcoordgeneration method. Lighting and Texturing - Texture Mapping 109 Loading the image as a texture Once the texture coordinates have been defined, one should load the texture image. For that goal one can use a TextureLoader and a Texture2D object. For example: TextureLoader loader = new TextureLoader(filename, this); ImageComponent2D image = loader.getimage(); Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getwidth(), image.getheight()); texture.setimage(0, image); texture.setenable(true); mapappearance.settexture(texture); Lighting and Texturing - Texture Mapping 110

56 The TextureLoader object The constructor of the TextureClassLoader takes many arguments (depends on the constructor called). Among these arguments one can find 1. an ImageObserver, 2. some flags like ALLOW NON POWER OF TWO, BY REFERENCE, GENERATE MIPMAP or Y UP 3. The format is a constant provided by the Texture class like RGB, RGBA, ALPHA, LUMINANCE or INTENSITY. It define the format of the texture image. 4. A reference to the image file (either it file name or a java.awt.image Lighting and Texturing - Texture Mapping 111 Lighting and Texturing - Texture Mapping 112

57 Part VI Behaviors Behaviors Behaviors Modern computer graphics systems are not limited to rendering static scenes. Incorporating dynamic changes is are common in computer graphics. One may define two types of dynamic changes: 1. Interaction changes the graphic scene under the control of the user input. 2. Animation generates graphics sequences with time, producing an effect of motion. The changes may involve geometry, appareance, transformations. Java3D uses the notion of behavior to facilitate animations or interactions. Behaviors - Behaviors 114

58 Behaviors (cont d) A Behavior is a Java class that makes changes to a scene graph Java 3D behavior support: Supports arbitrary content changes - behaviors are just Java methods Schedules behaviors to run only when necessary Enables composability where independent behaviors may run in parallel without interfering with each other Provides basic dead reckoning for animation execution independent of host speed Behaviors - Behaviors 115 Behaviors Behaviors - Behaviors 116

59 The Behavior class The Behavior class is an abstract class that extends the Leaf class. It has two abstract methods: 1. void initialize() 2. void processstimulus(enumeration wakeupcriteria) The initialize() method is invoked once when a Behavior object becomes lives. The processstimulus() method is invoked by Java3D under certain wakeup condition. A Behavior object works with WakeupCondition objects to complete its execution cycles. For that goal, the class contain the following method 1. void wakeupon (WakeupCondition wakeup) Behaviors - Behaviors 117 The constructor of a behavior The behavior constructor typically receive references to the scene graph elements that will be affected by the behavior. For example, a behavior to move an object would receive a reference to the parent TransformGroup. These external reference could be stored as a member value so that they can be accessed within the processstimulus method whan the behavior is activated Behaviors - Behaviors 118

60 Behavior class hierarchy Behaviors - Behaviors 119 The Behavior class The typical execution cycles of a Behavior class may be: Behavior WakeupOn processstimulus :WakeupCondition WakeupOn processstimulus :WakeupCondition Behaviors - Behaviors 120

61 How it works I During the initialisation of the Behavior object, it sets a WakeupCondition object. When the specified wakeup condition occurs, the WakeupCondition will awaken the Behavior object by calling the processstimulus() method. The behavior processor executes a Behaviors only if the scheduling Bounds of the behavior intersect ViewPlatform s activation region. Behaviors can be manually switched on or off using the setenable method The Java3D behavior processor calls the processstimulus method when the WakeUp condition for the behavior has been met. Behaviors - Behaviors 121 How it works II There a two opportunities to register or update the behavior s wake up condition: 1. at the end of the initialize method 2. at the end of the processstimulus method A behavior does all of its application- or behavior-specific work within the processstimulus method. After executing its behavior-specific code, the behavior must call the wakeupon method to register continued interest on its WakeUp condition, else it will not be activated again. The Java 3D behavior processor calls the initialize method to allow each behavior to set its initial WakeUpCondition. Behaviors - Behaviors 122

62 When do Behaviors run? A behavior s processstimulus method will be called if all the following conditions are mets: 1. The behavior has been added to the scene graph 2. The behavior s scheduling bounds intersect the ViewPlatform s activation region 3. The behavior is enabled 4. The behavior s WakeupCondition is true 5. The method View.isBehaviorScheduleRunning() returns true Behaviors - Behaviors 123 Some WakeUpCriterion objects I WakeupOnActivation Behavior is called the first time the Viewplatform s activation intersect this object scheduling region. WakeupOnAWTEvent Specific AWT event occurs WakeupOnCollisionEntry Specified object collides with any other object of the scene graph WakeupOnCollisionExit Object no longer collides with any other object WakeupOnCollisionMovement Object moves while in collision with other object WakeupOnDeactivation Viewplatform s activation region no longer intersecting with this object s scheduling region Behaviors - Behaviors 124

63 Some WakeUpCriterion objects II WakeupOnElapsedFrame Specific number of frames have elapsed WakeupOnElapsedTime Specific number of millisecond have elapsed WakeupOnTransformChange Transform within a specified TransformGroup changes Behaviors - Behaviors 125 The initialize method The initialize method must be overridden to register the initial WakeUp condition for the behavior. The WakeupCondition object for the behavior may be typically stored in a member variable so that it can be reapplied at the end of the processstimulus method. Behaviors - Behaviors 126

64 The processstimulus method The processstimulus method receive an Enumeration of WakeUp criteria because it could have been activated by many of them. A simple behavior may ignore this enumeration because it know why it was activated. A more complex or composite behavior will have to query the Enumeration and first determine what mode it was activated in. Within the processstimulus process code, the behavior will have to do the job it was designed for (e.g. modify the TransformGroup of an object), At the end of the processstimulus method, the behavior will call the wakeupon method with a previously stored WakeupCondition to ensure that it will be rescheduled for processing. Behaviors - Behaviors 127 Combining wakeup criterion Wakeup criterion may be combined to define multiple conditions. For that goal, the class WakeupCondition has four subclasses: 1. WakeupAnd (WakeupCriterion[] criteria) 2. WakeupOr (WakeupCriterion[] criteria) 3. WakeupOrOfAnds (WakeupAnd[] criteriaands) 4. WakeupAndOfOr (WakeupOr[] criteriaors) Behaviors - Behaviors 128

65 Combining wakeup criterion (cont d) For example, the following code fragment defines a wakeup condition that either 10 seconds have passed or 5 frames are WakeupCriterion[] criteria1 = {new WakeupOnElapsedTime(10000)}; WakeupCriterion[] criteria2 = {new WakeupOnElapsedFrame(5), new WakeupOnCollisionEntry(node)}; WakeupAnd[] ands = {new WakeupAnd(criteria1), new WakeupAnd(criteria2)}; WakeupOrOfAnds condition = new WakeupOrOfAnds(ands); Behaviors - Behaviors 129 Implementing a custom behavior The typical procedure for implementing a custom behavior may be: 1. Define a subclass of Behavior and override initialize() and processstimulus() 2. Set the appropriate wakeup conditions. These wakeup conditions may be also needed into the processstimulus() method. 3. Create an instance of your custom Behavior class and add it to the scene graph as e leaf. 4. Set the influence bounds Behaviors - Behaviors 130

Index. Symbols. aural environment 269

Index. Symbols. aural environment 269 0 Index Index Symbols 2D image 129 2D mouse 194 3D computer graphics, interactive 1 3D graphic, full-immersive 5 3D graphic, non-immersive 5 3D graphic, semi-immersive 5 3D graphics 5 3D graphics API 11

More information

Primitives - Box & Cylinder

Primitives - Box & Cylinder Box Box() Primitives - Box & Cylinder Constructs a default box 2.0 metres in height, width, and depth, centred at the origin Box(float xdim, float ydim, float zdim, Appearance app) Constructs a box of

More information

Java2D/Java3D Graphics

Java2D/Java3D Graphics Java2D/Java3D Graphics Sandro Spina Computer Graphics and Simulation Group Computer Science Department University of Malta 1 Abstraction in Software Engineering We shall be looking at how abstraction is

More information

General Light Methods

General Light Methods Java 3D Lighting Java 3D supports the following types of light sources Ambient Directional Point Spot Java 3D also supports mechanisms for defining the volumes which lights can affect General Light Methods

More information

Computer Graphics I Lecture 11

Computer Graphics I Lecture 11 15-462 Computer Graphics I Lecture 11 Midterm Review Assignment 3 Movie Midterm Review Midterm Preview February 26, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves Computer Graphics Instructor: Brian Curless CSEP 557 Autumn 2016 Homework #2 Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves Assigned: Wednesday, Nov 16 th Due: Wednesday, Nov 30

More information

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

More information

Modelling in Java 3D

Modelling in Java 3D Computer Game Technologies Java 3D Object Modelling - Geometry Computer Game Technologies, 2017 1 Modelling in Java 3D Java 3D provides 3 ways to create physical objects: 1. Basic geometric primitives

More information

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Programming For this assignment you will write a simple ray tracer. It will be written in C++ without

More information

Content. Building Geometry Appearance Lights Model Loaders

Content. Building Geometry Appearance Lights Model Loaders Content Building Geometry Appearance Lights Model Loaders Building Geometry A Geometry represents a 3D object: Mesh: The form or structure of a shape (What to draw) Material: The color, transparency, and

More information

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11 Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

More information

Reflection and Shading

Reflection and Shading Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

More information

Deferred Rendering Due: Wednesday November 15 at 10pm

Deferred Rendering Due: Wednesday November 15 at 10pm CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

More information

Homework #2. Shading, Ray Tracing, and Texture Mapping

Homework #2. Shading, Ray Tracing, and Texture Mapping Computer Graphics Prof. Brian Curless CSE 457 Spring 2000 Homework #2 Shading, Ray Tracing, and Texture Mapping Prepared by: Doug Johnson, Maya Widyasari, and Brian Curless Assigned: Monday, May 8, 2000

More information

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models 3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

More information

Introduction to Programming with Java 3D

Introduction to Programming with Java 3D Introduction to Programming with Java 3D Lecturers Henry A. Sowizral (Organizer) henry.sowizral@eng.sun.com Sun Microsystems, Inc. David R. Nadeau nadeau@sdsc.edu http://www.sdsc.edu/~nadeau San Diego

More information

Interaction and Animation in Java 3D

Interaction and Animation in Java 3D Computer Game Technologies Interaction and Animation in Java 3D Computer Game Technologies, 2017 1 Interaction and Animation in Java 3D Interaction is a change in the scene in response to user action Key

More information

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture 14 Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

More information

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

More information

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014 ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating

More information

Behaviours. Capabilities and Scheduling Bounds

Behaviours. Capabilities and Scheduling Bounds Behaviours Java 3D uses the Behavior class to facilitate interaction and animation This class, and its descendants, are links to user code which can change the graphics and sounds of the virtual universe

More information

CS 4620 Program 3: Pipeline

CS 4620 Program 3: Pipeline CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.

More information

CPSC GLOBAL ILLUMINATION

CPSC GLOBAL ILLUMINATION CPSC 314 21 GLOBAL ILLUMINATION Textbook: 20 UGRAD.CS.UBC.CA/~CS314 Mikhail Bessmeltsev ILLUMINATION MODELS/ALGORITHMS Local illumination - Fast Ignore real physics, approximate the look Interaction of

More information

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM NAME: Login name: Computer Science 46 Midterm 3//4, :3PM-:5PM This test is 5 questions, of equal weight. Do all of your work on these pages (use the back for scratch space), giving the answer in the space

More information

Content. Building Geometry Appearance Lights Model Loaders

Content. Building Geometry Appearance Lights Model Loaders Content Building Geometry Appearance Lights Model Loaders Building Geometry A Geometry represents a 3D object: Mesh: The form or structure of a shape Material: The color, transparency, and shading of a

More information

CS 354R: Computer Game Technology

CS 354R: Computer Game Technology CS 354R: Computer Game Technology Texture and Environment Maps Fall 2018 Texture Mapping Problem: colors, normals, etc. are only specified at vertices How do we add detail between vertices without incurring

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading VR software Two main types of software used: off-line authoring or modelling packages

More information

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading

More information

CS5620 Intro to Computer Graphics

CS5620 Intro to Computer Graphics So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading

More information

The University of Calgary

The University of Calgary The University of Calgary Department of Computer Science Final Examination, Questions ENEL/CPSC 555 Computer Graphics Time: 2 Hours Closed Book, calculators are permitted. The questions carry equal weight.

More information

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming L1 - Introduction Contents Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming 1 Definitions Computer-Aided Design (CAD) The technology concerned with the

More information

Topics and things to know about them:

Topics and things to know about them: Practice Final CMSC 427 Distributed Tuesday, December 11, 2007 Review Session, Monday, December 17, 5:00pm, 4424 AV Williams Final: 10:30 AM Wednesday, December 19, 2007 General Guidelines: The final will

More information

CS452/552; EE465/505. Intro to Lighting

CS452/552; EE465/505. Intro to Lighting CS452/552; EE465/505 Intro to Lighting 2-10 15 Outline! Projection Normalization! Introduction to Lighting (and Shading) Read: Angel Chapter 5., sections 5.4-5.7 Parallel Projections Chapter 6, sections

More information

Modeling the Virtual World

Modeling the Virtual World Modeling the Virtual World Joaquim Madeira November, 2013 RVA - 2013/2014 1 A VR system architecture Modeling the Virtual World Geometry Physics Haptics VR Toolkits RVA - 2013/2014 2 VR object modeling

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Raytracing CS148 AS3. Due :59pm PDT

Raytracing CS148 AS3. Due :59pm PDT Raytracing CS148 AS3 Due 2010-07-25 11:59pm PDT We start our exploration of Rendering - the process of converting a high-level object-based description of scene into an image. We will do this by building

More information

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th 1. a. Show that the following sequences commute: i. A rotation and a uniform scaling ii. Two rotations about the same axis iii. Two

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading () Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

More information

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm 6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid

More information

Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Do we need to represent all I! to represent a color C(I)? No we can approximate using a three-color

More information

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lecture 4 Tamar Shinar Computer Science & Engineering UC Riverside Shadows Shadows for each pixel do compute viewing ray if ( ray hits an object with t in [0, inf] ) then compute

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading Runtime VR systems Two major parts: initialisation and update loop. Initialisation

More information

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project To do Continue to work on ray programming assignment Start thinking about final project Lighting Course Outline 3D Graphics Pipeline Modeling (Creating 3D Geometry) Mesh; modeling; sampling; Interaction

More information

Chapter 7 - Light, Materials, Appearance

Chapter 7 - Light, Materials, Appearance Chapter 7 - Light, Materials, Appearance Types of light in nature and in CG Shadows Using lights in CG Illumination models Textures and maps Procedural surface descriptions Literature: E. Angel/D. Shreiner,

More information

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading CENG 477 Introduction to Computer Graphics Ray Tracing: Shading Last Week Until now we learned: How to create the primary rays from the given camera and image plane parameters How to intersect these rays

More information

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops. OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment

More information

ECE 462 Object-Oriented Programming using C++ and Java. Lecture 21 Yung-Hsiang Lu

ECE 462 Object-Oriented Programming using C++ and Java. Lecture 21 Yung-Hsiang Lu ECE 462 Object-Oriented Programming using C++ and Java Lecture 21 Yung-Hsiang Lu yunglu@purdue.edu Testing Strategy Testing is one, not the only one, step to ensure quality. Before writing code, think

More information

CS 3360 Spring Instructor: Dr. J. Steven Kirtzic, PhD. Java 3D Part 2

CS 3360 Spring Instructor: Dr. J. Steven Kirtzic, PhD. Java 3D Part 2 CS 3360 Spring 2013 Instructor: Dr. J. Steven Kirtzic, PhD Part 2 Positioning Objects So far, the examples have created objects in the same place, the center of the universe In, locations are described

More information

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping Topic 12: Texture Mapping Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping Texture sources: Photographs Texture sources: Procedural Texture sources: Solid textures

More information

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

More information

Adaptive Point Cloud Rendering

Adaptive Point Cloud Rendering 1 Adaptive Point Cloud Rendering Project Plan Final Group: May13-11 Christopher Jeffers Eric Jensen Joel Rausch Client: Siemens PLM Software Client Contact: Michael Carter Adviser: Simanta Mitra 4/29/13

More information

Computer Graphics Ray Casting. Matthias Teschner

Computer Graphics Ray Casting. Matthias Teschner Computer Graphics Ray Casting Matthias Teschner Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg

More information

3D Rendering and Ray Casting

3D Rendering and Ray Casting 3D Rendering and Ray Casting Michael Kazhdan (601.457/657) HB Ch. 13.7, 14.6 FvDFH 15.5, 15.10 Rendering Generate an image from geometric primitives Rendering Geometric Primitives (3D) Raster Image (2D)

More information

Shape3D - Appearances

Shape3D - Appearances Shape3D - Appearances Appearance objects can refer to several different Node Component subclasses called appearance attribute objects PointAttributes LineAttributes PolygonAttributes ColoringAttributes

More information

CS 465 Program 4: Modeller

CS 465 Program 4: Modeller CS 465 Program 4: Modeller out: 30 October 2004 due: 16 November 2004 1 Introduction In this assignment you will work on a simple 3D modelling system that uses simple primitives and curved surfaces organized

More information

Level of Details in Computer Rendering

Level of Details in Computer Rendering Level of Details in Computer Rendering Ariel Shamir Overview 1. Photo realism vs. Non photo realism (NPR) 2. Objects representations 3. Level of details Photo Realism Vs. Non Pixar Demonstrations Sketching,

More information

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized Topic 11: Texture Mapping Motivation Sources of texture Texture coordinates Bump mapping, mip mapping & env mapping Texture sources: Photographs Texture sources: Procedural Texture sources: Solid textures

More information

A new method of defining objects of interest and 3D visualization in FOTOM NG system

A new method of defining objects of interest and 3D visualization in FOTOM NG system A new method of defining objects of interest and 3D visualization in FOTOM NG system Lachezar Lichev, Jakub Hendrych, Radim Kunchicky, Karolina Feberova Department of Computer Science, VSB Technical University

More information

Open Game Engine Exchange Specification

Open Game Engine Exchange Specification Open Game Engine Exchange Specification Version 1.0.1 by Eric Lengyel Terathon Software LLC Roseville, CA Open Game Engine Exchange Specification ISBN-13: 978-0-9858117-2-3 Copyright 2014, by Eric Lengyel

More information

Illumination & Shading: Part 1

Illumination & Shading: Part 1 Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

More information

Computer Graphics: Programming, Problem Solving, and Visual Communication

Computer Graphics: Programming, Problem Solving, and Visual Communication Computer Graphics: Programming, Problem Solving, and Visual Communication Dr. Steve Cunningham Computer Science Department California State University Stanislaus Turlock, CA 95382 copyright 2002, Steve

More information

CPSC / Texture Mapping

CPSC / Texture Mapping CPSC 599.64 / 601.64 Introduction and Motivation so far: detail through polygons & materials example: brick wall problem: many polygons & materials needed for detailed structures inefficient for memory

More information

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics

More information

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. 11 11.1 Basics So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. Global models include incident light that arrives

More information

Assignment 6: Ray Tracing

Assignment 6: Ray Tracing Assignment 6: Ray Tracing Programming Lab Due: Monday, April 20 (midnight) 1 Introduction Throughout this semester you have written code that manipulated shapes and cameras to prepare a scene for rendering.

More information

Introduction to Visualization and Computer Graphics

Introduction to Visualization and Computer Graphics Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Introduction to Visualization and Computer Graphics Visibility Shading 3D Rendering Geometric Model Color Perspective

More information

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL 1 Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 CS 130 Exam I Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is

More information

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch 15-462 Computer Graphics I Lecture 7 Lighting and Shading February 12, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Light Sources Phong Illumination Model

More information

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL International Edition Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL Sixth Edition Edward Angel Dave Shreiner Interactive Computer Graphics: A Top-Down Approach with Shader-Based

More information

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural Topic 11: Texture Mapping Motivation Sources of texture Texture coordinates Bump mapping, mip mapping & env mapping Topic 11: Photographs Texture Mapping Motivation Sources of texture Texture coordinates

More information

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene). Light Shading Shading Shading = find color values at pixels of screen (when rendering a virtual 3D scene). Shading Shading = find color values at pixels of screen (when rendering a virtual 3D scene). Same

More information

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Three-Dimensional Graphics V. Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 55 Shading Guoying Zhao 2 / 55 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Introduction to Computer Graphics 7. Shading

Introduction to Computer Graphics 7. Shading Introduction to Computer Graphics 7. Shading National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: Hearn and Baker, Computer Graphics, 3rd Ed., Prentice Hall Ref: E.Angel, Interactive

More information

Chapter 5. Projections and Rendering

Chapter 5. Projections and Rendering Chapter 5 Projections and Rendering Topics: Perspective Projections The rendering pipeline In order to view manipulate and view a graphics object we must find ways of storing it a computer-compatible way.

More information

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1 Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

More information

CS452/552; EE465/505. Lighting & Shading

CS452/552; EE465/505. Lighting & Shading CS452/552; EE465/505 Lighting & Shading 2-17 15 Outline! More on Lighting and Shading Read: Angel Chapter 6 Lab2: due tonight use ASDW to move a 2D shape around; 1 to center Local Illumination! Approximate

More information

3D Rendering and Ray Casting

3D Rendering and Ray Casting 3D Rendering and Ray Casting Michael Kazhdan (601.457/657) HB Ch. 13.7, 14.6 FvDFH 15.5, 15.10 Rendering Generate an image from geometric primitives Rendering Geometric Primitives (3D) Raster Image (2D)

More information

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I. CITS3003 Graphics & Animation Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

More information

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON Deferred Rendering in Killzone 2 Michal Valient Senior Programmer, Guerrilla Talk Outline Forward & Deferred Rendering Overview G-Buffer Layout Shader Creation Deferred Rendering in Detail Rendering Passes

More information

Chapter 4-3D Modeling

Chapter 4-3D Modeling Chapter 4-3D Modeling Polygon Meshes Geometric Primitives Interpolation Curves Levels Of Detail (LOD) Constructive Solid Geometry (CSG) Extrusion & Rotation Volume- and Point-based Graphics 1 The 3D rendering

More information

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism

More information

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Advanced Lighting Techniques Due: Monday November 2 at 10pm CMSC 23700 Autumn 2015 Introduction to Computer Graphics Project 3 October 20, 2015 Advanced Lighting Techniques Due: Monday November 2 at 10pm 1 Introduction This assignment is the third and final part

More information

Contents. Introduction to Java 3D (1) Some Application Areas. 1. Java 3D Overview. 2. What is a Scene Graph?

Contents. Introduction to Java 3D (1) Some Application Areas. 1. Java 3D Overview. 2. What is a Scene Graph? 240-302, Computer Engineering Lab IV (Software) Introduction to Java 3D (1) Dr. Andrew Davison Room 101, CoE dandrew@ratree.psu.ac.th 240-302 Comp. Eng. Lab IV. Java 3D 1 Contents 1. Java 3D Overview 2.

More information

Illumination Models & Shading

Illumination Models & Shading Illumination Models & Shading Lighting vs. Shading Lighting Interaction between materials and light sources Physics Shading Determining the color of a pixel Computer Graphics ZBuffer(Scene) PutColor(x,y,Col(P));

More information

CSC418 / CSCD18 / CSC2504

CSC418 / CSCD18 / CSC2504 5 5.1 Surface Representations As with 2D objects, we can represent 3D objects in parametric and implicit forms. (There are also explicit forms for 3D surfaces sometimes called height fields but we will

More information

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

SEOUL NATIONAL UNIVERSITY

SEOUL NATIONAL UNIVERSITY Fashion Technology 5. 3D Garment CAD-1 Sungmin Kim SEOUL NATIONAL UNIVERSITY Overview Design Process Concept Design Scalable vector graphics Feature-based design Pattern Design 2D Parametric design 3D

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination (Lighting)! Model the interaction of light with surface points to determine their final color and brightness! The illumination can be computed either at vertices or

More information

Visualisatie BMT. Rendering. Arjan Kok

Visualisatie BMT. Rendering. Arjan Kok Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Color Rendering Illumination 2 Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract

More information

Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations. CS 4620 Lecture 10 Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

More information

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 Announcements Project 2 due Friday, Oct. 24 th Midterm Exam

More information

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions

More information

Shading Languages. Seminar Computer Graphics. Markus Kummerer

Shading Languages. Seminar Computer Graphics. Markus Kummerer Shading Languages Markus Kummerer ABSTRACT Shading Languages provide a highly flexible approach for creating visual structures in computer imagery. The RenderMan Interface provides an API for scene description,

More information

Ray Tracer Due date: April 27, 2011

Ray Tracer Due date: April 27, 2011 Computer graphics Assignment 4 1 Overview Ray Tracer Due date: April 27, 2011 In this assignment you will implement the camera and several primitive objects for a ray tracer, and a basic ray tracing algorithm.

More information

X3D - Texture, Material Properties, Artificial Light Models -

X3D - Texture, Material Properties, Artificial Light Models - X3D - Texture, Material Properties, Artificial Light Models - Felix G. Hamza-Lup, Ph.D Associate Professor / Director NEWS Lab Computer Science and Information Technology Armstrong State University Savannah,

More information