• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

[TIP] Creating realistic shadows and AO by rendering

Messages
24
Country
us-california
Hi all, I just wanted to share my technique for creating realistic shadows and AO. This is something I notice that many new developers either struggle with or don't do at all, which is a shame since this can really help make your textures go to the next level.

Intro
First, I want to explain AO, GI/Ray Tracing, and rendering in the context of the sim. If you are familiar with these terms, skip to the example below.
AO or Ambient Occlusion in general is a technique in rendering that adds occlusion (soft shadows) around places where 2 or more faces and their normals of a model are perpendicular and cross each other. See below.
1686581869006.png

Notice how normals closer to the intersection start to cross each other.

In X-Plane, MSFS, and DCS, AO is calculated through SSAO (Screen Space Ambient Occlusion) which is an efficient technique to approximate a realistic AO effect. Generally, SSAO has done pretty well, however, it is still only an approximation. This means that either an AO effect generated by the sim can be inaccurate, or its quality is reduced. There are other, newer methods such as HBAO and VXAO (Horizon Based Ambient Occlusion and Voxel Accelerated Ambient Occlusion) but these methods are not employed by any flight simulator as of yet.

In general rendering, SSAO is too inaccurate to be used. This is where GI (Global Illumination) and Ray Tracing come in. Ray Tracing works by shooting many "rays" of light out of a camera or viewpoint, and then calculating where each ray will bounce off an object as well as how much light will be dissipated from this bouncing. Much like in real life, photons of light reflect and bounce in many directions from a surface, just like the concept of Ray Tracing. Flight simulators currently do not have Ray Tracing as this method is very taxing on the GPU and CPU to compute, and even though there are many new games that do have Ray Tracing, these games tend to compute at reduced ray amounts compared to traditional rendering. There are other methods employed by renderers like Path Tracing and Photon Mapping, but these are not relevant to Flight Simulator. Global illumination is the overall process in computing indirect bounces of light and shadows, which uses Ray Tracing to do so. You can think of GI as the name of the technique, while RT is how GI is calculated.

So, what does this mean for FS? It means that we can employ a general renderer (such as V-Ray, Corona, Arnold, Eevee, etc) to do all the heavy lifting regarding Ray Tracing, GI and AO, then insert this information into your textures. Many computers today are unable to calculate these effects in real-time without severe performance loss, so calculating them beforehand will improve the quality of your textures without any performance hit.
NOTE: This method is generally more noticeable and effective for interior scenes only. Exterior scenes such as an exterior model of an aircraft, or a building will generally not benefit from this method, as the shadows required to calculate this scene is generally simple enough for your simulator's renderer to handle normally.

Example
In this example, I will be using 3ds Max, V-Ray, Substance Painter, and Photoshop. However, this process can also be done with alternative software, as the overall concept is still the same.
To start, I have a room with two poles and a window and have already UV mapped this model and is now ready for texturing.
1686582491830.png

In Max, make sure your renderer is set to V-Ray (Or V-Ray GPU if you wish to use the GPU) before rendering this map. Then, go to Rendering > Bake To Texture (For 2021+ only, if you are using Max 2020 or below, use Render To Texture instead).
Select your model and click "More Bake Elements" and under V-Ray, assign the VRayCompleteMap to it. Then, open your material editor, and make sure your object is colored grey. This will help you later on.
1686582676150.png
1686582772955.png


You now need to enable GI. This is done differently with different rendering engines, but in V-Ray it is in Render Setup > V-Ray > Environment > GI Environment. Other engines may require the use of a dome light, sky light, ambient light, or an environment map. I also recommend changing your image sampler from Progressive to Bucket if you are using V-Ray. Note that denoising is not available for baking textures as denoising relies on 3D perspectives to achieve.
Click "Bake" to start the baking process. Note that depending on the resolution of your texture, the complexity of your model, your computer's hardware, as well as your render settings, this can take a few minutes or a few hours. If you have a weak computer or you're calculating hundreds of textures, I suggest using a burner computer just for the purposes of rendering and let it render for a couple of days.

Once this map has completed rendering and saved, texture this model as you normally would in Substance, but disable AO baking.
1686583284141.png
1686583407728.png


Export your model in the desired format. Then, assign these texture sets to your material in your material editor. This is now what your model should look like WITHOUT the rendered GI/AO map.
1686585079360.png

Looks pretty flat right?

Next, we'll take a look into adding this map into Prepar3D, X-Plane, and MSFS.

FSX/Prepar3D Standard (NO PBR) / X-Plane PBR (NO AO CHANNEL)
Open your Diffuse/BaseColor map in Photoshop. Then, overlay your completed GI map over it as a separate layer. In the blending mode, switch it from "Normal" to "Multiply". Save your diffuse texture.
1686583898522.png


MSFS/Prepar3D (PBR)
Each simulator has it's own AO channel within their material.

For Prepar3D PBR, AO maps are stored within the Metallic map's GREEN channel.
For MSFS PBR, AO maps are stored within the COMP map's RED channel.

Open your Metallic/COMP map into photoshop, and then add your AO map as a separate layer. On the bottom right, click the fx button, and choose Blending Options.
Under "Advanced Blending", hide either the G and B channel or the R and B channel depending on what simulator you are targeting.
1686584809891.png

Save this map.

For P3D PBR specifically, I also recommend adding this map into your Diffuse texture. But it may or may not look correct, so this is up for experimentation.

That's it! You now have realistic shadows and AO baked into your textures. Take a look at this comparison.
1686585045990.png
1686585079360.png


Conclusion
This is a long process (especially the rendering part) but it is well worth it. It can really help make your interiors look so much more realistic with just (a few) clicks of a button. If you have any questions, ask them below.
 
Last edited:
I would also like to mention this: most rendering engines also have an "AO Map" render, but this is (in my opinion) all too flat to be useful.
1686585318305.png
1686585324477.png


Left is AO Map, right is AO + GI Map.
 
Good post Aaron...I might also add that in Substance, at least by default, an editable channel for AO (which is where this GI shadow map would be inserted) is not included, at least by default. You need to go into "Texture set settings" and click the little plus sign above the channels list, then click "ao" to add it. Then you can add your GI map to a layer that only contains information for this channel. Assuming the export profile is set up correctly, your _COMP texture will now contain the GI map.

P3D is a different animal than MSFS in the way that it handles PBR, so your suggestion about adding some GI to the diffuse definitely helps things "pop" is a good one. An overlay at 25-30% opacity is typically enough when combined with "proper" PBR shadow maps. You might even want to reduce the opacity on the PBR channel to 85-90% when combining it with diffuse (albedo) shading, otherwise things can get a little too "contrast-y". Of course the graphics engine in P3D is constantly being tweaked in each update, so this may not always be accurate.
 
Back
Top