dynamic model lighting

Started by
3 comments, last by FReY 19 years, 8 months ago
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!
Advertisement
its probably nowt more than per-vertex lighting being done on the model
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.
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??
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...



do unto others... and then run like hell.

This topic is closed to new replies.

Advertisement