Clearly Through the Fog

If you have tried using Fog in your Environments you have likely been frustrated with the fact that the visible environment appears crystal clear through the fog instead of being properly obscured by the fog. This problem pretty much rules out getting any believable results when a visible environment is used.

One of my Bentley colleagues Bob Bossler mentioned to me that he was trying to place a transparent object and then the environment was starting to appear foggy. It then dawned on me that this was the ticket to getting realistic fog environments by quite simply making a special material that is 100% transparent and that is only visible to the eye. So this material would not be seen but it would work as a “fog catcher”, what the heck we already have the “shadow catcher” so this fits right into the magic materials category.

Here’s how it works, you need to place a big sphere around your model with its center on the camera.  You can use a primitive sphere to quickly add this to your scene. The magic part is in the material that gets applied to our big sphere.

How to make the Fog Catcher material, create a new material and give it a name you will remember something like Fog Catcher well at least that is what I am calling my magic material.

Looking at the General Tab while in Advanced Mode of the Material Editor, if you don’t know  or are wondering how to change to Advanced Mode we have two modes for the Material Editor Default and Advanced.

In my opinion the default mode is lacking too much but if you want simple and mostly use the material that we deliver I guess it is okay. To me the new guys might not know how to switch to the advanced mode so they are stuck right off the bat….maybe we need a survey as to whether or not the default simpleton editor is worth keeping around but that is another day’s blog. 

If you are not already in the Advanced Mode you can make the switch by clicking on the Settings drop down options.

Here are the settings we want to make on the General Tab.

Turn off Cast Shadows, and make Diffuse, Specular and Reflect Zero as can be seen in the previous capture.

On Transparency tab make Opacity Zero.

On the Expert Tab make the following changes:

Set Direct Illumination Multiplier, Indirect Illumination Multiplier and Indirect Illumination Saturation to zero. Set Back Face Culling to Force Double Sided on (you need this because the primitive sphere normals are pointing the wrong way when you are inside the solid.) In the toggles section, turn off all but Visible to Eye.
For my test case I am using the Building Concept model that is in the Photorealistic Rendering.dgn example file that ships with MicroStation. I added a few extra trees to better see the fog effect. I placed a large Smart Solid sphere primitive in the scene such that the sphere is exactly centered on the camera’s Eye Point.

I created a new Fog Catcher level to place my fog catcher sphere on so that I can toggle the level on or off to render before and after images. You can see my sphere is surrounding my scene in the following captures.

You can draw the big sphere by entering the Eye Pt from the Define Camera tool’s Camera Position information. In my case these are -25.6, -60.4, 24.3.

Notice how the camera is centered at the sphere’s center. If you move the camera to a new location you will need to move the shadow catcher sphere. If you stick to just panning or changing the lens angle as long as you don’t move the eye point location you can use the fog catcher for multiple renderings.

 

I used a smart solid primitive sphere and placed it using the coordinates from the Camera Position in Define Materials and just used AccuDraw to finish the placement.

As you can see in the camera view I am clearly inside the big red sphere. The next step is to attach or assign the new fog catcher material.
Now for a couple of before and after test renders, I will turn off the fog catcher level and render a before image first.  Using the Sky Cylinder Environment

You can see in the above capture of the Environment Settings dialog that I have enabled Fog for the Sky cylinder and I have set the Fog Type to Linear. I have set the Fog Start distance to zero and the Fog End distance to 275 Meters. The Fog Color I used is 184, 181, 160 and Fog Brightness is 7.8.

TIP: In SELECTseries 3 you can use Fast Preview to make near real-time adjustments in Fog Settings in the Luxology Render dialog.


 
Without Fog Catcher


 
With Fog Catcher

Looking at the rendered images the rendering without the fog catcher does not look realistic and the distant trees appear much foggier than the sky beyond.  On the other hand the rendering that uses the fog catcher sphere and the magic fog catcher material looks clearly (pun intended) better.

I am sure our Luxology friends will get this fixed in the future but in the meantime this method works today. If you want to render an animation just attach the fog catcher sphere to the animation camera and you should be good to go.

Happy Rendering

Jerry Flynn

 

 

 

 

Anonymous