Archived

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

mathfeel

light & transparent

Recommended Posts

in the blending lesson, we got this "glass box"...I find that when I go inside the box...with the light on...I can''t see nothing...of course, if the box were wooden, light can''t go in there...reasonable...but since we intend the side to be translucent...shouldn''t we allow some light to pass through? how would we do that? (like sun light passing through the tainted window of a great cathedral)

Share this post


Link to post
Share on other sites
you obviuosly dont understand how lighting works in opengl. simply put, lights are calculated on a per vertex basis using the normals. this you probally already knew. since lighting is done in this manner, textures/vertex alpha colors are ignored. whether a polygon is in front of a light or not will make no difference in how things behind it are lit. there is NO tracing of light rays at all. opengl does not care if you have invisible polygons or the light inside an enclosed box. in fact directional lights dont have a location at all. omni lights (point lights) do have a position and distance, but are not affected by polygons whether they ae solid or not.

for lighting effects you must develop tricks to handle things like translucnt textures. this is why most games today use lightmaps since you can calculate the non dynamic lighting (and dynamic lighting if you use animated textures) using high quality ray tracing. then at run time you only bother with dynamic lights from guns, flashlights, etc. you can do shadowing and light projection using the stencil buffer in realime, but this requires more advanced techniques then you are currently capable of. my advice is to continue working through the tutorials and try to UNDERSTAND what you are reading, coping, and modifing.

Share this post


Link to post
Share on other sites
A simple fix could be to render both sides of the walls in the box. (It would be dark in there if the walls are not drawn). You could dim the light a bit when inside the cube.

Will this work? - Another beginner

Share this post


Link to post
Share on other sites