Discrete a Frame from a simple Unity 3D scene
DDiissccrreettee aa FFrraammee ffrroomm aa ssiimmppllee UUnniittyy 33DD sscceennee

Discrete a Frame from a simple Unity 3D scene

Scene

A floor, two opaque boxes, one transparent box, a skybox and a directional light.

Frame Capture Tool

RenderDoc v1.27.

Scene Overview

Draw Actions Overview

Total API calls to composite such a scene in Unity 3D. It consists two depth-only passes and a color pass.

Depth-only Pass #1

Texture Inputs/Outputs

Texture Inputs/Outputs – Draw floor

Texture Inputs/Outputs – Draw opaque box 1

Texture Inputs/Outputs – Draw opaque box 2

Depth-only Pass #2

Texture Inputs/Outputs – Prepare for the shadow map texture

Texture Inputs/Outputs – Draw Shadowmap – floor

Texture Inputs/Outputs – Draw Shadowmap – opaque box 1

Texture Inputs/Outputs – Draw Shadowmap – opaque box 2

Texture Inputs/Outputs – Draw Shadowmap – floor

Texture Inputs/Outputs – Draw Shadowmap – opaque box 1

Texture Inputs/Outputs – Draw Shadowmap – opaque box 2

Texture Inputs/Outputs – Draw Shadowmap – floor

Texture Inputs/Outputs – Draw Shadowmap – opaque box 1

Texture Inputs/Outputs – Draw Shadowmap – opaque box 2

Texture Inputs/Outputs – Draw Shadowmap – floor

Texture Inputs/Outputs – Prepare for the Screen Space Shadowmap

Texture Inputs/Outputs – Draw Screen Space Shadowmap

Color Pass #1 (1 Targets + 1 Depth)

Texture Inputs/Outputs – Prepare for a temp Framebuffer

Texture Inputs/Outputs – Draw temp Framebuffer (Floor + Screen Space Shadow Map)

Texture Inputs/Outputs – Draw temp Framebuffer (opaque box 1 – right one)

Texture Inputs/Outputs – Draw temp Framebuffer (opaque box 2 – left one)

Texture Inputs/Outputs – Draw temp Framebuffer (Skybox)

Texture Inputs/Outputs – Draw temp Framebuffer (Box – middle transparent one)

Texture Inputs/Outputs – Blit frame data from the temp buffer to the default frame backbuffer

Texture Inputs/Outputs – Swap buffer to make frame data ready for display

Texture List

Full list of textures used in this scene

Summary

In order to draw such a simple scene, we need to do the following actions:

  • Depth-only pass #1
    • Draw camera depth texture – floor
    • Draw camera depth texture – opaque box 1
    • Draw camera depth texture – opaque box 2
  • Depth-only pass #2
    • Draw shadow map – floor
    • Draw shadow map – opaque box 1
    • Draw shadow map – opaque box 2
    • Draw shadow map – floor
    • Draw shadow map – opaque box 1
    • Draw shadow map – opaque box 2
    • Draw shadow map – floor
    • Draw shadow map – opaque box 1
    • Draw shadow map – opaque box 2
    • Draw shadow map – floor
    • Draw shadow map – opaque box 1
    • Draw shadow map – opaque box 2
    • Draw Screen Space Shadowmap
  • Color (Shading) pass
    • Draw floor
    • Draw opaque box 1
    • Draw opaque box 2
    • Draw skybox
    • Draw transparent box
  • Swap buffers

This is a forward rendering path, for deferred path, the sequence may vary. In the second depth pass, there are 4 copies of the draw shadow blocks, that is not an error, that’s due to cascaded shadow map settings, in my default settings, it is “Four Cascades”, so they are drawn 4 times. The available setting options are 0, 2 and 4.

Check out the graphics tires specification here: https://docs.unity3d.com/Manual/graphics-tiers.html

Check out the shadow cascades here: https://docs.unity3d.com/Manual/shadow-cascades.html