Jump to content
  • Advertisement


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


Lighting: Getting the precalc values out

This topic is 6080 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 can place D3D lights in my scene. All looks good, but I don't need the lights to be dynamic. So, I want to extract the LIT vertex colours. How can you get the vertex colours after D3D has done it's trans/light pass? Edited by - Jonnyboy on February 26, 2002 7:32:44 AM

Share this post

Link to post
Share on other sites
Use ProcessVertices() with SOFTWARE_VERTEX_PROCESSING to perform the lighting to a destination vertex buffer in system memory. You then simply lock that buffer and copy out the diffuse colour from the transformed vertices.

That''s the exact method we used in Pac-Man: Adventures in Time for the lighting on the scenery (the characters were still dynamically lit) to enable the game to look half decent yet run on old cards.

If you have the time to implement it you could do a more sophisticated pre-lighting model - for example look at how offline lightmaps are calculated and do similar calculations per vertex instead (or even sample a lightmap to get those values and use the vertex colour instead of the lightmap on any hardware which doesn''t have enough blend power to use lightmapping!).

An important thing I wish I''d had the chance to put into Pac-Man:AIT would have been pre-calculated shadowing and other occlusion in the vertex colouring which would have added a lot (something I''d recommend anyone going down this route to add...)

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
Thanks S1CA, exactly what I wanted.

Yes I probably will expand it to a bespoke pre-calc shader at some point. It would be good to get the props to cast shadows.

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!