lighting

Started by
4 comments, last by lopatsch 20 years, 10 months ago
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 )
Advertisement
ps: i am not fixed on phong shading, i just want to implement some light that causes highlights and lightspots on big poly without having to tesselate them into pieces
developper.nvidia.com

========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
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!)

How does this look ? (you can call it per-vertex-lighting...)
http://www.geocities.com/cippyboy_7/lightmap.jpg
http://www.geocities.com/cippyboy_7/lightmap2.jpg

Relative Games - My apps

Good job cippyboy

========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/

This topic is closed to new replies.

Advertisement