Nothing happens when spawning atmospheric fog at runtime

I’ve been creating a map editor with a wide variety of controls virtually everything is working as intended except the atmospheric fog. If I place it in the map before hand then any setting changes I make work fine, including hiding the fog. If I spawn the atmospheric fog at run time it doesn’t appear to have any affect and I don’t understand why. I’d like to be able to spawn the fog at run time in order to avoid having it there but hidden when its not needed on certain maps.

Hi there,

One thing different about the AtmosphericFog actor is it needs to run a “PreCompute” before it will be visible. When placed in a level it does this automatically (it happens on construction, before you hit play).

When you spawn it in, try calling “Set Precompute Params” using the default values and then call “Start Precompute”.

Without these 3 variables initialized, the sky will be black.

Here’s an example:

There will be a ~1 second hitch when you start a pre-compute, but this is unavoidable if you need an AtmosphericFog actor.

Hope that helps!

Ive added the precompute params and made it start precompute though there doesn’t seem to be any difference, I set the values to the default values when adding an atmosphere fog to a map and also set all the other variables that aren’t changed by the editor to their defaults (likely not needed at all but not knowing what is going wrong made me try everything I could think of) anything else i could be missing?

How are you calling those functions? Did you wrap the fog actor in a blueprint and call from the construction script and/or BeginPlay event? It will need to run the precompute after the actor is spawned and “in level” so construction script probably wont work. This might seem obvious but depending how you have it set up it could be running the precompute too early.

I would also recommend setting all of the other variables to default values erither manually or in a blueprint (these can be changed after precompute), as I had a similar issue where the defaults were not being used, forcing all variable values to 0 instead.

Also how are you controlling the spawning of this actor? Is this in a level blueprint or spawned by another actor?

I’m spawning the fog actor from the controllers begin play in the map editor I created (plan is to only spawn it if needed on saved maps), as soon as the actor is spawned I’m saving a reference to it and then setting all the variables after that I’m setting the precompute params and calling precompute.

I ran into the same issue in 4.15: I spawn an actor which has an atmospheric fog component. It remains black even after setting those parameters and calling the precalculation. I also tried it with a level blueprint spawning an atmospheric fog actor.

This is still an issue in 4.19. How is this slipping through the cracks?

The functions mentioned in the post, SetPrecomputeParams and StartPrecompute have their code wrapped with “#if WITH_EDITOR”

This means you can’t really generate the precompute data in a cooked build, which is perhaps why you are seeing a black atmosphere.

You probably want to create an atmospheric fog actor in the editor and hide it - then unhide it as needed…if you are looking to dynamically turn it off and on.

good luck,
0xf00d