Advertisement

How many render passes do you have in your projects?

Started by July 24, 2018 10:50 PM
5 comments, last by ChuckNovice 6 years, 6 months ago

Hey folks, I am developing two video game projects at the moment and I am developing my own game engine at the same time. The engine grows with my game projects and more and more features are ready to use. For a very long time, I only had a single render pass of my 3D scenes: I rendered all visible models using a PBR or Blinn-Phong-Shader - depending on the model's material - and it looked nice.

In order to improve Galactic Crew, I wanted to add shadows and improved laser effects. After doing some research, I implemented a Shadow Mapping algorithm to add shadows. This resulted in two additional render passes. Now, I have this sequence, if the shadows are activated in the settings:

  1. Render scene from the point of view of the main light source to create a Depth Map.
  2. Render scene from the point of view to create a Light Map (using the Depth Map from 1.).
  3. Render scene and apply shadows using Light Map from step 2.

I did some optimizations with your help and it worked like a charm in all scenarios (space, planets and dungeons). Then, I wanted to improve my laser beam effects. I added moving laser clutter to make it look more dynamic in combat situations and I added a Glow effect to make it look smoother. However, I had to add three render passes for the Glow effect: Create a Glow Map, blur Glow Map and add Glow Map to final scene resulting in this sequence:

  1. Render scene from the point of view of the main light source to create a Depth Map.
  2. Render scene from the point of view to create a Light Map (using the Depth Map from 1.).
  3. Render all laser beams from the camera's point of view into a Glow Map.
  4. Blur Glow Map using a bi-directional filter and increase brightness of the laser beam's inner areas.
  5. Render scene and apply shadows using Light Map from step 2.
  6. Use an orthogonal plane to add Glow Map to rendered scene from step 5.

So, if the shadows are activated and the player is in combat, I have six render passes instead of just one. I want to add planetary missions with water worlds and island this winter that will add even more render passes for water reflection, etc.

How many render passes do you guys use in your game project?

Hey GC! Many, many more. Bigger games use even more. For example, pulled out of my finger:

  1. Z-PrePass
  2. One per each dynamic shadow-casting light
  3. Several for the directional lights (Sun, Moon, ...)
  4. G-Buffer pass
  5. Screen-space ambient occlusion
  6. Transparent surfaces
  7. Countless complicated post-process passes:
    1. Light + shadow application
    2. Water
    3. Anti-aliasing
    4. Depth of field
    5. Motion blur
    6. Fog, volumetrics...
    7. Global illumination
    8. Reflections...
    9. Glows
    10. Vignette
    11. Edge-detection / highlight
  8. Rear-view mirror
  9. GUI

Easily 10-20. Each might contain several sub-passes. Depends a lot (deferred? forward? ...).

So I'd say you're safe if you're within your performance budget.

 

Advertisement

I was a bit worried about the Glow effects, because I thought my FPS rate might go down. After some optimizations, it is almost free, which is amazing. When looking at your list, I assume where I will end up in the end. ?

If you're interested in details of what commercial games do, http://www.adriancourreges.com/blog/ has some interesting breakdowns of how frames are put together in various games.

Thank you, Adam_42, but I am interested in what you guys/girls are doing! I know about commercial engines and how they use render passes and different shader types for all type of works.

10 hours ago, GalacticCrew said:

I was a bit worried about the Glow effects, because I thought my FPS rate might go down. After some optimizations, it is almost free, which is amazing. When looking at your list, I assume where I will end up in the end. ?

Hello, from what I understand you use that "glow map" specifically for your bloom effect. This pass can actually be mixed to the normal process instead of spending bandwidth on writing a whole screen of pixel to another buffer.

 

In my project my scene color buffer is HDR (R16G16B16A16), I'm pretty sure you already have that if you're going PBR. It is basically the resulting scene color after lights / shadows have been calculated.

Let's take that one as example : 37_dist_before.jpg

 

To later perform the bloom effect, I downsample that HDR map by keeping only pixel that have a luminance above a certain threshold and the rest is discarded. That threshold work the same way as the one you see in common engine's bloom effect (UE4/Unity).

So we end up with a result that could look like this :

34_bright.png

 

The downsampled map is blurred :

35_bloom.jpg

 

And finally merged back to the scene at the beginning of my post-processing stack.

So basically the same map is used until we start working with the downsampled version instead of outputting to two different buffer at full resolution when we already have the information in the original one. You can render your lasers on the same map as the rest of your scene doing this as long as you give them enough luminance to be grabbed by the bloom's threshold.

This topic is closed to new replies.

Advertisement