Announcement

Collapse
No announcement yet.

Volumetric Fog feedback thread

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Volumetric Fog feedback thread

    Starting this thread for feedback and discussion about the new 4.16 Volumetric Fog feature.







    Full feature description:

    We now have support for Volumetric Fog. This method computes participating media density and lighting at every point in the camera frustum, so we can support varying densities and any number of lights affecting the fog.

    Click image for larger version

Name:	0OriginSmaller.jpg
Views:	1
Size:	191.3 KB
ID:	1217183

    Lighting

    Volumetric Fog supports lighting from:
    * A single Directional Light, with shadowing from Cascaded Shadow Maps or static shadowing, with a Light Function
    * Any number of point and spot lights, with dynamic or static shadowing if 'Cast Volumetric Shadow' is enabled.
    * A single skylight, with shadowing from Distance Field Ambient Occlusion if enabled
    * Particle lights, if 'Volumetric Scattering Intensity' is greater than 0

    Not currently supported:
    * Precomputed global illumination
    * Shadowing of Stationary skylights
    * IES profiles and Light Functions on point and spot lights
    * Shadowing from Ray Traced Distance Field Shadows
    * Shadowing from the volumetric fog itself

    Translucency is properly affected by Volumetric Fog, depending on its position in the scene. By default translucency computes fog at vertices, so water planes with low tessellation can introduce artifacts. These materials can be set to compute fogging per-pixel to solve this with 'Compute Fog Per Pixel'.






    Global controls

    Volumetric Fog controls are on the Exponential Height Fog Component. The exponential height distribution provides a global density for Volumetric Fog.



    Scattering Distribution determines how directional the volumetric scattering is - a value of 0 means light scatters equally in all directions, while a value close to 1 causes scattering predominantly in the direction of the light (you have to be looking at the light to see its scattering).

    Albedo is the overall reflectiveness of the participating media. Clouds, fog and mist, which are based on water particles, have an Albedo close to 1.

    Extinction scale controls how much the participating media blocks light.

    View Distance is the distance from the camera over which Volumetric Fog will be computed. There are a limited number of Z slices in the volume texture, so pushing out the View Distance will increase under-sampling artifacts near the camera.

    Note that Volumetric Fog can't really match the Exponential Height Fog in the distance, as Volumetric Fog is physically based while Exponential Height Fog is not. Properties like StartDistance, FogMaxOpacity and FogCutoffDistance don't affect Volumetric Fog.

    Each light has a 'Volumetric Scattering Intensity' and 'Cast Volumetric Shadow' setting.


    Local controls

    Materials using the new Volume Domain describe Albedo, Emissive and Extinction for a given point in space. Albedo is in the range [0-1] while Emissive and Extinction are world space densities with any value greater than 0.

    Volume materials currently only work on particles, and only positions inside the particle radius are valid, which is usually handled by a SphereMask. The simplest Volume material for a particle system looks like this:

    Click image for larger version

Name:	MaterialSmaller.jpg
Views:	1
Size:	116.1 KB
ID:	1217184

    Placing a single-particle system with that material causes a sphere of density to be added to the Volumetric Fog. The effect is fully 3d with no billboards involved.

    Click image for larger version

