Hey all, I am fairly new at unity and need some help
As the title says, I have a very large room in one of my scenes and this room needs fog so I can’t see the end of the room, I would like to know if you can put fog inside a cube (that I have made the size of the room).
The idea is that you can get lost in this room, once you reach a certain point away from the center you respawn back to the middle which will look seamless (imagine the staircase from mario 64 to bowsers lair), I want fog to make the room seem endless and gloomy
It would actually be a bit more involved than just that. Doing just that would simply result in the fog instantly popping up when you enter the room, which is exactly what you don’t want.
What you’ll want to do is to adjust the level layout to accommodate visibility of the room, in order to enable the fog without a jarring snap. For example:
The two entry corridors are kinked in order that when you’re positioned in the grey area, you can see neither into the fog room, nor outside. This is where you’d enable the fog via trigger. For best results, the GREEN trigger will disable fog, while the RED trigger will enable it.
This ensures that whether you’re entering the fog room exiting to the outside, you don’t see the fog suddenly and jarringly appear/disappear.
there are only two ways to really approach it: particles or writting an own volume fog type shader through some scattering or scattering alike algorithm.
aside of naturally using a trigger and use a position based “raise of regular fog” approach to scale it from 0 to what you want over the course of entering. But that requires some correspondingly designed corridor when entering it
Isn’t that the infamous S corridor, designed to hide loading, allow portals, and others ? I didn’t think about it at the first time, but it is nicer than what I wrote.
thanks for the help so far, I am trying to learn this stuff in uni for my course so I have to understand how to write this stuff too, i learn a but then i get dumb and forget it… How would i write this in a c# script?
I actually worked on Fog and Bloom triggers with a programmer for Medal of Honor.
We (or the graphics programmer I should say) found the best way was to set up a null or dummy box near the door that the environment artist could place, and he could set the size of the box which would fade the distance on his/her end.
On the programming side? Set the null box or sphere as the trigger, and check the bounding distance for in/out fade based upon the size of the box. (also,in/out for on/off of the fog or bloom).
I set up tons of these in doorways and tunnels, but still they needed to be edited differently based upon the environment.
I just tested this for another project - maybe you can fade in the fog when entering the rom - as in below - then it will not just pop up
function fadeFog(){
RenderSettings.fog = true;
for(var i : int = 0;i<100;i++){
var density : float = 0.01 * i;
RenderSettings.fogDensity = density;
yield new WaitForSeconds(0.1); //Debug.Log(density);
}
}