Jump to content
  • Advertisement
Sign in to follow this  

Take diffuse vertex color?

This topic is 4071 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I am a bit ashamed to ask this but how can i take the vertex diffuse color instead of the diffuse material color. I think i have set all the renderstates correct:
device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);   //Ignore 
device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
device->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
device->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE);
device->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
The vertex format looks like that:
struct VERTEX
	FLOAT x, y, z;
	FLOAT nx, ny, nz;
	DWORD color;
	FLOAT u, v;
I cant see what is going wrong here. Another question is how i can unset the material for it is not possible to do something like device->SetMaterial(NULL); Thanks a lot!!

Share this post

Link to post
Share on other sites
If you're not using lighting, it will just use the vertex color.

If you're using light, you set the DIFFUSEMATERIALSOURCE that you've set, but you have to enable all the *MaterialSource states with D3DRS_COLORVERTEX. The diffuse color your stages will see will be a mix of light colors, vertex color, emissive, and ambient colors.

Share this post

Link to post
Share on other sites
Thanks a lot!!! It was this line: device->SetRenderState( D3DRS_COLORVERTEX, TRUE);
I wonder why this is not in the dx docu.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!