Jump to content
  • Advertisement
Sign in to follow this  
littlewater

Does Alphatest be collide with SpotLight

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

When I set the following: g_pd3dDevice->SetRenderState ( D3DRS_ALPHATESTENABLE, TRUE) ; //alpha g_pd3dDevice->SetRenderState ( D3DRS_ALPHAREF, 0xFE) ; g_pd3dDevice->SetRenderState ( D3DRS_ALPHAFUNC, D3DCMP_GREATER) ; I try to Enable Light : memset ( &g_Light , 0 , sizeof ( D3DLIGHT8 ) ) ; // ÉèÖÃlight g_Light.Type = D3DLIGHT_SPOT ; g_Light.Diffuse.r = 1.0f ; g_Light.Diffuse.g = 1.0f ; g_Light.Diffuse.b = 1.0f ; g_Light.Position.x = 4.0f ; g_Light.Position.y = 4.0f ; g_Light.Position.z = -10.0f ; g_Light.Direction.x = 0.0f ; g_Light.Direction.y = 0.0f ; g_Light.Direction.z = 1.0f ; g_Light.Attenuation0 = 1.0f ; g_Light.Attenuation1 = 0.0f ; g_Light.Attenuation2 = 0.0f ; g_Light.Range = (float) sqrt ( FLT_MAX ) ; g_Light.Falloff = 1.0f ; g_Light.Phi = (FLOAT) ( PI / 6.0 ) ; g_Light.Theta = (FLOAT) ( PI / 9.0 ) ; g_pd3dDevice->SetLight ( 0 , &g_Light ) ; g_pd3dDevice->LightEnable ( 0 , TRUE ) ; Then I got nothing , after took a lot of time to find the cause, i found alpha testenable affected the light, if i delete the phrases about alpha then it works. But I want to get both function colorkey from alphatestenable and ligth from lightset... with depressed in this , i hope sb. could help me...

Share this post


Link to post
Share on other sites
Advertisement
That's an interesting one [oh], unfortunately I don't have an answer for you. I would suggest (if you haven't already) run against the debug runtimes and/or double-check it with the refrast.

If this is actually intentional and part of the specification it'll probably warn you about it; if it's an error caused by your code doing something wrong it'll also tell you what/where you're going wrong.

hth
Jack

Share this post


Link to post
Share on other sites
You're zeroing your light structure, which means D3DLIGHT::Diffuse::a is set to 0. This alpha gets multiplied by your vertices alpha during lighting, which produces a net alpha of zero. Consequently, they get culled away by the alpha test. Add:
g_Light.Diffuse.a = 1.0f;

Share this post


Link to post
Share on other sites
Quote:
Original post by Coder
You're zeroing your light structure, which means D3DLIGHT::Diffuse::a is set to 0. This alpha gets multiplied by your vertices alpha during lighting, which produces a net alpha of zero. Consequently, they get culled away by the alpha test. Add:
g_Light.Diffuse.a = 1.0f;

Good answer - You make it sound so simple [grin]

Jack

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!