Is it possible to put fog filter in just a certain area of scene? (not whole scene)

Hi friends.
There is a question for me.when you add fog filter post processor to view port it cause the whole scene get the fog. How can I insert fog in just a certain area like a small jungle beside the city. so that the city itself has no fog. If there is any way to add fog to a certain node not the whole view port?

I see two (simple) options for this,

either modify the jungle#s materials so the fragment shader include fogging.
or try to use a fog particle effect in the jungle if you can spare the additional vertices

The complex solution would need to somehow pass the fogfilter where you want the fog, and then modify it’s shader accordingly.

You mean this two method?

The absolute easiest way is to stop using post-process fog (lots of problems in general anyway) and hack fog into the fragment shader. The sky is the limit at that point to what flexibility you want. Simplest is to do fog by material but it could be done by location or even per vertex if you want to use up a vertex attribute slot.

An easy option that a surprisingly lot of AAA games do is have a large bounding box covering the area you want fog in and when the player moves into that area slowly update the fog color or distance smoothly. It works really great when you are moving around in a house (for example a horror game) and the dev wants the fog to increase inside a certain room. Of course, if you want the player to be able to see fog inside the jungle when the player is outside the jungle, it wont do that. But if you tweak the setting sjust right and design you world in just the right way it can be very convincing.

1 Like

Yes I think it is a good approach. so you mean I put a geometry box which is not visible and has no material and texture around my jungle. and when player get inside this box i add fog post processor filter to my view port and when he get out I deactivate it. Am I right?

I guess for that you dont need an box at all, just use an point and calculate the distance from the point…

Yes it seams more wise. of coarse i will do it.

Dont forget to slowly change the values. If you do it in one frame it will be jarring.