Question
I have a noise texture (perlin noise, to be precise) with its value in the alpha channel and the normal components in rgb
. I now wish to, on the fly, apply some function to the alpha part of the texture. Is there an easy way to calculate the new normal?
My thoughts are that if we know the form of f
, then
∂f/∂x = df/da * ∂a/∂x
Now, we want to know ∂f/∂x
as from this we can calculate the x
component of the normal, we know df/da
as we know the form of f(a)
and ∂a/∂x
is encoded in the normal that we are given in the first place.
Context:
I am creating a procedural rock shader and want some "cracks". To do this I need to take my lumpy perlin noise and apply some function to it. At the moment the function is:
f(x) = 1 - 5.5 * abs(noise);
This makes it more sharp (noise
runs from -1
to 1
).
Here is the basic noise:
And here it is after my transformation:
Here are the normals for the first noise:
What are the normals for the second? You may notice that the given normals are very "steep" This is because the bump map they are computed from goes to +-1 several times per unit area. I thus also need to know the answer to this question so that I can scale down the noise and keep the normals correct.