• Advertisement
Sign in to follow this  

D3DLIGHT_DIRECTIONAL Problem!!!

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

Hi i am nor eable to fix this problem for a while naw i try every thing i tink of but i realy don't find the problem. I want to give the posiblilites to my game engine to work on old card so i add a debug (triangle+light+texture) but i am not eable to set up a simple D3DLIGHT_DIRECTIONAL sun light. This is the light set up.
	this->light.Type = D3DLIGHT_DIRECTIONAL;
	this->light.Diffuse = COLORVALUE(1.0f, 1.0f, 1.0f, 0.0f);
	this->light.Specular = COLORVALUE(0.0f, 0.0f, 0.0f, 0.0f);
	this->light.Direction = D3DXVECTOR3(0.0f,0.0f,1.0f);//SN;
	this->light.Position = D3DXVECTOR3(0.0f,0.0f,100.0f);
	this->light.Range = 400.0f;
	D3DD->SetLight( 0, &this->light );
	D3DD->LightEnable( 0, true );
	D3DD->SetRenderState(D3DRS_NORMALIZENORMALS, true);

Right naw my engine draw a ball and a world. When i move the camera light change in the sceine??? and Specular is diseable. The ball is bright or dark no atenuation is there. If i comment this "MESH->MESH->DrawSubset(0);" there is no light effect at all just Ambient light??? this line draw the ball. I am going crasy i try commenting every thing. i try my engine on other computer but the same thing append. i double check my object normal. And i ask directx to set up my normal. D3DXComputeNormals(pMESH->MESH,NULL); but nothing change. I normalise all normal. I compare my code to a tutorial code that use D3DLIGHT_DIRECTIONAL light!!! Is just like the light is bug. I have done Per pixel lighting, shadow mapping, shadow volume, water reflection. But i have problem with a simple D3DLIGHT_DIRECTIONAL light.

Share this post


Link to post
Share on other sites
Advertisement
First try following the law of spelling and grammar.

Secondly try swapping the Y and Z values of the light, some people for some reason like Y to go up instead of Z, I have no idea why. Direct3D is one of them! Therefore you may be visualizing these axis inconsistently.

Also reading the last line again, if you haven't written shader code that applies the lights and you've overwritten the fixed function pipeline then that's likely your problem. Therefore thirdly try disabling all shaders and effect files.

Share this post


Link to post
Share on other sites
I try comenting all shader code.
I even copy my project and remouve all code that have nothing to do with my object and my light but i still have the same problem.

I realy don't get it.

Share this post


Link to post
Share on other sites
Quote:

First try following the law of spelling and grammar


ganbree don't be a dick.

answer questions to help people, not to feel smart.

i'm so sick of that shit.

-programmer_tom

Share this post


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

  • Advertisement