Fog with Octane Render for Cinema 4D
Knock-knock motherfuckers! Winter is here! That’s right, and you know what comes with it – that sexy fog! I’ve received quite a few emails, regarding the atmospheric effects in some of my renders. With this article, we’ll try to make some sense of the “Medium” parameters in the “Environment” tag and hopefully end up with something good looking.
Note, some of the information needed to complete this article was either difficult to find or simply non-existent. With that in mind, crying about physical or scientific accuracy will be treated like “meh”. Just saying.
So what is fog? The most common answer would be “a low-lying cloud” and that would be correct. Fog begins to form when water vapor condenses into tiny liquid droplets, suspended in the air. As far as Octane is concerned, this “low-lying cloud” is nothing but a “Medium” that can absorb and/or scatter light. Let’s take a look at the example we got here.
It’s a very simple setup – a plane, several trees and an HDR image, that lights the scene. Probably one of the most important things with fog is distance. You need an open area. This terrain is 250 x 250 meters, which is more than enough. The parameters, we are interested in, live under the “Environment” tag. Note, the mode of the tag needs to be “Primary Environment”.
Oh look, an “Add Fog” button! Sounds convenient. Let’s see, maybe that’s all we need.
Well, that wasn’t really useful, was it? “Add Fog” is a preset anyway, we don’t want presets. Why? Because we want to build things ourselves, understand how things work. So “Undo” and manually load the “Scattering Medium” node in the respective “Medium” field.
Okay, we have a clean start. Still renders pitch black though. Let’s dive inside the “Medium” and explore why.
“Scattering Medium” is nothing new so no fuss there. What’s interesting though is the meaning of its parameters in the context of atmospheric fog.
“Absorption” controls how fast light is absorbed by the “Medium” (.. by the fog field). A Value of 0 means no absorption. Photons will enter and exit the “Medium” without loosing energy. The image will not change. A value of 1 will give us the strongest absorption. There will be no light rays passing trough and the “Medium” will render black.
Taking a step to the side here. With that definition of absorption, we should be able to explain the black render. “But wait, there is nothing loaded in “Absorption”, how come it affects things?” That’s a good question. One would assume that an empty slot means 0, no absorption. Hmm, maybe it really is 0 but the “Invert” checkbox bellow is turning it into a 1. Sounds logical. Let’s tick it off and render again.
Oh, come on! This makes no sense. Seems like there is a hard-coded value (probably 0.5 or 50% gray color) which is in play when the slot is left empty. So even if we “Invert” that, we still end up in the same place. Why was this necessary? ¯\_(ツ)_/¯
“But even if there was a hard-coded value, like 0.5, we would see at least some of the trees, right?” Yes. This is where “Density” joins the party, acting as a multiplier for the rest of the parameters. Its default value of 100 is multiplied by whatever the “Absorption”, “Scattering” and “Emission” channels are set to. This explains why we still get pure black in the live viewer.
Okay, enough of this nonsense. Load a float, set it to 0. Make sure “Invert” stays disabled. It’s easier like that, especially when working with float values.
That’s all the business we had with “Absorption” really. It needs to be off so that photons can safely pass through. Hopefully it’s all good now. Rendering..
Now to the fun part – “Scattering”. Again – whatever value you enter here is going to be multiplied (scaled) by the “Density” above. Now, you can approach this in two different ways – lock “Scattering” and play with “Density” only or vice versa. Either way, you end up in the same place. Personally I like the first option. What does it mean to “lock” a parameter? Means to define a constant value that won’t change anymore. So let’s just set “Scattering” to 0.1. That’d be all here.
From that point on “Density” is our main control and that is great! Clearly, the default 100 makes the fog way too dense. We can’t see shit! Take it down until the foreground is somewhat clear. Don’t worry about the background not being foggy yet. Just get the trees in front of you nice and visible. Most of the time 0.1 works really well.
If things went as planned, you should see a slightly foggy version of our forest.
Now, if you dragged that slider down manually (instead of just typing in 0.1) you probably noticed something interesting. There is no value in that range which gives us the image we are after. Well, the truth is there was, we just weren’t able to see it. Why? Well, this is the “interesting” part. Fog, as we already know, lives in a “Medium”. What we haven’t mentioned though is that a “Medium” has size and can be scaled. Ideally, it should match (or be very close) to the bounding box dimensions of the Word we’ve built. So, do we know the size of the “Medium”? Yes, we do. Step out of the “Scattering” node and check the number next to “Thickness”.
It should default to 10. I can imagine this stands for 10 meters. Hope it does, it would make so much sense. To refresh your memory – our terrain is 250 meters wide/deep. So, it’s 10 vs 250 meters. Well, these do not match at all, do they? I can be even more dramatic – the range of values used by the “Medium” is just 4% of the information delivered by the “Scattering” node. Let’s just set the “Thickness” to 250 and render again.
Finally! There you have it – clear foreground vs foggy background. Furthermore, we’ve narrowed the control down to a single parameter – “Density”. Play with it to bring the fog closer or further away from the camera. Pure joy! “Thickness” now works similarly to an “Opacity” parameter – it just makes everything more or less see-through. Additionally, it functions as a scaling mechanism for the whole “Medium”. Most of the time, however, all we need is “Density”!
Leaving you with two more renders – low vs high “Density”. Talk again Internet! 🙂