PDA

View Full Version : lighting



locomo
11-15-2002, 11:02 PM
Hi,
I have drawn a room.In the room
i have to put a conical light source that
projects the light onto a painting on the wall...i was wandering if someone could assist me in understanding how to put material properties to the walls,ceilings, and the floor so that it gives 3D effect. Also how would i make a light source to come out of a cone....
i really appreciate for the assistance
thanx

kehziah
11-16-2002, 02:43 AM
Remember that OpenGL lighting is done per-vertex. If your wall is a simple quad, lighting computations will only be performed on the corners. If your light cone only hits the middle of the wall, it wont be visible.

To avoid this, try to subdivide your wall into a grid. The more subdivision, the better the lighting.

bodros
11-16-2002, 05:38 AM
Also, if you're drawing the room as 5 normal quads, don't forget to define normal vectors. Another thing is that you don't "see" the light itself, so if there are no lighting effects, it doesn't mean the light isn't there.

A handy trick is to draw a small cube or sphere where the light is, to see if it's
actually there.

locomo
11-16-2002, 06:20 AM
Should the normal vector be defined
seperately for each vertex.Or do i have to
define it only once.

bodros
11-16-2002, 06:41 AM
For each vertex.

Note that such quads for walls would then have 1 normal for all 4 vertices.