Search Unity

Question UV5-8 in shader graph shaders

Discussion in 'Shader Graph' started by MFAndreich, Jun 24, 2019.

  1. MFAndreich

    MFAndreich

    Joined:
    Jul 18, 2017
    Posts:
    1
    Hi all... I have problem... I need get UV7 and UV8 sets from my mesh data inside shader graph, but I cant find any way to do this... Maybe exists some workarounds? If it matter I use HDRP.

    P.S. For non srp shaders its can be done by defining custom input struct.
     
    Ylly likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,339
    Not currently possible.

    Closest option would be to modify the generated shader code manually and use that.
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is it possible to use a unity preprocessor for processing mesh uv7 and 8 to copy them to another channel?
     
  4. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    101
    Sorry for bumping this old topic, but is there an update to this? Being unable to access uv4-uv7 is actually a big limitation for me... :( The according issue in the issue tracker was closed as "by design" due to platform-specific limitations (interpolator count limit?), but I'm targeting DX11/12/Vulkan and these APIs should be able to handle this?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Being able to access data on a vertex even if you can't get it in raw form to the pixel shader is still useful though. I have packed data into the vertex and processed per vertex, then sent to the pixel shader over less interpolators than sending the raw data would allow. It seems silly the add this to the meshes but then disallow it in the SG.
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,339
    I mean generally when I see people packing a lot of data per vertex it's because they're specifically doing vertex manipulation of some kind. Foliage or instanced skinning are good examples. It's rare to see that vertex data get passed to the fragment shader. I know Unity worked around this for the Book of the Dead foliage by doing some significant data packing to get multiple values per-float, and that's good practice in general, but outside of the skill level of the vast majority of users.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    But if on the flip side you're actively making writing vertex/fragment shaders hell on earth and telling those advanced users to "Just use the shader graph", then you better be sure your shader graph is both capable and extensible, neither of which Unity is doing.
     
    FrozenKiwi likes this.
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,339
    Agreed. Just saying if the issue Unity has is exposing all 8 UVs to the fragment shader, then only having the last 4 exposed to vertex only operations would be acceptable. Though right now Shader Graph is bad at handling that as there's no messaging to why certain nodes don't work or behave differently when being used for different Master Node inputs.

    Right now they just disallow the connection entirely. I feel like instead it should allow the connection and pop up an error on the problem node instead.
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'd argue that they need to make a choice of who the shader graph is for and what the pipeline looks like for people going beyond it's capabilities. Right now they seem to be saying it's for everyone, but not delivering on what it would take to make that true (I'd argue that's not even possible). Deciding to error or not is really about that vision for what extent the tool should allow.
     
  10. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    101
    It looks like Amplify does support all 8 UV channels (in SRP). So in this case, Amplify seems to be the better option here...

    Really, I don't need any fancy features in ShaderGraph, just access to basic stuff (like UV channels). But what's a bit disappointing is the lack of communication from SG team... it would be quite helpful to know whether or not this issue will be addressed in the near future.
     
  11. andrea_i

    andrea_i

    Joined:
    Nov 18, 2012
    Posts:
    32
    Joining this thread to also raise my concerns about the current state of things with the new shading workflow.
    I just wrapped some work to support my custom tool in HDRP/URP, it heavily relies on compute buffers and it has been hell to write my shaders via code (shader graph missing vertexId and instanceId nodes).

    I think rather than bottle-necking on the good Unity folks for every needed node, they'd be better off exposing more generic custom-nodes to expose any kind of vertex and fragment attribute needed. As well as entry points for pre-processors and vertex-to-fragment data handling.
    We basically need a point of injection at every stage of the shader, plus ways to specify if we want to operate on any pass or a list of specific passes.
     
  12. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    I originally put the request in to amplify to support all 8 and they turned that around in a week. I was very impressed. On that note will SG never support 8 or is this on the todo
     
    DrSeltsam likes this.
  13. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    101
    Thanks, you're a real lifesaver! :) Also thanks @jbooth for the VertexToFragment node, which is also extremely helpful in this regard!

    Btw, I just found this roadmap by accident: https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/tabs/7-shader-graph

    Looks like support for 8 texture channels is at least taken into consideration by SG team. They're also planning on adding custom interpolators, which is a great thing! I'm just afraid it might take a long time until these things are finally available, and until then, SG simply cannot replace ASE, at least for me.

    IDK why Unity did not mention these things here, the lack of communication is a pity...
     
    Last edited: Mar 14, 2020