# Mesh Lightning Problem

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

## Recommended Posts

Hi everyone, I have a problem about mesh lightning.I am using .x files for meshs.Mesh lights are stable ı want to change it.I mean some sides of mesh are visible but others not, they are dark.I want to set the light to my look vector so all the sides of mesh can be visible. http://img165.imageshack.us/img165/8895/meshlightsproblem3sh.jpg This ss is show my problem i guess. Does anyone have any idea about solving my problem? Thanks.

##### Share on other sites
From what I can see, in theory there is nothing wrong in that screenshot if the light is coming from the bottom as the light hits the bottom the other sides are darkened as would normally be the case.

If you want to set the light direction to your lookAt vector than you can do that using simple math. You could use a simple approach and position the light at the origin at the viewer and then cast a ray from the viewer using the lookAt vector and then use that resulting vector as the lights direction.

I hope this helps.
Take care.

##### Share on other sites

I set the light like that in the code below.

[sourcecode]g_pEffect->SetVector( "g_vDiffuse", (D3DXVECTOR4*)&g_pMaterials[nObjectnum].MatD3D.Diffuse );// or// Like that i try to set the coord of lightD3DXVECTOR4 vLighDir( vLightDir.x, vLightDir.y, vLightDir.z, 1.0f );			g_pEffect->SetVector( "lhtDir", & vLighDir ); [sourcecode]But it is not working.Do you have any idea about it?

##### Share on other sites
The problem was caused from my .fx file.