Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Normal alignment value

  1. #1
    Junior Member Newbie
    Join Date
    May 2015
    Posts
    5

    Normal alignment value

    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);

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,123
    Normalize the vectors, and use the dot product.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •