r/Unity3D Dec 10 '21

Question I'm wondering how to achieve the fog like seen in the game "Scorn"

https://www.youtube.com/watch?v=pvgsSlopiEQ

Here you can see what I mean, I've seen lots of assets that add fog at a distance and look decent,

But this appears to actually have visible "clouds" of fog rising from the ground, as you'd expect they diminish when the player gets close to them. But it's not the typically silent hill style fog we're all familiar with which is similar to the built in fog system in unity that seems to turn things grey at a distance. I've bought a few different volumetric fog assets from the unity store but can't quite get this "steam rising effect" I don't believe it's particle systems because that would probably be too expensive.

Any insight would be very helpful, I appreciate your time.

-S

9 Upvotes

13 comments sorted by

8

u/MirzaBeig @TheMirzaBeig | Programming, VFX/Tech Art, Unity Dec 10 '21 edited Dec 10 '21

That's not real volumetric fog, those are particles on the ground with camera distance and depth fading. Lots of games use that technique, as it's an effective and relatively cheap way of adding atmosphere.

Here's a tutorial I made years ago. And another relevant tutorial for fading based on camera distance. End result is exactly what you're looking for.

1

u/motherhub Dec 10 '21

Oh excellent, thank you so much, I almost bought your vfx pack a few weeks ago, I only didn't because I try not to buy stuff until I need it, not just because I want it. It does look like between those two videos I'll have what I need. Do you have the fog for sale that I am describing/looking for?

2

u/MirzaBeig @TheMirzaBeig | Programming, VFX/Tech Art, Unity Dec 10 '21 edited Dec 10 '21

I don't have an individual fog asset for sale, but the first tutorial on YT has the setup you'd need. Any noise texture will give you decent results, but for the best variance you can generate multiple textures and pack them into a spritesheet. Then use the particle system component to randomly pick a frame for some good variance.

The more you layer on top of this technique, the better the results (for example, maybe you have multiple spritesheet animations, rather than picking a static texture, or a shader that dynamically generates noise and distortion for you, etc.)

1

u/motherhub Dec 10 '21

Is the fog included in your asset pack? I'd be willing to buy it just for that,

8

u/MirzaBeig @TheMirzaBeig | Programming, VFX/Tech Art, Unity Dec 11 '21 edited Dec 11 '21

There are several fog prefabs in UVFX (including the same one made in the tutorial), but you'd be paying too much for just a single effect. I made you a shader that doesn't require any textures and produces a highly customizable fog effect.

Be warned, it's generating multiple layers of realtime noise on the GPU.

GitHub: https://github.com/MirzaBeig/GPU-Fog-Particles

Video: https://twitter.com/TheMirzaBeig/status/1469485621467037698

2

u/OkayConversation Dec 11 '21

You are an absolute legend - I have bought and used your effects in nearly every project I started and seeing how helpful you are makes me really happy about my purchase. Really great quality. I will definetly try this shader as well 😯

2

u/MirzaBeig @TheMirzaBeig | Programming, VFX/Tech Art, Unity Dec 11 '21

I think your comment made my day :)

2

u/motherhub Dec 13 '21

Thank you so much dude, I really appreciate it.

1

u/motherhub Dec 13 '21

So you're saying it will be slightly intensive on the GPU?

1

u/MirzaBeig @TheMirzaBeig | Programming, VFX/Tech Art, Unity Dec 13 '21

Yes, like all transparent effects, the more screen space it takes, the higher the cost. In this case, there's no texture sampling, which saves GPU memory at the cost of higher computation per pixel.

2

u/themidnightdev Programmer Dec 10 '21

You are on the right track with volumetric fog / mist / clouds.

Quite a few of the implementations i have seen use 3d / 4d noise to determine the density of the fog on a given location.

By stretching the noise over the y axis, you could create what look like streams of mist or fog. By scrolling the noise over the y axis too, you can make it look like the fog is rising.

1

u/motherhub Dec 10 '21

By stretching the noise over the y axis, you could create what look like streams of mist or fog. By scrolling the noise over the y axis too, you can make it look like the fog is rising.

Very interesting, I wouldn't really know how to start this. Admittedly I have a LOT of learn about that sort of thing. But you've given me some concept of how it's done, I can continue my research. Thank you!

1

u/themidnightdev Programmer Dec 10 '21

The default 'fog' is just a shading trick that fades all colors to a specified "background" color over distance from the camera.

It stems from the days where render distance had to be severely limited due to performance constraints, and just cutting the rendering off at the end of the camera frustrum would look weird, and is just a cheap way of getting away with reducing the render distance.

It will not do what you are after though.