Creating Normal Maps from Procedural Textures in Shader Graph?

Hi,

I was wondering if it is possible to create a normal map from a procedurally generated texture inside the Shader Graph?

I am building a shader that’s putting rust on copper. I use the Noise Node as a map to draw the rust areas and want to use it as a Normal Map to so it lookes like the rust has eaten into the copper. But the Normal Create Node only accepts Textures Images as Input.

Can someone help me? Thanks in advance :slight_smile:

See the documentation for that node:

Specifically the code example:

Offset = pow(Offset, 3) * 0.1;
float2 offsetU = float2(UV.x + Offset, UV.y);
float2 offsetV = float2(UV.x, UV.y + Offset);
float normalSample = Texture.Sample(Sampler, UV);
float uSample = Texture.Sample(Sampler, offsetU);
float vSample = Texture.Sample(Sampler, offsetV);
float3 va = float3(1, 0, (uSample - normalSample) * Strength);
float3 vb = float3(0, 1, (vSample - normalSample) * Strength);
Out = normalize(cross(va, vb));

The normal is being generated by sampling the texture in three positions. To do that with what you’re doing, you’ll need to do the same thing, which means calculating the noise pattern you want to base the resulting normal from at 3 slight offsets.

1 Like