-
Notifications
You must be signed in to change notification settings - Fork 405
Release notes for decals #2085
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
Release notes for decals #2085
Changes from 6 commits
575e519
447600f
237859a
c76b59b
ec885a1
c12ce40
b7571c4
b7baa10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||
| **Decals** are textures which can be dynamically layered on top of existing meshes, conforming to their geometry. | ||||||
| This has two benefits over simply changing a mesh's texture: | ||||||
|
|
||||||
| 1. You can add them dynamically in response to player actions. Most famously, bullet holes in FPS games use decals for this. | ||||||
| 2. You don't need to create an entirely new texture for every combination, which makes them more efficient and flexible when creating levels with details like graffiti or cracks in building facades. | ||||||
|
|
||||||
| Like many things in rendering, there are a huge number of ways to implement this feature, each with their own tradeoffs. | ||||||
| In Bevy 0.16, we've selected two complementary approaches: **forward decals** and **clustered decals**. | ||||||
|
|
||||||
| TODO: add decal image. | ||||||
|
|
||||||
| Our implementation of forward decals (or to be more precise, contrast projective decals) was inspired by [Alexander Sannikovs talk on the rendering techniques of Path of Exile 2], and was upstreamed from the [`bevy_contact_projective_decals`] ecosystem crate. | ||||||
| Due to nature of this technique, looking at the decal from very steep angles will cause distortion. | ||||||
| This can be mitigated by creating textures that are bigger than the effect, giving the decal more space to stretch. | ||||||
| To create a forward decal, spawn a [`ForwardDecal`] object, which uses a [`ForwardDecalMaterial`] using the [`ForwardDecalMaterialExt`] material extension. | ||||||
alice-i-cecile marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Clustered decals (or decal projectors) work by projecting images from a 1x1x1 cube onto surfaces found in the +Z direction. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the +z direction part correct? I’m not certain how this feature works so don’t rely on my feedback without verifying. I was thinking that this is like a 2D image on the right-handed x-right, y-up, z-back cube’s z faces being projected through the cube along its z-axis and covering any surfaces along the path. I have a feeling that I also saw it project onto both front and back faces from the cube’s perspective. Here a picture would surely be a thousand words. :)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was taken from the existing docs :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like too much pointless technical info. Even I don't really care about cubes or +z direction. |
||||||
| They are clusterable objects, just like point lights and light probes, which means that decals are only evaluated for objects within the bounds of the projector, and they don't require a second rendering pass. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Kind of implies that forward decals do require a second rendering pass, which sorta isn't true. Small summary of how they work:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So forward decals results in the same fragment being shaded twice? In which case:
Suggested change
|
||||||
| To create a clustered decal, spawn a [`ClusteredDecal`] entity. | ||||||
|
|
||||||
| Ultimately, forward decals offer broader hardware and driver support, while clustered decals are higher quality and don't require the creation of bounding geometry, improving performance. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think forward decals are also a little easier to customize, since it's 99% just using the material API. Clustered decals can be customized, but are a little harder. There might also be other quality differences and situations where one or the other is better, but idk enough about decals to say.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah forward decals are basically transparent objects, so they won't work as well with TAA and such. |
||||||
| Currently, WebGL2, WebGPU, iOS and Mac only support forward decals, as clustered decals require bindless textures. | ||||||
|
|
||||||
| [Alexander Sannikovs talk on the rendering techniques of Path of Exile 2]: https://www.youtube.com/watch?v=TrHHTQqmAaM | ||||||
| [`bevy_contact_projective_decals`]: https://github.com/naasblod/bevy_contact_projective_decals | ||||||
| [`ForwardDecal`]: https://dev-docs.bevyengine.org/bevy/pbr/decal/struct.ForwardDecal.html | ||||||
| [`ForwardDecalMaterial`]: https://dev-docs.bevyengine.org/bevy/pbr/decal/type.ForwardDecalMaterial.html | ||||||
| [`ForwardDecalMaterialExt`]: https://dev-docs.bevyengine.org/bevy/pbr/decal/struct.ForwardDecalMaterialExt.html | ||||||
| [`ClusteredDecal`]: https://dev-docs.bevyengine.org/bevy/pbr/decal/clustered/struct.ClusteredDecal.html | ||||||
Uh oh!
There was an error while loading. Please reload this page.