Search Unity

Using shader subgraph in VFX ?

Discussion in 'Visual Effect Graph' started by The_Storm_Rider, Mar 22, 2022.

  1. The_Storm_Rider

    The_Storm_Rider

    Joined:
    Jan 28, 2020
    Posts:
    66
    Hi everyone,

    Well I think the title is quite explanatory and I think the answer is no but it would help me a lot : can we use shader subgraph in VFX ?

    My situation is that I created a complex ocean vertex shader with a lot of subgraph. Now I want to use the exact same calculation to compute the seam foam particles and I'd like to shortcut the code copy.

    Thanks in advance !
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,315
  3. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, what you are asking is not possible; while some math operators look similar, ultimately Shader Graph and the VFX Graph have different data types and are producing different shader code.

    If we are talking about just math functions, you can probably re-create some of your Shader Graph functionality from it's previous per-vertex or per-fragment logic and make it work, say, per-particle, but it would be manual work and some operators might be graph specific.

    You unfortunately can't just reuse subgraphs between Shader Graph and the VFX Graph.
     
    Qriva likes this.
  4. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,315
    Oh my, I misunderstood the question.
    This is actually where custom node would be useful. Very loose idea (most likely not possible) - There was somewhere custom node from Thomas plus it's possible to generate code from shader graph - what if you copy it and use it in custom node? However I guess it will be overkill, especially because generated code is very messy and making it work could take more time, than recreating everything in VFX.
     
    VladVNeykov likes this.