Sign in to follow this  
sansured

Mesh Lightning Problem

Recommended Posts

sansured    138
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 this post


Link to post
Share on other sites
Armadon    1091
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 this post


Link to post
Share on other sites
sansured    138
Thanks for your answer but i can't set the light point.

I set the light like that in the code below.

[sourcecode]

g_pEffect->SetVector( "g_vDiffuse", (D3DXVECTOR4*)&g_pMaterials[nObjectnum][i].MatD3D.Diffuse );

// or

// Like that i try to set the coord of light

D3DXVECTOR4 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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this