Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Getting a Density Volume (fog) to look right

Discussion in 'High Definition Render Pipeline' started by dgoyette, Oct 18, 2019.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    I'm trying to achieve an object that kinds of feels like a "force field". It's a volume you can enter, such that when you're inside it, it will feel like the inside has some substance to it. I thought that I would use a Density Volume for this. The basic idea works, but there are some issues with it.

    First, it seems that unless I shine a light source on the volume, it always renders pure black, even if I've set the Density Volume to some color. Other than putting a light inside, is there a way to render these volumes with a color other than pure black? Adding lights could be complicated, give that the volumes could be of arbitrary size, and I'd potentially need to add a lot of lights.

    upload_2019-10-18_16-31-4.png

    The other issue is whether the fog can have some other texture to it other than a solid color. I've tried adding a texture to the "Density Mask Texture", hoping it would do something, but I can't see any impact of doing this.

    Any ideas here? Or is there perhaps a better way to make a "volume" that feels like there's some stuff in it?
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    I'm probably thinking too retro (as usual) but couldn't you first think about the visuals of the effect, maybe make effects with some particles or VFX Graph to make it look cool, then you could utilize all sorts of emissive materials and everything you need, without adding lights.

    Then use a Volume to fade in all the effects like color correction and so on. And equally well you could fade out, scale particles and whatnot for the effects based on the distance to avoid too much overdraw and so on.

    Just one idea but I've created that kind of effects and I think they worked fine + look good (very subjective.)
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,193
    Well, I've gotten a little closer on this. With respect to the Density Volume being black, I've placed a Spotlight inside it, and set the shape of the light to "Box". I've also changed the light's Light Layer to a different layer to prevent that light from shining on any objects in the scene. The result is more what I was hoping for:

    upload_2019-10-19_12-4-27.png

    As for having a more interesting texture on the fog using the Density Mask Texture, I was just not following the instruction properly. That required starting with a texture set to Alpha8, and the Alpha Source to grayscale. And the Texture Slice Size needs to be set to 32. Upon doing that, the generated Texture3D worked properly:

    upload_2019-10-19_12-6-17.png

    This ends up being a bit subtle, but it does add some texture to the fog. And the main benefit, for me, is that the texture can move, so it gives a sense of motion to the volume.

    upload_2019-10-19_12-13-55.png

    Anyway, this is getting me closer. I'll probably add some particles/VFX within the volume as well, and call it a day. I haven't dug into the VFX Graph yet, so I'm sure that will be a messy experience for a while.