Advertisement

Lighting and increasing view distance

Started by January 14, 2003 09:12 AM
2 comments, last by FireSlash 22 years, 1 month ago
I have two problems currently. First off, i cant seem to get the lighting right. I understand the placement of lights, but are they spot lights (directional) or do they eminate every direction? Second, I need to increase the view distance, The only way I have found to do this so far was with glPerspective, which resulted in some rather unpleasant aftereffects with the FOV
Do you have a 16 bit or 32 bit z buffer?

change it to 32 bit if its at 16. im at school know, i give you some code later
Advertisement
quote:
Original post by FireSlash
First off, i cant seem to get the lighting right. I understand the placement of lights, but are they spot lights (directional) or do they eminate every direction?



generally, there are directional lights, spot lights, point lights as well as many other types of light sources. If you use the openGL lighting model, you can choose between directional lights, spot lights and point lights.

"directional light" means that it''s infinitely far away (light rays are parallel, you can use it e.g. for sunlight), you have to set the w coordinate of the light position to 0 for them, the (x,y,z) position is the direction vector which determines from which direction the light is coming.

if you assign non-zero values to the w coordinate (or don''t specify it, then it''s 1 implicitely), you get a point light which eminates in all directions.

if you specify GL_SPOT_DIRECTION, GL_SPOT_CUTOFF and GL_SPOT_EXPONENT, the point light becomes a spot light.

also note that light coordinates are stored in eye coordinates (after modelview transform).

quote:

Second, I need to increase the view distance, The only way I have found to do this so far was with glPerspective, which resulted in some rather unpleasant aftereffects with the FOV


to increase view distance, use glTranslate to move objects away from the camera. to increase the field of view, change the fovy parameter in gluPerspective.

GA
Visit our homepage: www.rarebyte.de.stGA
In order to increase your "viewing distance", specify a larger far-clip-distance parameter for gluPerspective. You shouldn'' touch FOV to affect the far clip plane.

NB: to ensure you don''t suffer from z-fighting artifacts (read: ugly jaggies caused by loss of resolution in the z-buffer), try to increase your near-clip-distance as much as possible as well. Moving the near clip plane out a small distance will have a much more dramatic effect than bringing the far clip plane in a large distance.

This topic is closed to new replies.

Advertisement