Sign in to follow this  
Muncher

dynamic model lighting

Recommended Posts

Muncher    101
g'day :) Any ideas on how i can use the levels lightmaps to dynamically light the players? My first thought was to shoot a vector into the ground and get the poly we are standing on, then grab that polys lightmap, bind it to texture unit 1, then draw the players as normal. Is there a better way of doing this? The effect im on about can be seen in, say counterstrike, when you are in a dark area (inside a building say) the gun model is dark, then when you walk outside, the gun model brightens. cheers for any help!

Share this post


Link to post
Share on other sites
jyk    2094
Applying the lightmap to the model probably isn't going to work, as you won't have texture coordinates that will make any sense.

In Quake 3, model lighting is handled differently than world lighting. The world is divided up into 3-dimensional cells, each of which has an average ambient light and a directional component (from what I remember). These values are used to apply vertex lighting to the model, depending on the model's location in world space. This is why your weapon is dark in a dark area, but lightens in lighter areas.

Share this post


Link to post
Share on other sites
Muncher    101
ahhh that makes more sense. And yer, the texture coords would be all screwy.. thanks!
I guess i could have an average per octree node??

Share this post


Link to post
Share on other sites
FReY    424
Some games use a top-down ambient texture of each part of the scene. The object will simply do a drop-down (along the y axis) onto the entire texture and will obtain it's ambient lighting value.

Also, see the following article on Gamasutra:
http://www.gamasutra.com/features/20030813/hargreaves_01.shtml

It seems to yield cool results...



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this