In Unreal there are 2 nodes called Mask (RGB) and PixelNormalWS.
Which are equivalent SG nodes?
In Unreal there are 2 nodes called Mask (RGB) and PixelNormalWS.
Which are equivalent SG nodes?
Perhaps describing these nodes a bit could help the community answer, if someone is not super versed in Unreal.
use the split node ^^
Shader Graph doesnât have a single node for masking components, you have to chain two together.
Split > Combine
For PixelNormalWS, if you have a normal map, pipe the output of the sample texture into a Transform node, and use from:Tangent to:World.
In Shader Forge, there was actually a node that does this, itâs the Normal Direction node, with a tickbox called âPerturbedâ and if checked gives the normal-map-affected output. Any change we could get that into SGE as a sort of shorthand? Potentially save a lot of time, and makes for a less messy graph.
In the meantime, it seems thereâs no real way to emulate that with a subgraph because itâd still have to reference the modified Normal data.
Iâm confused, you want to replace an existing single node solution with a new single node solution?
The PixelNormalWS node adds a ton of weird complexity since if youâre using it as part of the graph that modifies the normals youâre creating a feedback loop of sorts. I donât know how Shader Graph handles this, but at one point Unreal handled it by crashing the editor ⌠then eventually just making the material pink. Not sure what they do now.
Hereâs an example of it (in shader forge) in use:
This outputs the reflection coefficient (0-1 of how much light is reflected vs refracted) for a transparent surface with given index of refraction. It needs the per-pixel normals (otherwise small normals-only ripples wouldnât be considered).
And it fits nicely in its own little area in the graph. SF didnât have subgraphs, but in theory itâs exactly the kind of section I would put as a subgraph in SGE.
As for feedback loops, plugging the perturbed normal vector into the normal slot on the Master Node definitely sounds like something I would have done, but I canât remember what happened.
I assume it would revert to vertex normals because the per-pixel normal hadnât yet been set at that particular line of code? But then for using it with the smoothness/alpha/whatever calculations, it would then require that normals were calculated pretty early on.
Yes. mask RGB in Unreal for Unityâs equivalent.
I was saying that in reference to the PixelNormalWS node, but yeah, I find needing two nodes cumbersome too. Maybe the existing Swizzle node could have the same (4) (3) (2) outputs.
I used âNormal Vectorâ and set it to âWorldâ to get what i needed. Not sure if its the same for what you need