Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Vertex World Position With Offset

Discussion in 'Shaders' started by Justafin, Feb 4, 2017.

  1. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    Trying to offset vertex positions based upon their normal, similar to how I've seen it done in outline shaders:

    but I need to also need the world position of the vertex with this offset. Can anyone help?

    Thanks
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    816
    To translate the position from object space to world space you just have to multiply it with the correct matrix:
    Code (CSharp):
    1. mul(unity_ObjectToWorld, vertexPosition);
    Does this answer your question?
     
  3. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    I need the world space position with the vertices offset a small amount in their normal direction.