Archived

This topic is now archived and is closed to further replies.

level10boy

Confused about D3D's lighting model

Recommended Posts

Guest Anonymous Poster   
Guest Anonymous Poster
g_pD3DDevice->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);

Share this post


Link to post
Share on other sites
S1CA    1418
quote:
Original post by eng3d
.. and Phong. When?



By Phong I assume you mean Phong Shading. Phong Illumination has been in D3D for years.

Phong Shading is already possible. Use pixel shaders, there are samples on the relevent IHV websites. Better methods are also possible with pixel shaders.

Simple implementations of Phong Shading are even possible without pixel shaders using the DOTPRODUCT3 per pixel operation. i.e. you put the normals in as vertex colours (3 dimensional vectors = xyz==rgb) so that they get iterated across the face of the polygon. The light vector is passed in a constant such as TFACTOR and the DOTPRODUCT3 operation (L.N) takes place for ever pixel.


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites