PDA

View Full Version : Y component of a normal

Trulsi
11-22-2009, 01:14 PM
Hi guys!

I turn to you again. Still working on my old water project, and this time I'm having trouble with the following:

I assume that the normal vector emitted by a "spot info" node always has length = 1. So, if I extract the Y component (with a vector -> scalar node) I will get 1 only where the normal points directly upwards.

But that doesn't happen! Has anyone else tried this? I could make a screenshot if you need me to make it more clear.

-Truls

serge
11-24-2009, 07:00 AM
I assume that a normal has rotation values. So, extracting X/Y/Z is extracting heading/pitch/bank values.

I got an unexpected result though. I created a cube, and connected the pitch of the normal to a color gradient input (Spot info Normal > Vector Scalar (Y channel) > Gradient input).

Result: when the normal points upwards it equals 1 on the gradient, which seems correct. When the normal is perpendicular it equals 0, which also seems correct. However, I would have expected a rotation of 45 degrees to equal 0.5 on the gradient, but it doesn't: 0.5 on the gradient equals 30 degrees rotation of the normal.

Can anyone explain?

Sensei
11-24-2009, 09:20 AM
length = sqrt( x * x + y * y + z * z )

Normal vector has length 1.0, so f.e.:

sqrt( 0 * 0 + 1 * 1 + 0 * 0 ) = 1 - upward
sqrt( 0.707 * 0.707 + 0.707 * 0.707 + 0 * 0 ) = 1 - 45 degree
sqrt( 0.87 * 0.87 + 0.5 * 0.5 + 0 * 0 ) = 1 - 30 degree

serge
11-24-2009, 03:27 PM
Right... It's a bit more complicated than I thought. :(

Thanks for the reply Sensei. :)

@Trulsi:
As you could read in my post above, I do get a result of 1 when I extract the Y component of a normal pointing directly upwards. Not sure why that doesn't happen with you. (I used "Tools > Vector Scalar, Y channel mode")

Trulsi
11-25-2009, 12:07 AM
Hi guys!

Thanks for checking it out! :) The normal must have XYZ values, as sensei said... And somehow I arrived at a more correct result when I made my displacement taller. Now it seems like it does indeed give 1 when it points exactly upwards. But I want my displacements to be a bit smaller than this, I'm looking to make medium sized waves...

Well well. I'll have to do with it.