Recommended Posts

Does anyone know how to use a pixel shader for lighting...and is there any way you can program the thing to create shadows in realtime? (Yes I expect the min. requirements to be a Geforce2)
---------------------------------------------Hatten something something something!!

0

Share this post

Link to post

Share on other sites

1. The minimum requirement for a programmable pixel shader is actually a GeForce 3 - GF2 only does the fixed function pipeline.

2. Store normals per-pixel in a normal map, pass a light vector in as a constant or an iterated vertex colour, perform the L.N operation to get the intensity, modulate with an attenuation function, add on ambient influence and modulate with the base texture. This is the same as the DOT3 operation which has been available in the fixed function pipeline since 3DLabs Permedia3 or nVidias GeForce256.

3. There seems to be a lot of misconceptions out there about what vertex and pixel shaders actually do! - A pixel shader is a program which is executed to draw a single pixel of a polygon - it has no knowledge of other pixels, no knowledge of other polygons etc. It does not work the same was as a PS2 Vector Unit, nor a RenderMan shader......As for shadows, the tradition methods such as projected shadow maps are still the most common - a pixel shader can be useful for drawing the shadow for such things as softening the edges and making it interact with bump maps correctly. A vertex shader is more useful since it can be used to eliminate back-shadowing and other artefacts.

4. There are samples (with sourcecode) of all of the above at the nVidia website: www.nvidia.com/developer