# How to layer the Worley noise like this?

Recently I'm trying to implement Siggraph15_Schneider_Real-Time_Volumetric_Cloudscapes_of_Horizon_Zero_Dawn, you can also find this in GPU Pro 7, (part II Lighting, chapter 4, Real-Time Volumetric Cloudscape).

I can make the first Worley noise above and increase the frequency, I can get another Worley noise, but how to blend the two noise to get the middle noise and finally, the third noise"?

The last image is two single frequence worley noise and the result I blend them.You can try your method with them.

My formula is this:

tmp = (worley1 + smoothstep(0, 1, worley1)*worley2*0.5) / (1 + smoothstep(0, 1, worley1)*0.5);
tmp = ReMap(0, 1, 0, 0.7, tmp);


ReMap is:

double ReMap(double oldMin, double oldMax, double newMin, double newMax, double src);


Note that worley1 and worley2 is worley noise range from 0 to 1.The result is close in the first glance,but it's not the same apparently. I think the formula is TOO tricky and maybe I got something wrong.

• Typically you would add both noise values together and then normalize it. See here for some information on this: gamedev.stackexchange.com/a/120480/10728 – jgallant Aug 9 '16 at 10:46
• Thanks for your reply.I tried this:(A+B*A*0.5)/(1+A*0.5),A is the first worley noise value,B is the second worley noise value.This can keep the black part in the first noise image still be black in the second image,but the multiply will destroy the tone.I'll try your reply.May be it'll be help.Thanks again. – FengBruce Aug 9 '16 at 11:42
• Posting the images separately would make it a bit easier for others to experiment with them. – Pikalek Aug 9 '16 at 14:48
• Yes,you are right.I upload two noise.My reputation is too little to upload more than 2 image.So I have to combine them. – FengBruce Aug 10 '16 at 1:40

Using an image editor, I was able to get close as follows:

• layer the image on the right over the top of the image on the left
• reduce the opacity of the top layer to ~66%
• merge layers
• auto level resulting image

I think the equivalent operation would be something like normalize((A + (0.66*B)). The contrast was a bit too sharp, so I suspect a full normalization is not quite right. Maybe mellow it back out with something more like:

C = A + (0.66*B)
D = (normalize(C) + C) / 2


If you want to combine two layers such that "the black part in the first image still be black in the result texture", try this instead:

C[x] = Min(A[x], B[x])


Note: this assumes that black = 0.0 & white = 1.0.

• Thanks for your answer.But I think, this method can not keep the black part in the first image still be black in the result texture. – FengBruce Aug 10 '16 at 1:45
• @FengBruce you are correct. I've added an edit to my original answer to address that part. – Pikalek Jun 7 '17 at 19:46
float blend1 = 0.3f;
float blend2 = 0.3f;
//blend worley1 and worley2
float t = worley1 * (1.0f - blend1) + worley1 * worley2 * 1.25f * blend1;
//blend t and worley3
float t2 = t * (1.0f - blend2) + t * worley3 * 1.25f * blend2;
//revert perlin and scale it, enlarge the perlin noise according to the worley noise
float reuslt = ((1.0f - perlin) * 0.65f) / (1.0f - t2 * 0.6f);

• Please add a paragraph that explains what the chunk of code does. Code chunks without description or comments could fix the issues, but it does not make good answers as it does not help users a lot in solving their issues by themselves. – Vaillancourt Aug 22 '16 at 12:35

I'm so excited that I found a blog about how to get the awesome cloud.

It blends the Worley noise like this:

tmp = worley1 - (1-worley2)*0.25;
tmp = saturate(tmp);


Frankly speaking,the result is analogous with mine. But the method is quite simple and NOT that tricky. And I prefer this one.

The result is like this. It's no doubt that this is the right solution.

Thanks for Jon and Pikalek anyway^_^.

• Oh no,I'm wrong.The result is quite different with mine.The minus operation make the black part of the result image be zero.But my method can NOT do it. – FengBruce Aug 10 '16 at 12:26