Diffuse and Material/Lights?

Started by
2 comments, last by SirPaladin 20 years, 10 months ago
Just a quick question to make sure I understand how all the basics work. I''m going through all of Jim''s RPG cGraphics objects to make sure I understand it/them, and I''ve gotten past Materials and Lights (well, I think I have). My question is, I have the following Vertex Buffer described:

typedef struct sVertex 
{
	float x, y, z;
	float nx, ny, nz;
	D3DCOLOR Diffuse;
} sVertex;
 
When the light is on, my material takes over and displays red. When the light is off, my diffuse color takes over. My question is: Is there a way for the Material color and Diffuse color to "mix" per se when the light is on? When I have the light on, DirectX ignores my Diffuse color altogether. Just curious if there is a way to display both the material and diffuse colors together?
Advertisement
they should anyways.
You can instruct the lighting to use your vertex diffuse or vertex specular or material color for each component via D3DRS_DIFFUSEMATERIALSOURCE, D3DRS_SPECULARMATERIALSOURCE, D3DRS_AMBIENTMATERIALSOURCE, and D3DRS_EMISSIVEMATERIALSOURCE. Mixing vertex diffuse and material colors is not possible. You could always look into using a shader, and using software shader emulation for non-shader cards. This way you can do whatever you want.
Thanks. I just wanted to make sure I understand the difference between diffuse and material in this case, and wanted to verify that it was not possible.

Thanks for answering my question .


This topic is closed to new replies.

Advertisement