Search Unity

Feature Request Access to SV_VertexID from shadergraph

Discussion in 'Shader Graph' started by KillHour, Jul 19, 2019.

  1. KillHour

    KillHour

    Joined:
    Oct 25, 2015
    Posts:
    49
    I've been working on modifying ShaderGraph to support rendering meshes created in compute shaders, and as far as I can tell, the only missing piece to allow me to do it with a custom function node is access to the vertex ID data so I can properly index the buffer. If this was exposed as a property, it would open up a ton of possibilities.
     
  2. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    There's been a couple of questions about SV_VertexID in Shader Graph and they all go unanswered. I want to create a mesh animation via either Shader Graph or the Visual FX graph but I'm stuck because it appears you can't SV_VertexID in Shader Graph - and you can't draw specific triangles in the Visual FX graph.

    Out of the two - the former seems like the biggest oversight and should be the simplest to fix.

    Could the Unity team give an indication that they are aware of this feature request and some hint of whether it's likely to be addressed?
     
  3. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    126
    I'm also waiting answer for this problem
     
    Mese96 and KillHour like this.
  4. ViCoX

    ViCoX

    Joined:
    Nov 22, 2013
    Posts:
    37
    Ping! Any updates on this? I would like to get access to SV_VertexID as well..
     
  5. LooperVFX

    LooperVFX

    Joined:
    Dec 3, 2018
    Posts:
    180
    ryanslikesocool and steego like this.
  6. DanielZeller

    DanielZeller

    Joined:
    Nov 18, 2014
    Posts:
    18
    LooperVFX likes this.
  7. DanielZeller

    DanielZeller

    Joined:
    Nov 18, 2014
    Posts:
    18
    That PR is kind of useless without this one though :) https://github.com/Unity-Technologies/Graphics/pull/3281 Which makes it possible to pass data from the vert stage to the frag stage needed for DrawProcedural UV's.
     
    LooperVFX likes this.
  8. LooperVFX

    LooperVFX

    Joined:
    Dec 3, 2018
    Posts:
    180
    Ah, that makes sense. Thank you for the heads up!
     
  9. LooperVFX

    LooperVFX

    Joined:
    Dec 3, 2018
    Posts:
    180
    While these upcoming features have not yet landed in the graphics packages bundled with the 2021.2 editor alpha, I cloned the graphics repo from github and locally imported the packages from master branch to run a quick test. So far so good!

    Screenshot 2021-03-15 044724.png
     
    SteveKouts likes this.
  10. SteveKouts

    SteveKouts

    Joined:
    Aug 23, 2012
    Posts:
    79
    Thats great, I really need access through shader code though for the vertexID, I'm using Unity 2021.3.21f1 and its still not available it seems.
     
  11. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    168
    Hi @SteveKouts,

    according to the doc, the Vertex ID node was introduced in Shader Graph 12.0 (2021.2).
     
    SteveKouts likes this.