bevyengine / bevyengine/bevy

Poor performance rendering points

Open
#18,792 7 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Performance S-Needs-Guidance
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.15.0

## Relevant system information

- Machine: laptop XPS 13 9310
- OS: Ubuntu 24.04.2 LTS

```ignore
`AdapterInfo { name: "Intel(R) Iris(R) Xe Graphics (TGL GT2)", vendor: 32902, device: 39497, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 25.0~git2504031308.ff386e~oibaf~n (git-ff386eb 2025-04-03 noble-oibaf-ppa)", backend: Vulkan }`
```

## What you did

- I am drawing around 300 meshes, each containing between 1 and 200k points, for a total of 4e6 points.
- Each mesh only contain vertex positions, no indices, no normals, with `PrimitiveTopology::PointList`.
- All the meshes are using the same `StandardMaterial` and have the `NotShadowCaster` component:
```rs
StandardMaterial {
base_color: Color::WHITE,
unlit: true,
depth_bias: 0.0,
alpha_mode: AlphaMode::Opaque,
fog_enabled: false,
..Default::default()
}
```
- Adding the `NotShadowCaster` component was necessary to prevent the shadow passes on the meshes, even though the material is `unlit`.
- I also tried with a very minimal custom shader, without much improvements.
- I also disabled the vsync with `bevy::window::PresentMode::Immediate`.

## What went wrong

- The GPU Render 3D engine is used at 100%, while the CPU and RAM are barely used.
- The FPS is low: 15 to 20.
- Adding more points slow the app even more, until complete freeze of the app and my displays.

## Additional information

- A single draw call for 100k points is listed in `RenderDoc` with a duration of 1ms.
- The `main_opaque_pass_3d` is listed in `RenderDoc` with a duration of 25ms for 4e6 points, over 287 `vkCmdDraw`.
- The `main_opaque_pass_3d`, and the duration of the draw calls, seems to be the bottleneck.
- There is not much difference between the dev and release builds.
- I noticed in `tracy` and `RenderDoc` that the app still spend some time related to lighting, shadows and fog, but this may be negligible.
- I cannot merge all the points in the same mesh, because the application needs to remove and add batches of points.

|RenderDoc|Tracy Frame|Tracy Stats|
|-|-|-|
|![Image](https://github.com/user-attachments/assets/6f44c21e-a915-425c-abe5-bf109559246a)|![Image](https://github.com/user-attachments/assets/28f86d8c-7309-4766-a45e-5f9c3aec7ee7)|![Image](https://github.com/user-attachments/assets/f414b622-4992-4bd3-a62e-77ee3f0aeeed)|

Considering the amount of points, the framerate seems quite low, the duration of the opaque rendering pass seems excessive. We have another application (not using bevy) that is able to display over 1e8 points without trouble on the same machine.

- Do you have any tips to improve the speed of my application?
- Or to help me debug the problem?
- Do you think drawing triangles instead of points could help?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.