Thread: position vector for light source

1. position vector for light source

im a bit confused on the parameters for positioning the light source...most of the stuff ive read says light position is defined by a vector...

so i have a terrian from z=-1600 to 800 and y=0 to 700 and x=-400 to 400

if i want to give a sun like lighting effect i position my light at x=0,y=1000,z=-1700 .. but it doesn't seem to work

also any general tips on lighting for terrian would be helpful

thanks
Raza

2. Re: position vector for light source

im a bit confused on the parameters for positioning the light source...most of the stuff ive read says light position is defined by a vector...
It's a 4D vector. If w=1, then it's a positional light source. If w=0, it's a directional light source. Read this: OpenGL Programming Guide: Chapter 5 (Lighting)

If you're new to lighting, start with a directional light source. Fewer parameters to set up and thus fewer ways to get confused.

if i want to give a sun like lighting effect i position my light at x=0,y=1000,z=-1700 .. but it doesn't seem to work
Let's see your code, and possibly a screen shot.

One thing that often trips folks ups is they don't know (or forget) that with the fixed-function pipeline, the light source position is transformed by the MODELVIEW when you set the light source position to determine where it is in eye space.

For more lighting help/tips, see: