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

Rendering Stutter/Ghosting on Vulkan Renderer #13742

Closed
igorlp opened this issue Jun 8, 2024 · 2 comments
Closed

Rendering Stutter/Ghosting on Vulkan Renderer #13742

igorlp opened this issue Jun 8, 2024 · 2 comments
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-Rendering Drawing game state to the screen A-Transform Translations, rotations and scales C-Bug An unexpected or incorrect behavior C-Machine-Specific This bug is isolated to specific hardware or driver configurations O-Vulkan Specific to the Vulkan render API O-Windows Specific to the Windows desktop operating system

Comments

@igorlp
Copy link

igorlp commented Jun 8, 2024

Bevy 0.13.2

System information

`SystemInfo { os: "Windows 11 Home", kernel: "22635", cpu: "AMD Ryzen 7 5800X3D 8-Core Processor", core_count: "8", memory: "31.9 GiB" }`
`AdapterInfo { name: "NVIDIA GeForce RTX 4060 Ti", vendor: 4318, device: 10243, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "552.44", backend: Vulkan }`

What you did

  • Spawned a mesh.
  • When W/A/S/D is pressed, a transform.translation will occur on the mesh based on input.
  • transform.translation is affected by time.delta_seconds()

Here is a snippet of the movement code:

fn handle_movement(
    mut query: Query<(&mut Velocity, &mut Transform, &Acceleration)>,
    time: Res<Time>,
) {
    for (mut velocity, mut transform, acceleration) in query.iter_mut() {
        velocity.x = (velocity.x + acceleration.x)
            .min(velocity.max)
            .max(velocity.max * -1.);
        velocity.y = (velocity.y + acceleration.y)
            .min(velocity.max)
            .max(velocity.max * -1.);

        velocity.x *= 1. / (1. + (time.delta_seconds() * 25.));
        velocity.y *= 1. / (1. + (time.delta_seconds() * 25.));

        transform.translation.x += velocity.x * time.delta_seconds();
        transform.translation.y += velocity.y * time.delta_seconds();
    }
}

What went wrong

When Wgpu backend is set to Backends::VULKAN, there is significant jittering and ghosting around the mesh as it's translated. This does not occur when the Wgpu backend is set to Backends::DX12.

Additional information

  • Have attached two videos that show the difference between the two backends. There's no change in the code other than the Wgpu backend setting
  • Example repo can be found here. Change the backend on setup.rs.

DX12: https://github.com/bevyengine/bevy/assets/12466943/9df4e660-b27d-4abe-ba5d-7675385d6dab
VULKAN: https://github.com/bevyengine/bevy/assets/12466943/b76bb36f-9127-4bec-a4df-2972a8b915d5

@igorlp igorlp added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 8, 2024
@NthTensor NthTensor added A-Rendering Drawing game state to the screen A-Input Player input via keyboard, mouse, gamepad, and more O-Windows Specific to the Windows desktop operating system A-Transform Translations, rotations and scales O-Vulkan Specific to the Vulkan render API O-DX12 Specific to the DX12 render API C-Machine-Specific This bug is isolated to specific hardware or driver configurations and removed S-Needs-Triage This issue needs to be labelled labels Jun 8, 2024
@alice-i-cecile alice-i-cecile removed the O-DX12 Specific to the DX12 render API label Jun 8, 2024
@alice-i-cecile
Copy link
Member

I expect this is a bug upstream in wgpu. Two questions:

  1. Can you reproduce this on Wgpu 0.20 #13186?
  2. Can you reproduce this in wgpu?

@igorlp
Copy link
Author

igorlp commented Jun 8, 2024

Looks like it works fine on #13186 for both Backends::DX12 and Backends::VULKAN, so seems like it will be fixed once wgpu is updated in Bevy

@igorlp igorlp closed this as completed Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-Rendering Drawing game state to the screen A-Transform Translations, rotations and scales C-Bug An unexpected or incorrect behavior C-Machine-Specific This bug is isolated to specific hardware or driver configurations O-Vulkan Specific to the Vulkan render API O-Windows Specific to the Windows desktop operating system
Projects
None yet
Development

No branches or pull requests

3 participants