Lighting model

Started by
0 comments, last by YengaMatiC 18 years, 12 months ago
In our render system (opengl) we can choose between use of vertex and pixel shaders or fixed-function pipeline. I've been playing with FFP to see what lighting model we can render. Here's what it does: -Diffuse (no bumpmapping): Unit0 : tiny normal map with only one normal (0,0,1) Unit1 : normalisation cubemap with tangent space light dir as texcoords We perform a dot3 operation so we get diffuse per-pixel. Then we modulate with albedo texture in unit 2 to get color. -Specular: Unit3: specular cubemap with Phong equation. Only for directional lights. Result is added to diffuse term. Then we interpolate with a reflection cubemap in unit 4 with a constant weighting factor to get more or less reflectivity. I think that diffuse dot3 with the normal as constant color (GL_CONSTANT), so we can save a texture unit for reflection cubemap (4 units total). The problem is specular cubemap. AFAIK it only works for directional lights, so is it possible to compute a specular cubemap for point lights (and spotlights)? I hope tomorrow i can upload some screenshots to show you the results. It looks cool ;)
YengaMatiC for the people[Pandora's Box project]
Advertisement
I got the demo working and there are some screenshots of it running.

Torus textured
Torus textured with reflections
Torus untextured
Torus untextured with reflections

You can download the demo from here (right click -> save as). I think the lighting is ok, but it would be grat to get some (constructive) criticism.

Finally the rendering is:
unit0 with normalised tangent space light vectors, we make a dot3 with GL_CONSTANT that contains normal vector (0,0,1)
unit1 with albedo texture (decal texture)
unit2 with environment map interpolated with previous result
unit3 with specular cube map added to previous result
And a second pass to add ambient lighting.
YengaMatiC for the people[Pandora's Box project]

This topic is closed to new replies.

Advertisement