Download

Atmospheric fog intersecting world

My game takes place on the inside of a planet so my atmospheric fog ends up intersecting it at some point as the planet curves up rather than down.

Where it intersects I get a very nasty line that breaks the effect.
WtfIsThis.JPG

I really need the fog to help sell the scale of the world and make it look like its actually curving up and is spherical. Without it everything just looks flat.

Anyone have a way of fixing this? Is there some depth bias alpha type thing for fog?

Any help would be greatly appreciated.

Both atmospheric fog and exponential height fog assume your world is flat. The only way either of those might be useful in your use case is to raise their height to extend beyond the top of your spherical world, which should eliminate the intersection issues as those occur around the top. You will lose the density scaling by height though, so if you want to keep that you could:

  • Dive into the code of the fog system and implement your own spherical version
  • Implement the fog in your shader.

The first option might be a bit harder depending on how familiar you are with editing the source. The second option is easier, but would require you to add a material function with your custom fogging effect to every material in the game world.

I have no clue how I would go about editing the source files so that option is out. This is part of my day/night cylce and weather system so a lot of these values will change. Hopefully I wont have to change atmospheric fog. I’m still experimenting with the look of the game but if it doesn’t end up changing then I might have to just paint it into the world texture and have a material function for all objects placed along the horizon.

I did find a weird solution. If you set altitude scale to -100 the intersection pretty much disappears.
4711ee06005cc14c76087a163cea2fa0a638df50.jpeg

The issue is that altitude scale defaults to .1 when any other option is changed. I can only set it to -100 in the details panel. That just seems like its going to break at some point and revert back to having that very noticeable line.

Thank you for the suggestions.

As of 4.9 I cant seem to set the altitude scale to anything lower than .1 meaning I’m back to where I started.

Maybe make a sphere to put inside your sphere with a material for the fog? and add some depth fade (https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Depth/index.html) so there’s no visible sharp lines if it has to intersect something. Also migth want to add PixelDepth that can fade out the fog when you get closer.

Ive tried to fake it with a few tests but nothing gave me a nice effect. The issue is I was using “atmospheric sun light” on my directional light and that worked really well with the atmospheric fog. Doesn’t really work without it and since I have a dynamic day/night that takes place on the inside of a planet so the atmospheric effects are really important.

At worst I’ll have to deal with that ugly line. I’ll do some more tests and post the results later. Thanks for your suggestion.

Might be able to fake the direction of light using material parameter collections that you update using blueprints.