• Advertisement
Sign in to follow this  

My lights are not turning on

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

i have setup a light using dx fixed function pipeline (D3DLIGHT9)
I just created a point light positioned at players position and lights the terrain
using point light, all normals for the terrain has been computed and materials has also been set,
but the light is not visible, instead the whole terrain is visible, im expecting only some parts near the light can be viewed.

Then i found out that my Vertex definition still has the diffuse member on it set with D3DXCOLOR(255,255,255,255) and my vertex FVF is set as

When i removed the diffuse member of the vertex, then the lights can now be viewed.

1. My first question is why is that(refer above post)?

2. My second question is, from the FVF i mentioned above, im using 2 texture (for base and for detail) do i need to "modulate" the texture in stage 0 with diffuse lightning to get the effects as such?

pDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE); //set the texture as arg1

pDevice->SetTextureStageState(0,D3DTSS_COLORARG2, D3DTA_DIFFUSE); //also refer to diffuse of light not only vertex diffuse?

pDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE); //Modulate texture * diffuse

pDevice->SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_MODULATE); //modulate stage 0 and stage 1

pDevice->SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_CURRENT); //select the output of stage 0 and use at output


It seems that if i did not modulate texture with diffuse in stage 0 the light wont show.

Im just confirming my understanding to you more experience directx guys.

Share this post

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

  • Advertisement