tennesseetuta.blogg.se

How to create specular map
How to create specular map






how to create specular map

The idea can be further generalized to include other lighting models. With a little work the technique can be extended to handle multiple light sources. 7.ĭraw the lighted, textured object into the color buffer.Īs with the separate specular color algorithm, this algorithm requires that the specular material reflectance be premultiplied with the specular light color in the specular texture map. Load the sphere map texture, and enable the sphere map texgen function for unit 1. Set modulate texture environment for unit 0. For two texture units, the steps are modified as follows: 1.ĭefine and enable texture to be combined with diffuse lighting in unit 0. Multiple texture units can also be used to reduce the operation to a single pass. For this technique to work properly, the specular material color should be included in the specular texture map rather than in the vertex colors. If a texture isn't used for the diffuse color, then the algorithm reduces to a single pass using the add texture environment (see Figure 15.5) to sum the colors rather than framebuffer blending. 9.ĭraw the unlighted, textured geometry with vertex colors set to the specular material color. 8.Įnable blending, and set the blend function to GL_ONE, GL_ONE. Load the sphere map texture, and enable the sphere map texgen function. 4.ĭraw the lighted, textured object into the color buffer. 2.ĭefine and enable texture to be combined with diffuse lighting. Assuming a texture map is also used to provide the object's diffuse reflectance, the steps in the two-pass method are: 1.ĭefine the material with appropriate diffuse and ambient reflectance, and zero for the specular reflectance coefficients. As a result, the highlight does not need to be changed when the object moves. Sphere mapping assumes that the view direction is constant (infinite viewer) and the environment (light) direction is infinitely far away. Consequently, the texture map needs to be recomputed whenever the light or viewer position is changed. The bidirectional function, f( L, R), is reduced to a function of a single direction by encoding the direction of the light ( L) relative to the view direction into the texture map. If another function is required, the application can evaluate the specular function at each vertex and send the result to the pipeline as a vertex color. Using the OpenGL pipeline to compute the specular color produces a Blinn (rather than Phong) specular function. The sphere map image for the texture map of the highlight is computed by rendering a highly tessellated sphere, lighted with a specular highlight. This technique interpolates the sphere-mapped coordinates of the reflection vector instead of the highlight itself, and thus a much more accurate sampling of the highlight is achieved. R l ) nįor each polygon in the object, the reflection vector is computed at each vertex.








How to create specular map