Sign in to follow this  
udvat

3D vector rotation

Recommended Posts

Say, I have an object,i.e apple in my scene.
The light vector is L0. The surface normals of
the object are pointing towards this light,L0.
Now, the light vector moves a bit and becomes
L1. I want to rotate the surface normals of
my object so that it follows the new light,L1.

I computed
->the angle between L0 and L1
->and the axis of rotation

Then I calculated the Rotation matrix R
using angle-axis rotation method. I applied it to
L0 to check whether it results in L0*R=L1
and it works.

Then I applied the same matrix R to surface
normals of my object. But I see its not
working properly.

Is there any bug in my approach? Do I need to
allign my surface normals to any
of the coordinate axis?

Share this post


Link to post
Share on other sites
What is meant with "the light vector"? The position of a point light source? The direction of a light ray from a light source? Are those vectors given in the same co-ordinate space as the surface normals are?

However, a surface normal is meant to be orthogonal to the surface at a given surface location. Rotating it arbitrarily seems me strange. What is the use case? Perhaps you're speaking of the difference vector from a surface location to a light source position!? Then the way of rotation you're applying will not work at all.

Share this post


Link to post
Share on other sites
Thanks for your reply.

light vector is the difference vector from light position to origin of the coordinate system.
L= (lx,ly,lz)-(0,0,0), where (lx,ly,lz) is the light source position.

I do not mean incident ray here.
So I have 2 such vectors L0 and L1.

I am fixing L0 as (0,0,1) always.
If angle between L0 and L1 is 30 and rotation axis is (0,1,0), then I can
get a rotation matrix R, where L0*R=L1.

I am rotating my surface normals with this R matrix.

What is wrong in my approach? How should I do this?




[quote name='haegarr' timestamp='1307696441' post='4821626']
What is meant with "the light vector"? The position of a point light source? The direction of a light ray from a light source? Are those vectors given in the same co-ordinate space as the surface normals are?

However, a surface normal is meant to be orthogonal to the surface at a given surface location. Rotating it arbitrarily seems me strange. What is the use case? Perhaps you're speaking of the difference vector from a surface location to a light source position!? Then the way of rotation you're applying will not work at all.
[/quote]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this