DirectX Specular issue (no shaders)

Started by
0 comments, last by Jcoose 11 years, 10 months ago
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]
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.

This topic is closed to new replies.

Advertisement