Friday, June 3, 2011

Researching Direct3D9 Lighting

While doing some further research into the relation between a graphics API and the graphics driver, I came across this article: Mode Switching.  I recommend reading it if you are interested in the things I discussed in the previous blog post.

I spent most of the day in research, mainly into the way lighting is performed in Direct3D9.  Apparently you can set a material to specify ambient, diffuse, specular, and emissive colors, as well as the specular power.  I originally thought that you had to pass this information in a vertex buffer.  The layout of the MS3D file format makes a lot more sense now, since all of the colors are stored together rather than per vertex.

Another interesting thing I found out is that material colors specify how much of the incoming light affects the resulting color.  Having a diffuse material color of (r:0.5 g:0.0 b:0.0) for example means that 50% of the red component of the light's diffuse color is used, and the green and blue components aren't used at all.

No comments:

Post a Comment