Name:	SingleParticleSmaller.jpg
Views:	1
Size:	122.4 KB
ID:	1217186

    Multiple spherical fog particles with noise from textures can be used to limit fog to a certain area.


    Temporal Reprojection

    The volume textures used by Volumetric Fog are relatively low resolution and aligned to the camera frustum. Volumetric Fog uses a heavy temporal reprojection filter with a different sub-voxel jitter each frame to smooth out the aliasing. As a side effect, fast changing lights like flashlights and muzzle flashes leave lighting trails. Disable volumetric fog contribution on these lights with 'Volumetric Scattering Intensity' set to 0.


    Performance

    The GPU cost of Volumetric Fog is primarily controlled by the volume texture resolution, which is set from the Engine Shadow Scalability level. Volumetric fog costs 1ms on PlayStation 4 at High settings, and 3ms on an Nvidia 970 GTX on Epic settings, which has 8x more voxels to operate on.

    Particles using the Volume domain can add significant GPU cost, depending on their 3d overdraw and instruction count. Use 'profilegpu' to inspect this cost.

    Point and Spot lights which have 'Cast Volumetric Shadow' enabled cost ~3x more than unshadowed Point and Spot lights.

  • #2
    There was quite a bit of stuff posted about the fog in the 4.16 preview thread already, I'll quote that here:

    Originally posted by John Alcatraz View Post
    The "Fog cutoff distance" does not seem to work correctly with the volumetric fog, once you are below a certain Z height everything becomes fogged, no matter what the cutoff distance is:



    Is that a bug?
    Originally posted by John Alcatraz View Post
    I find it quite hard to get good results with the volumetric fog outdoors. It looks nice, but I kinda hoped it could replace screen space light shafts. Its basically impossible though to get nice light shafts without having everything be really fogged.

    Everything looks quite washed out when you have the volumetric fog enabled. If you want to get any relevant light shafts, you need to increase the fog density so much that you won't see any sky any more, the sky will just be a uniform white (the fog color), like you see in the gif above.

    Something like this (screen space lightshaft) is not possible with the new volumetric fog it seems:


    I guess it would have been too nice if it would have looked as good as the screen space light shafts, without the limitation of being a screen space effect that disappears when looking in a different direction.

    Originally posted by iniside View Post
    It's doable using Nvidia volumetric lighting.
    I agree though. Build in solution needs to be less physically accurate and more controllable.
    Originally posted by EXpMiNi View Post
    Can we have fog and volumetric at the same time ? I can't find anything to keep the fog enabled.

    Can we have volumetric effect without enabling the light ? Maybe with particules ?

    It will be possible to chose a shape for the volumetric source (area shape for example) ? Or something to avoid "point" source, an offset of it maybe ?

    Volumetric don't seems to be affected by the Source Radius, I'm not sure it was intended, Source Length works.

    It will be very cool to have the ability to disable the source brightness btw, if I have a light saber to do it's cool, but I usualy have my own models and emissives.

    Tweak the shape of the volumetric with a spot light independently of the Inner Cone Angle and Outer Cone Angle coulde be very nice as well.


    Cheers !
    Easy to use UMG Mini Map on the UE4 Marketplace.
    Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

    Comment


    • #3
      Posting replies to questions from the 4.16 preview thread

      The "Fog cutoff distance" does not seem to work correctly with the volumetric fog, once you are below a certain Z height everything becomes fogged, no matter what the cutoff distance is:
      FogCutoffDistance is not currently supported, but I think we will in the future, for the same reason it's useful on non-volumetric fog (separate fog on skybox vs world). See above for other unsupported settings on the exponential height fog.

      Comment


      • #4
        Hey there [MENTION=404]DanielW[/MENTION]!

        First off, again, huge thanks on your work here, this is truly a goldmine of useful tools that you've exposed for us.

        Going into the localized fog via particles with the volume shader domain material, I tried utilizing this last night with a cube mesh emitter to map out a global aligned volume texture to simulate clouds, but within the cube I kept getting weird issues where the texture projection would stretch and warp depending on the camera location and angle. Additionally, the cube would only render the visible pixels up to a certain distance away from my cube emitter, and if I backed up more than a few hundred units away, the effect would appear to cull. Is this due to my use of a mesh emitter over a sprite emitter? I had assumed that the cube would be better for representing a volume, but I didn't give sprites a go immediately, and went to bed after testing the cube emitter.

        Thanks so much again for your help and for this thread, I know I'm not the only one who is super hyped on this update and these features.

        Cheers!

        Comment


        • #5
          I find it quite hard to get good results with the volumetric fog outdoors. It looks nice, but I kinda hoped it could replace screen space light shafts. Its basically impossible though to get nice light shafts without having everything be really fogged.
          If you increase the global density, that's going to happen. You only notice light shafts (shadows of light) if the fog is dense enough to have everything be heavily fogged. There are two ways to have stronger light shafts without heavy global fog:
          1) Keep the global fog density low, but crank up the directional light VolumetricScatteringIntensity and put the ScatteringDistribution setting up near .9.
          2) Keep the global fog density low, but increase it in certain areas with Volume particles.

          Comment


          • #6
            Can we have fog and volumetric at the same time ? I can't find anything to keep the fog enabled.
            Right now volumetric fog replaces 'Fog Inscattering Color' within the Volumetric Fog View Distance. We might change this in the future. It's pretty much impossible to get them to match up at the ViewDistance transition, because they are two completely different techniques.

            Can we have volumetric effect without enabling the light ? Maybe with particules ?
            I don't fully understand this question. The skylight affects volumetric fog which gives an ambient term.

            Volumetric don't seems to be affected by the Source Radius, I'm not sure it was intended, Source Length works.
            I haven't figured out how that should work yet =) Source Radius doesn't actually affect the energy emitted by our lights. I think I will end up changing the way SourceRadius works for surfaces vs Volumetrics.

            It will be very cool to have the ability to disable the source brightness btw, if I have a light saber to do it's cool, but I usualy have my own models and emissives.
            You can already change a single light's intensity on the fog with VolumetricScatteringIntensity.

            Comment


            • #7
              Someone made a great suggestion for the particle volume fog on discord, how hard would it be for you guys to add the ability for particles to subtract from fog density as well as add?
              It's not hard at all to implement. Multiply would probably work better because it wouldn't cause density to go negative. I'll consider it.

              Comment


              • #8
                but within the cube I kept getting weird issues where the texture projection would stretch and warp depending on the camera location and angle
                What were your UVs? The only thing you can really use for UVs in a Volume material is WorldPosition. Right now it does some buggy voxelization of triangle meshes but I intend to change that in the future. Particle sprites are voxelized based on their radius correctly. I didn't remember to test mesh emitters =(

                Additionally, the cube would only render the visible pixels up to a certain distance away from my cube emitter, and if I backed up more than a few hundred units away, the effect would appear to cull.
                This is probably because you're getting to the end of the simulated volumetric fog range. 'View Distance' under 'Volumetric Fog' controls this distance. If you push it out, you'll get less precision up close (more banding in details). With this technique it costs processing power or precision to cover a long view range, you pick which.

                Comment


                • #9
                  Originally posted by DanielW View Post
                  What were your UVs? The only thing you can really use for UVs in a Volume material is WorldPosition. Right now it does some buggy voxelization of triangle meshes but I intend to change that in the future. Particle sprites are voxelized based on their radius correctly. I didn't remember to test mesh emitters =(



                  This is probably because you're getting to the end of the simulated volumetric fog range. 'View Distance' under 'Volumetric Fog' controls this distance. If you push it out, you'll get less precision up close (more banding in details). With this technique it costs processing power or precision to cover a long view range, you pick which.
                  Ah that makes sense, I had been messing with the view distance values and then totally spaced it when the particle thing happened, I assumed I set up a material or particle parameter wrong. That's what I get for waiting until 1am to test stuff.

                  Thanks for your insight, the cube was an editor cube so I'd assume UVs are mapped pretty typically. I'll give it another go with sprites this evening!

                  Comment


                  • #10
                    How to make particles subtract from the exponential height fog instead of add?

                    I have tried just using negative values in any of the material outputs, but that didn't work. There is probably some way to do it, I just didn't find it. Probably some material function or checkbox.

                    So if I would have found that option, I still imagine its quite annoying though to place particles that completely fit the geometry where you want to have no fog. Like, take a very fogged city. Inside of the buildings, there should not be any fog. Is manually placing particles in the buildings that try to fill the building geometry as closely as possible really the only way to remove the fog in the buildings?

                    What would make more sense is to have a mesh, or lets say one or multiple convex meshes, like automatically generated (collision) from a real mesh, and say that inside of that mesh no fog should be visible. Is that possible?

                    If that's not possible, even just placing "No Fog Volumes" (just an AABB like a post process volume) would be simpler than placing particles I think, and for something like buildings that would still work quite fine.
                    Easy to use UMG Mini Map on the UE4 Marketplace.
                    Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

                    Comment


                    • #11
                      I haven't played with the new fog yet, but is it possible to simulate the Tyndall Effect, IE: blue light gets reflected, and red/orange light gets transmitted?

                      Comment


                      • #12
                        Originally posted by DanielW View Post
                        If you increase the global density, that's going to happen. You only notice light shafts (shadows of light) if the fog is dense enough to have everything be heavily fogged. There are two ways to have stronger light shafts without heavy global fog:
                        1) Keep the global fog density low, but crank up the directional light VolumetricScatteringIntensity and put the ScatteringDistribution setting up near .9.
                        2) Keep the global fog density low, but increase it in certain areas with Volume particles.
                        I want to have very strong light shafts everywhere, just like with screen space light shafts, so I guess option 2 does not work.

                        I already spent hours just adjusting all the values, and I did use very low fog densities with very high VolumetricScatteringIntensity and all different kind of ScatteringDistributions, but I did not get any good result where I would see strong light shafts without everything being very fogged.

                        A ScatteringDistribution up near .9 also does not give strong light shafts, a setting of 0 works best there. I'm mostly interested in very strong light shafts when looking at them from the side. Similar to what I would get with placing fake lightshafts like in that blueprint demo:

                        This is with a VolumetricScatteringIntensity of 400 and a fog density of 0.01:


                        Light shafts are relatively visible, but the distance and the sky is washed out, its fogged.

                        That's with a VolumetricScatteringIntensity of 4000 and a fog density of 0.002:


                        It doesn't get any better with a higher VolumetricScatteringIntensity, increasing the VolumetricScatteringIntensity and decreasing the fog density always seems to give the exact same effect like before.

                        Image you would look at these screen space light shafts from the side, and they wouldn't disappear due to being screen space:
                         
                        Spoiler


                        That seems to be impossible with the new volumetric fog system.
                        Last edited by John Alcatraz; 04-26-2017, 07:17 PM.
                        Easy to use UMG Mini Map on the UE4 Marketplace.
                        Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

                        Comment


                        • #13
                          Hi DanielW, thanks for all your work on volumetric fog - it's awesome

                          Can you explain a bit more about how particle sprites trigger the fog field?

                          I.e. I've got a cloud alpha on my particles and it looks better than a flat white square but obviously the pattern itself is not visible in the fog (given its resolution).

                          Also, btw, distance fading in the particle shader works

                          Comment


                          • #14
                            Originally posted by John Alcatraz View Post
                            That seems to be impossible with the new volumetric fog system.
                            That's not realistic though, since there has to be particles for the light to bounce off from, it can't only be where the light is. You might want to check and make sure that the skylight doesn't have volumetric lighting turned on though.

                            Comment


                            • #15
                              Speaking of oddball testing of the new fog, turns out beam emitters work just fine with it

                              Click image for larger version

Name:	170427_124200_beamFog.jpg
Views:	1
Size:	41.3 KB
ID:	1126937

                              Having said that, I'm a total noob with particles, so everytime I fly close enough to it that its start or end point go off screen, the whole particle effect vanishes

                              Is there a way to say "Gaahhhh!!! Stay on!!! Stay on!!!"?

                              Comment

                              Working...
                              X