Skip to content

Allow decals to only affect meshes on the same render layer #19607

Open
@chendaohan

Description

@chendaohan

What problem does this solve or what need does it fill?

Currently, decals in Bevy affect all meshes within their volume, with no way to control which meshes receive the projection. This can cause unwanted visual artifacts — for example, when the player walks near a wall with graffiti, blood, or bullet hole decals, those decals appear on the player's body as well.

There is no way to prevent this behavior in the current system. I tried separating the affected and unaffected meshes using different RenderLayers, but decals still affect all meshes inside their volume regardless of layer.

What solution would you like?

Ideally, decals should only affect meshes that share at least one RenderLayers bit with the decal itself. For example, a decal with RenderLayers::layer(1) should only project onto meshes that also have RenderLayers::layer(1). This would give developers precise control over which meshes can receive decals and help avoid unintended projection onto characters or other dynamic objects.

I’m not very familiar with Bevy’s rendering internals, so I’m not sure if this is feasible or if there's a better way to achieve the same effect. I’d greatly appreciate any guidance or discussion on how this kind of control might be supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-FeatureA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions