Skip to content

Commit

Permalink
Add deconstructed deferred gbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed Nov 3, 2023
1 parent c419658 commit 9544851
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
Binary file added content/news/2023-10-21-bevy-0.12/base_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed content/news/2023-10-21-bevy-0.12/deferred_pass1.png
Binary file not shown.
Binary file added content/news/2023-10-21-bevy-0.12/depth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 20 additions & 9 deletions content/news/2023-10-21-bevy-0.12/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,34 @@ However, as Bevy has grown, it has slowly moved into "hybrid renderer" territory

In **Bevy 0.12** we added optional support for Deferred Rendering (building on the existing prepass work). Each material can choose whether it will go through the forward or deferred path, and this can be configured per-material-instance. Bevy also has a new [`DefaultOpaqueRendererMethod`] resource, which configures the global default. This is set to "forward" by default. The global default can be overridden per-material.

When deferred is enabled for the PBR [`StandardMaterial`], the deferred prepass packs PBR information into the Gbuffer, which looks like this:
Lets break down the components of this deferred render:

![pbr gbuffer](deferred_pass1.png)
![deferred](deferred.png)

The deferred prepass also produces a "deferred lighting pass ID" texture, which determines what lighting shader to run for the fragment:
When deferred is enabled for the PBR [`StandardMaterial`], the deferred prepass packs PBR information into the Gbuffer, which can be broken up into:

![lighting pass ID texture](deferred_pass2.png)
**Base Color**
![base color](base_color.png)

A depth texture is also produced:
**Depth**
![depth](depth.png)

![deferred depth](deferred_depth.png)
**Normals**
![normals](normals.png)

These are passed into the final deferred lighting shader. The final render looks like this:
**Perceptual Roughness**
![perceptual roughness](perceptual_roughness.png)

![deferred](deferred.png)
**Metallic**
![metallic](metallic.png)

The deferred prepass also produces a "deferred lighting pass ID" texture, which determines what lighting shader to run for the fragment:

![lighting pass ID texture](deferred_pass2.png)

These are passed into the final deferred lighting shader.

Note that the cube in front of the flight helmet model is using forward rendering, which is why it is black in both of the deferred lighting textures above. This illustrates that you can use both forward and deferred materials in the same scene!
Note that the cube in front of the flight helmet model and the ground plane are using forward rendering, which is why they are black in both of the deferred lighting textures above. This illustrates that you can use both forward and deferred materials in the same scene!

Note that for most use cases, we recommend using forward by default, unless a feature explicitly needs deferred or your rendering conditions benefit from deferred style. Forward has the fewest surprises and will work better on more devices.

Expand Down
Binary file added content/news/2023-10-21-bevy-0.12/metallic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/news/2023-10-21-bevy-0.12/normals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9544851

Please sign in to comment.