Skip to content
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

depth_bias is ignored on StandardMaterial #14169

Open
DiSaber opened this issue Jul 5, 2024 · 0 comments
Open

depth_bias is ignored on StandardMaterial #14169

DiSaber opened this issue Jul 5, 2024 · 0 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@DiSaber
Copy link

DiSaber commented Jul 5, 2024

Bevy version

0.14.0

Relevant system information

cargo 1.79.0 (ffa9cf99a 2024-06-03)
SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "AMD Ryzen 9 7950X 16-Core Processor", core_count: "16", memory: "31.6 GiB" }
AdapterInfo { name: "AMD Radeon RX 7900 XTX", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.5.1 (LLPC)", backend: Vulkan }

What you did

Spawned a small plane mesh with a transparent ring texture and a depth_bias of f32::INFINITY.

(
    PbrBundle {
        mesh: meshes.add(Plane3d::new(Vec3::Y, Vec2::splat(0.3))),
        material: materials.add(StandardMaterial {
            base_color_texture: Some(
                asset_cache.cache(asset_server.load("textures/ring.ktx2")), // NOTE: `asset_cache.cache` simply clones the strong handle into a vector and returns the original handle
            ),
            base_color: Srgba::WHITE.with_alpha(0.12549019).into(), // 32 alpha
            alpha_mode: AlphaMode::Blend,
            unlit: true,
            depth_bias: f32::INFINITY, // Render the ring above all other 3d objects
            ..Default::default()
        }),
        transform: Transform::from_translation(Vec3::new(
            0.0,
            -HALF_PLAYER_HEIGHT - GROUND_OFFSET, // Places the ring exactly on the surface level
            0.0,
        )),
        ..Default::default()
    },
    NotShadowCaster,
)

What went wrong

Z-fighting:
image

Additional information

This was previously functional on Bevy 0.13.2. As a "workaround" (probably how I should've done it from the beginning) I made a different camera on a higher render layer to render the ring on top of all other 3d meshes.

@DiSaber DiSaber added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 5, 2024
@DiSaber DiSaber changed the title depth_bias ignored on StandardMaterial depth_bias is ignored on StandardMaterial Jul 5, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

2 participants