Download presentation
Presentation is loading. Please wait.
Published byMildred Smith Modified over 9 years ago
1
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 9 Lighting and Texturing
2
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 2 Objectives F To understand lighting models F To identify point lights, directional lights and spotlights F To identify material properties F To understand Java 3D coloring modes F To create lit scenes with lights, surface normals and materials F To construct and apply fog nodes for atmospheric attenuation and depth cueing F To apply 2D texture mapping and texture cube mapping F To understand texture coordinate generation
3
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 3 Light F Ambient light F Directional light F Point light F Spot light
4
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 4 Light Classes Source Run
5
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 5 Illumination Models F Ambient reflection F Diffused reflection F Specular reflection
6
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 6 Phong Illumination Model Reflection coefficients Shininess exponent
7
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 7 Java 3D Coloring Rules F If the vertex colors are specified in the geometry of the object, the vertex colors are used to define the object coloring. F If a Material node component is defined for the object, the object is lit. The coloring of the object is defined by the lighting model. F If the ColoringAttributes is defined for the appearance of the object, its color is used for the coloring of the object. F Otherwise, the object is colored white.
8
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 8 Enable Lighting F Place lights in the scene graph. F Provide surface normals for the geometry and do not set vertex colors. F Set material for the appearance. Source Run
9
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 9 Atmospheric Attenuation and Depth Cueing F Closer objects appear to be sharp and clear F Far away objects are fuzzy and foggy day F The atmospheric attenuation effects can be simulated with depth cueing F Blend the objects with the background color F Blending is an increasing function of the distance
10
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 10 Fog Classes SourceRun Linear Fog Exponential Fog
11
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 11 Texture Mapping F Map an image to the surface of an object F Texel F Pixel F Magnification F Minification
12
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 12 Texture Mapping F Assign texture coordinates to vertices of the geometry. F Create a Texture object in the appearance bundle. Source Run
13
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 13 Texture Coordinates Texture coordinates define locations in an image Mapping an image to the faces of a cube
14
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 14 Texture Mapping and Lighting Source Run TextureAttributes texatt = new TextureAttributes(); texatt.setTextureMode(TextureAttributes.COMBINE); appearance.setTextureAttributes(texatt); Lighting and texture mapping may be combined
15
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 15 Texture Coordinate Generation F TEXTURE_COORDINATE_2 F TEXTURE_COORDINATE_3 F TEXTURE_COORDINATE_4 F OBJECT_LINEAR F EYE_LINEAR F SPHERE_MAP F NORMAL_MAP F REFLECTION_MAP SourceRun TextureCubeMap NEGATIVE_X NEGATIVE_Y NEGATIVE_Z POSITIVE_X POSITIVE_Y POSITIVE_Z
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.