d3dim directional lights question

Started by
4 comments, last by GameDev.net 24 years, 3 months ago
Just a couple of ideas:

1) Are you using D3DVERTEX vertices? Lighting doesn't affect D3DLVERTEX structures (I think)
2) Are you setting the vertex normals?

--TheGoop

Advertisement
Do you have ambient set to max white (0xFFFFFF)?
im using d3dvertex.
my ambient is set to the max for rgb and 0 for alpha.

could it be the material?

Do other types of lights work correctly? If they do then you just have something for the directional light setup wrong. If not then something else is wrong. Put your code up somewhere so i can take a look at it.

Josh

what does the d3dlight7 dvDirection property do for directional lights? it doesn't seem to be doing anything for me. everything looks the same when the x y and z and different and not zero.
its the like the d3dim lights sample
this is in b/w beginscene and endscene

LONG fTimeKey = timeGetTime();
FLOAT x = sinf( fTimeKey*2.000f );
FLOAT y = sinf( fTimeKey*2.246f );
FLOAT z = sinf( fTimeKey*2.640f );

// Set up the light structure
D3DLIGHT7 light;
ZeroMemory( &light, sizeof(light) );
light.dltType = D3DLIGHT_DIRECTIONAL;
light.dcvDiffuse.r = 0.5f + 0.5f * x;
light.dcvDiffuse.g = 0.5f + 0.5f * y;
light.dcvDiffuse.b = 0.5f + 0.5f * z;
light.dvDirection = D3DVECTOR( x, y, z );

pd3dDevice->SetLight( 0, &light );
pd3dDevice->LightEnable( 0, TRUE );

This topic is closed to new replies.

Advertisement