Announcement

Collapse
No announcement yet.

Strong/thick fog?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strong/thick fog?

    I'm wondering what would be the best way to do a thick heavy fog where the view distance would be a few meters.

    I tried playing with the height and atmospheric fogs however even when maxed they did not limit visibility enough.

    Something like this. Would it be better achieved with some particle system spawning around the player?

    #2
    You could fake it with a mesh and material which is attached to your character or camera. It would be a kind of fake volumetric effect, like in the weather fx pack on the marketplace.
    For the material you would need a cloud texture/mask created in Photoshop or in Substance Designer, than connect it to a panner node to make the clouds move. Than setup everything with the emissive and opacity slots to make it work.
    Of course there is a bit more to setup but i think there is good tutorial on youtube for a volumetric fog/light effect.

    Comment


      #3
      Are you sure the heightfog isn't dense enough? Look pretty limiting to me hehe...

      Click image for larger version

Name:	fog.jpg
Views:	1
Size:	354.8 KB
ID:	1099913

      Comment


        #4
        The Exp Height Fog will serve your needs, but the Z location of the fog actor needs to be near the Z location of the camera. If it's significantly below the camera, then the effect will be greatly lessened.

        Comment


          #5
          Thanks for the replies guys.

          For the most part, the height fog is enough.

          However as can be seen from the screenshot, the sky unfortunately doesn't get blocked nearly enough.

          Settings screenshot.

          I tried moving the z location up/down like kirk.clawson and found the point where its the thickest, which is where the screenshot is from. If I moved it either up/down from that point it started thinning out. However the sky doesn't get blocked more than this.

          Am I missing something simple (like usually)?
          Last edited by Gmi; 02-05-2016, 02:23 PM.

          Comment


            #6
            Try dropping your falloff to something very small like 0.001

            Comment


              #7
              Hm, I must be doing something terribly wrong here..

              0.001

              1.0

              I'm seeing surprisingly little difference.

              Comment


                #8
                Looks like you have two height fogs and an atmo fog in your scene. I've seen weird things when you have multiple fog types in one scene.

                Also, you might try dialing back the inscattering settings, that might help.

                Comment


                  #9
                  Wow, I'm an idiot. Thank you. I can't believe it was so simple. Appreciate the help greatly. I had no idea the different fog types would blend so badly.

                  The solution was to turn off the atmospheric fog.

                  The second height fog seemed to have no effect on anything, either on/off.

                  Comment


                    #10
                    If you want something more volumetric, here's a post process material you can use.
                    Click image for larger version

Name:	volumefogmat.jpg
Views:	1
Size:	227.2 KB
ID:	1099932

                    // RayMarchFog CMOT Float 4

                    float3 lightvec = normalize(float3(0.687334,0.506979,-0.520138));
                    float stepsize=100;
                    float numsteps=50;
                    float mul=0.0;
                    float4 sum={0,0,0,0};
                    for(int i=0;i<numsteps;i++)
                    {
                    if( sum.a > 1) break;
                    float rt=stepsize*mul*(1+(dither/2-0.25));
                    float3 pos=rt*rd+ro;
                    if(rt>scenedepth) break;
                    float3 noisepos1=pos.zxy+float3(300*t,100*sin(t/20),100*sin(t/60));
                    float dens=clamp(MaterialExpressionNoise(noisepos1/500, 0.10000000, 0.00000000, 0.00000000, 1.00000000, 2.00000000, -0.10000000, 1.00000000, 2.00000000, 0.00000000)/3,0,1);
                    float4 col=float4(dens,dens,dens,dens)*fogcol;
                    float dif=clamp(MaterialExpressionNoise((noisepos1+lightvec*100)/500, 0.10000000, 0.00000000, 0.00000000, 1.00000000, 2.00000000, -0.100000000, 1.00000000, 2.00000000, 0.00000000)/3,0,1);
                    col.xyz+=dif;
                    col.rgb*=col.a;
                    sum=sum+col*(1.0-sum.a);
                    mul+=1.0;
                    if (mul>49) sum.a=1;
                    }
                    return clamp(sum,0,1);

                    Click image for larger version

Name:	volumefog.png
Views:	1
Size:	302.0 KB
ID:	1099933

                    Comment


                      #11
                      Nice! Thank you!

                      Comment


                        #12
                        Originally posted by xnihil0zer0 View Post
                        If you want something more volumetric, here's a post process material you can use.
                        [ATTACH=CONFIG]77294[/ATTACH]

                        // RayMarchFog CMOT Float 4

                        float3 lightvec = normalize(float3(0.687334,0.506979,-0.520138));
                        float stepsize=100;
                        float numsteps=50;
                        float mul=0.0;
                        float4 sum={0,0,0,0};
                        for(int i=0;i<numsteps;i++)
                        {
                        if( sum.a > 1) break;
                        float rt=stepsize*mul*(1+(dither/2-0.25));
                        float3 pos=rt*rd+ro;
                        if(rt>scenedepth) break;
                        float3 noisepos1=pos.zxy+float3(300*t,100*sin(t/20),100*sin(t/60));
                        float dens=clamp(MaterialExpressionNoise(noisepos1/500, 0.10000000, 0.00000000, 0.00000000, 1.00000000, 2.00000000, -0.10000000, 1.00000000, 2.00000000, 0.00000000)/3,0,1);
                        float4 col=float4(dens,dens,dens,dens)*fogcol;
                        float dif=clamp(MaterialExpressionNoise((noisepos1+lightvec*100)/500, 0.10000000, 0.00000000, 0.00000000, 1.00000000, 2.00000000, -0.100000000, 1.00000000, 2.00000000, 0.00000000)/3,0,1);
                        col.xyz+=dif;
                        col.rgb*=col.a;
                        sum=sum+col*(1.0-sum.a);
                        mul+=1.0;
                        if (mul>49) sum.a=1;
                        }
                        return clamp(sum,0,1);

                        [ATTACH=CONFIG]77295[/ATTACH]
                        So sorry to necro a thread, but how do I add the "RayMarchFog" Node - I am assuming it's custom C+ that is provided in the post, but how do I add that in UE4?

                        Cheers.

                        Comment


                          #13
                          @Abstracted look up the "custom node"

                          https://docs.unrealengine.com/en-us/...ference/Custom
                          YT Channel: https://www.youtube.com/channel/UCoc...KYPSK6g7vZ5CNg

                          Comment


                            #14
                            Hi everyone, I tried to do the post process material but get this error. It seems that there is no function that gets 10 parameters in MaterialExpressionNoise ...
                            Click image for larger version

Name:	UEError.jpg
Views:	123
Size:	11.8 KB
ID:	1706084
                            Anyone know how to fix this error ?

                            Comment


                              #15
                              But why would you need that when there is Volumetric fog that is already implemented in the engine? Add a exponential heigh fog to the scene and check the Volumetric fog checkbox.

                              Comment

                              Working...
                              X