Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Angle Between Vertex Normal and Camera?

Discussion in 'Shaders' started by Beloudest, Mar 24, 2017.

  1. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    I'm struggling to solve a new challenge of trying to add full transparency to a plane when viewed at certain angles for use in particle effects. I'm totally new to shaders and have tried my best to figure out what to do next but am a bit stuck with this Alpha Blended one.

    Essentially I think I need get the normal of each vertex and the normal of the camera and find out the angle between these after which I can add transparency based on my defined angle ranges.

    I'm trying to do this in a Vertex Fragment Shader. This is what I've come up with, it seems to do something by masking my particles when rotating around the scene but it does not seem to treat my particle meshes independently so for whatever reason I'm not getting the angles correctly. Help much appreciated if you have time. Thanks.
     
    Last edited: Mar 25, 2017
  2. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    I'm pretty much trying to achieve this, this script is placed on a Quad.
     
    Last edited: Mar 25, 2017