Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/bevy_pbr/src/decal/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ pub type ForwardDecalMaterial<B: Material> = ExtendedMaterial<B, ForwardDecalMat
/// the forward decal code behind an ifdef.
#[derive(Asset, AsBindGroup, TypePath, Clone, Debug)]
pub struct ForwardDecalMaterialExt {
/// Controls how far away a surface must be before the decal will stop blending with it, and instead render as opaque.
/// Controls the distance threshold for decal blending with surfaces.
///
/// Decreasing this value will cause the decal to blend only to surfaces closer to it.
/// This parameter determines how far away a surface can be before the decal no longer blends
/// with it and instead renders with full opacity.
///
/// Lower values cause the decal to only blend with close surfaces, while higher values allow
/// blending with more distant surfaces.
///
/// Units are in meters.
#[uniform(200)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/decal/forward_decal.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn get_forward_decal_info(in: VertexOutput) -> ForwardDecalInformation {
let uv = in.uv + delta_uv;

let world_position = vec4(in.world_position.xyz + V * diff_depth_abs, in.world_position.w);
let alpha = saturate(1.0 - normal_depth * depth_fade_factor);
let alpha = saturate(1.0 - (normal_depth / max(depth_fade_factor, 0.001)));

return ForwardDecalInformation(world_position, uv, alpha);
}