• Advertisement
Sign in to follow this  

DirectX Specular issue (no shaders)

This topic is 2042 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

t8m2rc.jpg


I can't figure out why my specular is so blown out. I can't seam to adjust the color or the power in the material either. When I change the value they do nothing. I'm using a directional light with the Specular color turned to white.



[source lang="cpp"] gDxDevice->SetFVF(D3DFVF_XYZ|D3DFVF_NORMAL);
ZeroMemory(&material, sizeof(D3DMATERIAL9));
material.Diffuse = D3DXCOLOR(0.2f, 0.5f, 0.7f, 0.5f); // set diffuse color to white
material.Ambient = D3DXCOLOR(0.5f, 0.5f, 0.5, 0.5); // set ambient color to white
material.Specular.r = 0.5f;
material.Specular.g = 0.5f;
material.Specular.b = 0.5f;
material.Specular.a = 0.5f;
material.Power = 100;
gDxDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE );

gDxDevice->SetMaterial(&material);
//gDxDevice->SetRenderState(D3DRS_AMBIENT, D3DXCOLOR(0.1f, 0.1f, 0.1f, 0.1f));
gDxDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
gDxDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
gDxDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
//gDxDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
gDxDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 25996);
[/source]

Share this post


Link to post
Share on other sites
Advertisement
I figured it out. My normal's weren't normalized. I did some math to check when I import them and it works now.

Share this post


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

  • Advertisement