Archived

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

lighting

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

hi out there, i got some questions about lighting and would be happy if someone helped me. the lighting system of opengl works with vertices, means every vertex is given a lighting value, just like color, and interpolates between these vertices'' values on a polygon. (i think it''s called gouraud shading model). this model works out quite fine as long as you have small polygons and as long as you have round or smooth objects. the problem i have now is the following: i want to light some big polys and i want them to have light spots (if you know what i mean; my english must look kind of awful to some of you). i found out that there is an aproach to do this with "phong" shading, but unfortunately i couldn''t quite get the point. and how does per-pixel-lighting work ? if you know some good resources on this topic please post. (ps: the very best solution of any problem is a good piece of code, of course )

Share this post


Link to post
Share on other sites
Have you checked NeHe''s lightmapping tutorial? That approach works very well for things like streetlights, fixed lights on a wall or the headlights of a car travelling down a flat street (in other words, things that don''t exist! :D)

One way to simulate PPL is to create a dynamic lightmap and just blend it on. For each surface, calculate its distance from and angle to a light and calculate your own bitmap accordingly - it''s just an array of integers from 0 to 255. You can even "light frustum cull" the light, i.e. if a surface is more than, say, 200 units away assume it isn''t affected by the light and don''t include it in the calculations, don''t include a surface in the calculations if it''s behind the light.

Don''t overlook material properties either, especially shininess and specularity - they can add some realism to the scene without adding a lot of code.

I realize it''s a lot more easily said than done! :D. But that''s an idea.

Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

Share this post


Link to post
Share on other sites