Searching For 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.
:slight_smile:

use the split node ^^

1 Like

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.

1 Like

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:

4433443--405250--fresnel_calcs.png
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