Jump to content
  • Advertisement

Archived

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

Lythic

D3D Lighting

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

Can anyone tell me why my ambient light is not blending with my vertext colors? It''s overwriting all vertices with it''s color... I was under the impression that a blend of the vertex color and the ambient color would take place. For the record, I''m trying to get fog working and it seems that I need the D3D lighting render state set to true for it, sp ambient seemed the best way to go for now until I decide to formally tackle lighting in the game. Anyway, I''m probably not be correct in my assumptions about the lighting stuff... Any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Well, if it makes any difference, I''m rendering a point list - so I have no textures... but I''ll check it out anyway...

Share this post


Link to post
Share on other sites
From what I''ve seen and read, all I need to do to enable ambient light in the scene, is set a render state with the constant D3DRS_AMBIENT and a color value. This basically ensures that when the scene gets presented, none of the vertices rendered will be below the specified value.

Is this right?

However, the result has been that even though my vertices are in many colors, all vertices are rendered in the color value specified by the ambient render state...

So, I''m a little confused. Anyone know the deal?

Share this post


Link to post
Share on other sites
Actually, no. The Diffuse and Specular values of your vertices will be ignored if lighting is on. The lighting engine will calculate all color values from scratch, and override the custom values you set. This is the porblem with vertex fog: you cannot use your own lighting if you want fog to work.

What I suggest is that you use the pixel fog instead. Pixel fog is implemented in the driver (and thus is always on), whereas vertex fog is implemented in the lighting engine. Also, Z-Buffer-based pixel fog is suported by almost all 3d hardware, which allows for very high fps. Check the SDK docs for more information about pixel fog.

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.

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!