-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deferred Renderer #9258
Merged
Merged
Deferred Renderer #9258
Changes from 128 commits
Commits
Show all changes
159 commits
Select commit
Hold shift + click to select a range
dcf8017
Move texture sample out of branch
DGriffin91 9e406c7
use tonemapping in array_texture example
DGriffin91 c2209a6
Revert "use tonemapping in array_texture example"
DGriffin91 f2dbfdc
init deferred
DGriffin91 52a38eb
remove temp file
DGriffin91 ea6ce6b
add dither and tonemap in shader
DGriffin91 b6f06b0
get forward and prepass without deferred working again
DGriffin91 5f1d8fc
get shadows working
DGriffin91 30c8ed8
use rgb9e5 for emissive
DGriffin91 764205f
make deferred and forward work together
DGriffin91 90d97aa
reuse mesh_view_layout_entries
DGriffin91 5390866
add stencil reference for selecting deferred lighting pass
DGriffin91 1ce6ad2
don't fill pixel data for depth/stencil fallback
DGriffin91 0d37110
make deferred lighting stencil reference configurable
DGriffin91 b497801
consolidate depth format and fallback
DGriffin91 1a8f03b
more deferred feature parity
DGriffin91 0acbfe8
add specific deferred flags
DGriffin91 6449316
move render method extract plugin and normalize normals
DGriffin91 5cd1ec8
relocate deferred files
DGriffin91 08303b7
include normals in deferred gbuffer
DGriffin91 ec28a8b
encode base color as srgb, setup test in forward pbr
DGriffin91 79807e2
make webgl work
DGriffin91 76a4a7e
pack gbuffer differently for webgl
DGriffin91 84c2913
tweak normals rounding
DGriffin91 3623945
use DEFAULT_PBR_DEFERRED_LIGHTING_STENCIL_REFERENCE for material default
DGriffin91 a6ad3b3
move prepass vertex and fragment io into separate file
DGriffin91 0822760
handle unlit
DGriffin91 5793290
always use full material input
DGriffin91 dfa166c
simplify pbr_input_from_deferred_gbuffer, add parallax to example
DGriffin91 f16d48f
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 37d7fad
merge deferred with forward pbr frag shader
DGriffin91 31963b5
Merge remote-tracking branch 'origin/main' into deferred
DGriffin91 5994fdd
add ui to example
DGriffin91 d18d316
don't use bevy_internal path
DGriffin91 7dcc731
fix taa depth texture
DGriffin91 42c6f1e
Merge remote-tracking branch 'origin/main' into deferred
DGriffin91 5d5cd67
fix deferred/motion vector prepass order
DGriffin91 476f483
put deferred lighting pass after main pass start but before opaque pass
DGriffin91 67a3967
use vec4 for out.normal
DGriffin91 b616599
make a way to BypassPBRDeferredLightingPlugin
DGriffin91 e3d5e59
make deferred light pass use the layout it defines instead of from me…
DGriffin91 dc67cde
use DeferredLightingBindGroup instead of MeshViewBindGroup
DGriffin91 91e00d2
use pub const for deferred lighting node name
DGriffin91 790af5c
add motion vector output from deferred pbr
DGriffin91 0c4088c
prefix wgsl transformation names to avoid collision
DGriffin91 b7f5f0d
missed one
DGriffin91 87a14d3
move pbr input to pbr types for better accessibility
DGriffin91 cd3e0de
fix alpha discard
DGriffin91 0c18601
use standard rgb9e5 bit order, update octa encode/decode
DGriffin91 2c6de16
Merge commit 'bb59509d44d2979e4b91bd0f998c047f16b89dd0' into deferred
DGriffin91 f42607d
merge up to bb59509
DGriffin91 901a3c9
Merge commit '0f4d16aa3ce9a7937d253313b6f821c6eeb09c10' into deferred
DGriffin91 87a6a30
merge up to 0f4d16a
DGriffin91 4d2f7eb
fix ssao
DGriffin91 cd3e2bb
Merge commit '10f5c9206847ae01b8dc833c2680562e7bd46664' into deferred
DGriffin91 41761ff
merge in new naga oil stuff
DGriffin91 ef0e49f
Merge commit '8ba9571eedada4f3ff43cdf1402670b7fe7c280d' into deferred
DGriffin91 05c09d5
update to bevy 0.11
DGriffin91 aa31d9e
Merge remote-tracking branch 'origin/main' into deferred
DGriffin91 052ab30
mesh_view_bindings todos
DGriffin91 937c733
fix sign issue
DGriffin91 3be1ff9
Merge remote-tracking branch 'origin' into deferred
DGriffin91 2ab66f2
misc docs/wording tweaks
DGriffin91 bedd5ab
rename PBRDeferredLightingPlugin
DGriffin91 b73cefa
get ssao working with deferred
DGriffin91 6afb442
include prepass in ssao node edges
DGriffin91 2e37811
don't use depth format with stencil for shadows
DGriffin91 689f44b
fix webgl
DGriffin91 eb580ee
Merge remote-tracking branch 'origin' into deferred
DGriffin91 9c4496f
use MeshViewBindGroup in deferred lighting pass
DGriffin91 9d9b8d0
nits
DGriffin91 33252aa
bypass directly in PBRDeferredLightingPlugin
DGriffin91 a472635
don't include Deferred when set to Forward+Prepass in example
DGriffin91 03b1a4c
try to make ci happy
DGriffin91 ab2126f
try harder to make ci happy
DGriffin91 0057d9a
use frag_coord.z from PbrInput directly for depth
DGriffin91 03781c9
copy over rgb9e5 improvements
DGriffin91 31f6a66
don't set view_formats unnecessarily
DGriffin91 89b37e4
add docs for deferred prepass tex
DGriffin91 be9d2cd
rename PbrDeferredLightingPlugin
DGriffin91 b0d0f7f
add docs for DeferredPrepass
DGriffin91 c91a4f6
separate out depth stencil state into func
DGriffin91 7ff66d4
improve material props deferred naming
DGriffin91 e30a352
nits
DGriffin91 2871b1a
use Color::BLACK instead manually setting color
DGriffin91 c5a299b
When deferred is used with msaa, disable and warn instead of panic
DGriffin91 7070e06
add PbrDeferredLightingPlugin in PbrPlugin
DGriffin91 192090b
make core3d depth format configurable at runtime
DGriffin91 c16911d
manually define extractBits for webgl
DGriffin91 9963c44
Merge remote-tracking branch 'origin' into deferred
DGriffin91 41c043b
add per_object_binding_dynamic_offset to prepass
DGriffin91 121ce50
add WEBGL shaderdef to MeshPipeline
DGriffin91 40a4fb2
use None for BlendState instead of REPLACE
DGriffin91 6ca0b40
make ci happier
DGriffin91 4143efb
don't use builtin extractBits, it's also not working on dx12
DGriffin91 f7321dd
don't setup DepthStencilState when not using stencil
DGriffin91 45eb48e
add taa fix from 9462
DGriffin91 0513e2a
make DeferredLightingNode pub
DGriffin91 d813d56
nits
DGriffin91 ff2683d
Merge commit 'e8b38925174cea58c08877a7b410443dafe918ce' into deferred
DGriffin91 89317ab
Merge commit '4f1d9a63152589d5286647e68cc3ce0e67f1838c' into deferred
DGriffin91 dcf9101
remove per_object_binding_dynamic_offset
DGriffin91 34781d2
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 44e9295
optionally query for deferred render phases
DGriffin91 43f273a
maybe make ci happy
DGriffin91 1b52d20
initial switch from stencil compare to depth
DGriffin91 7a78054
get dx12 working
DGriffin91 b79182d
Make lighting pass id configurable again.
DGriffin91 3316654
add clarifying comments regarding unorm conversion
DGriffin91 4038c37
more comments
DGriffin91 c03ef23
fix webgl2 deferred clearing issue
DGriffin91 665492f
centralize mesh_view_bindings
DGriffin91 adfffea
nits
DGriffin91 76e5790
ci
DGriffin91 f33b874
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 562fec9
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 ec14655
update for assetsv2
DGriffin91 3e89aff
Update examples/3d/deferred_rendering.rs
DGriffin91 8d0e319
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 c475fa2
update phase items with batch & offset
DGriffin91 362af7a
imagine not checking for warnings before pushing
DGriffin91 83c6bb2
nits
DGriffin91 dab7ff5
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 e9022bd
update to include SHADOW_FILTER_METHOD
DGriffin91 f284433
use LIGHTING_DEPTH_ID directly in default
DGriffin91 5347950
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 7856085
oh god the lifetimes why
DGriffin91 fc8dca2
nits
DGriffin91 02c60fb
use optimized octahedral encode/decode
DGriffin91 d7fbc69
use get_instance_index
DGriffin91 231a650
clean up imports
DGriffin91 73b639d
update node names
DGriffin91 0968b9f
only use out inside DEFERRED_PREPASS
DGriffin91 942211c
add auto to OpaqueRendererMethod
DGriffin91 a7ce0b1
clarify create_texture_with_data
DGriffin91 67f2846
misc consistent naming
DGriffin91 cc2586b
remove unused shadow pass key
DGriffin91 f38bc1d
use TextureFormat::bevy_default()
DGriffin91 7599c3c
keep attachment count consistent
DGriffin91 f925875
reuse DrawPrepass draw command
DGriffin91 a58d7d2
remove redundant shader defs
DGriffin91 b58f33e
make ci happy
DGriffin91 33e542a
pretend I don't know about running ci locally
DGriffin91 9e4d37f
use octahedral funcs from bevy_pbr::utils
DGriffin91 df32a99
make auto render method unreachable for prepared material
DGriffin91 3eecd42
typo
DGriffin91 28d6750
improve docs
DGriffin91 865eb1f
MOTION_VECTOR_PREPASS_OR_DEFERRED_PREPASS
DGriffin91 5e84bbd
add END_PRE_PASSES sync point
DGriffin91 f7b4d89
rename to END_PREPASSES
DGriffin91 47cd785
Apply all material flags in both lit and unlit cases
DGriffin91 7168a57
don't use bevy_internal in examples
DGriffin91 1c983e2
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 96fb4c8
fix typo
DGriffin91 beed2ff
make wgpu 0.17 happy
DGriffin91 5049944
Assign surface props, even when unlit
DGriffin91 b2fcfad
put vertex colors in the prepass
DGriffin91 3194fe9
make id tex size always match prepass textures
DGriffin91 c80be7d
Merge remote-tracking branch 'upstream/main' into deferred
DGriffin91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
crates/bevy_core_pipeline/src/deferred/copy_deferred_lighting_id.wgsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#import bevy_pbr::utils | ||
#import bevy_core_pipeline::fullscreen_vertex_shader FullscreenVertexOutput | ||
|
||
@group(0) @binding(0) | ||
var material_id_texture: texture_2d<u32>; | ||
|
||
struct FragmentOutput { | ||
@builtin(frag_depth) frag_depth: f32, | ||
|
||
} | ||
|
||
@fragment | ||
fn fragment(in: FullscreenVertexOutput) -> FragmentOutput { | ||
var out: FragmentOutput; | ||
// Depth is stored as unorm, so we are dividing the u8 by 255.0 here. | ||
out.frag_depth = f32(textureLoad(material_id_texture, vec2<i32>(in.position.xy), 0).x) / 255.0; | ||
return out; | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems a bit tenuous. if the deferred_prepass has run, we assume that the deferred lighting pass has run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assume if the user put the
DeferredPrepass
component on the camera that some deferred lighting pass has run.Maybe there needs to be a more complex configuration so multiple user defined deferred lighting passes have a way of easily having only the first one clear. Especially since they could be defined in separate 3rd party plugins. And then clear in the forward pass if no deferred lighting pass ran.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there’s some way of propagating it through the render attachments? But then the nodes would have to modify the render attachment structs and maybe that breaks node parallelism. Unless RwLock. Right now we’re using proxy information to decide whether a render attachment has been cleared or not instead of just checking the render attachment to see if it has been cleared and if not, clearing it and marking it as cleared. Make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think that should be done in this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do have a precedent for that with the postprocessing a/b textures. fine to do a separate pr though.