Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Light vector Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Martin Beck

March 29, 1999, 06:50 AM

Just another simple question...
Why does one almost everywhere use the _same_ light vector for every light calculation?
That would suppose a very, very (infinite) far away light source, doesn't it?
So the angle between the light vector and the face normal of a plane are the same on
every point of it, as long as the plane is faced to us. But no light source can really sent
out parallel light on the whole scene.
So, IMHO, for simulating the fact that the light comes with little bit difference to every
the pseudonormals of the vertices were "found". With interpolating them between vertices,
the angle gets different, and we get, what we can se with phong shading, a specular getting
darker to the polygon outside...
But, why one does not set the lightsource to a defined point and then calc the light vector
to every vertice of a polygon and interpolates THIS ones? One has only the face normal, so it's
just the other way round; except that the light vectors are not thought, they exist in real...
Or am I just a person who knows nothing? ... ;-)

 
Bryan Moodie

April 01, 1999, 11:14 AM

Hi Martin,

>>Why does one almost everywhere use the _same_ light vector for every
>>light calculation?

That's because of the expense in calculating light vectors for every
face/vertex in the scene. Infinitely distant light sources avoid all
of that expense by using one one light vector.

>>But, why one does not set the lightsource to a defined point and then calc
>>the light vector to every vertice of a polygon and interpolates THIS ones?
>>One has only the face normal, so it's just the other way round

The interpolation may work exactly like Phong and have the same speed there,
but you still have to work out those expensive light vectors. When you deal
with an infinite light source, you only have to transform the single light
vector into object space where the vertex normals are already precalculated.
That's much faster than creating normalised light vectors and then having to
also transform them all. I hope that someone has a fast way of doing all of
this.

I'm glad you asked this because you've got me thinking about a faster way.
I'll let you know if I come up with something... (I'm getting ideas)

Bryan

 
Martin Beck

April 04, 1999, 06:14 PM



Bryan Moodie wrote:
>>Hi Martin,
Hi.
>>
>>>>Why does one almost everywhere use the _same_ light vector for every
>>>>light calculation?
>>
>>That's because of the expense in calculating light vectors for every
>>face/vertex in the scene. Infinitely distant light sources avoid all
>>of that expense by using one one light vector.
>>
>>>>But, why one does not set the lightsource to a defined point and then calc
>>>>the light vector to every vertice of a polygon and interpolates THIS ones?
>>>>One has only the face normal, so it's just the other way round
>>
>>The interpolation may work exactly like Phong and have the same speed there,
>>but you still have to work out those expensive light vectors. When you deal
>>with an infinite light source, you only have to transform the single light
>>vector into object space where the vertex normals are already precalculated.
>>That's much faster than creating normalised light vectors and then having to
>>also transform them all. I hope that someone has a fast way of doing all of
>>this.
You're right, but the vertex normals can be the same on two polygons
although these are far away from each other, so, if you phong shade with
them, you can get a specular highlight on _both_ of them! Also the vertex
normals have to be rotated with the world and if a face changes, all vertex
normals which belong to the face have to be re-calculated.
BTW, I think there some sqrt-algorithms which can calc it very fast.

I think it is it worth to use only point lightsources, because the
vertex normals are not really defined. Also the shade of a polygon
can change, just because the vertex normals changed, but the actual
polygon not! And that's not true I think...

But anyway, can I do those point lightsources with hardware, too?

bye
Martin

 
Bryan Moodie

April 05, 1999, 04:37 AM

Hi,


>>You're right, but the vertex normals can be the same on two polygons
>>although these are far away from each other, so, if you phong shade with
>>them, you can get a specular highlight on both of them!


That's a problem of the infinite light source, not phong shading.
But this is what you would really get with an infinitely distant
light source. But all the more reason for local light sources. :)


>>Also the vertex normals have to be rotated with the world and if a face
>>changes, all vertex normals which belong to the face have to be re-calculated.


If you use inverse transforms you can put the light position
into object space. So instead of transforming all of the normals,
you only need to transform the position of the light. You can then
create light vectors for each face and only use the stored normals.
In other words, take the light to the object, not the object to the light.


>>I think it is it worth to use only point lightsources, because the
>>vertex normals are not really defined. Also the shade of a polygon
>>can change, just because the vertex normals changed, but the actual
>>polygon not! And that's not true I think...


I think vertex normals are only used for faking curvature. If the
curvature changes, naturally so will the shading. If you don't want
a curved polygon, then only use a plane normal.


>>But anyway, can I do those point lightsources with hardware, too?


I'm afraid I only know software, maybe someone else can answer that.

Catcha!
-Bry

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.