Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OregonGhost

Direct3D8 Lighting dependant of triangle size?

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

I am programming a simple terrain engine with Direct3D lighting. It works well, but I wanted to scale the terrain by factor = 2 or 3. So I multiply the vertex position vectors by factor. But now the terrain is much too bright. I found out that I have to divide the light brightness by (factor*factor)! Why? Oregon Ghost Wenn NULL besonders gross ist, ist es fast schon wie ein bisschen eins ;c) if NULL is very big, it is almost like a little one.

Share this post


Link to post
Share on other sites
Advertisement
You can choose either way. Call this function to enable D3D to normalize the normals.
IDirect3DDevice8::SetRenderState( D3DRS_NORMALIZENORMALS, TRUE );

Share this post


Link to post
Share on other sites
It does describe a direction, but if you do do a dot product using a none unit length normal, you results will be scaled accordingly. (Which is why things got x times brighter when you scaled the normal by x).

You can use
IDirect3DDevice8::SetRenderState( D3DRS_NORMALIZENORMALS, TRUE );

But it is more efficent to only calculate unit length normals once, not every frame, for obvious speed reasons.

Share this post


Link to post
Share on other sites
Yes, or you could have the card do it for you
SetRenderState(D3DRS_NORMALIZENORMALS, TRUE);

T

--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!