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.
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.
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.