PDA

View Full Version : Normal alignment value



benkyma
08-12-2015, 10:03 AM
How could I calculate a value for how much a normal faces towards another vector?
I'd like to displace in my vertex shader, but in increasing amount if the normals face in a certain direction

I'm using a noise function to create displacement b here:

vec3 newPosition = position + normal * vec3(b*amplitude);

Dark Photon
08-13-2015, 06:24 PM
Normalize the vectors, and use the dot product.