google/filament

When I create more than 1000 Entities the frame latency increases, but the CPU/GPU are not fully loaded

Closed this issue · 5 comments

Is your feature request related to a problem? Please describe.
I use the model file filament\assets\models\torus. The strange color is because the material lacks the color parameter.
I think filament can run at least one of the cpu or gpu, but this is the running result. It seems that the cpu core is not fully loaded.
And the gpu uses 1%??

You will see a huge increase in skipframe because renderer->beginFrame(swapChain) returns false:
1
2
3

Describe the solution you'd like
I think filament can at least keep one of the cpu or gpu fully loaded.

Describe alternatives you've considered
When I use raw OpenGL API to render 10,000 such objects, I can run 25% GPU and 100% CPU.

OS and backend
NVIDIA GeForce GTX 1080
Windows 11 22H2 (1000.19041.1000.0)

FEngine (64 bits) created at 0000028B83AC8F80 (threading is enabled)
FEngine resolved backend: Vulkan
Vulkan device driver: NVIDIA 537.34
Selected physical device 'NVIDIA GeForce GTX 1080' from 1 physical devices. (vendor 0x10de, device 0x1b80, driver 0x86488000, api 1.3)
Backend feature level: 1
FEngine feature level: 1

Can you please share a repro case? Filament is multi threaded and vectorized for everything related to sorting and culling so you shouldn't see a lot of CPU usage necessarily.

I'm able to reproduce very similar behaviour with the GLTF viewer that ships with Filament.
When rendering lots of instances, especially of more complex geometry, resource utilisation (CPU/GPU) is quite poor, with frames however being actively skipped.
See this video:
https://github.com/google/filament/assets/37701550/79ec1604-52df-4938-bdf5-19baa8f07118

@Nolram12345 Your GPU is busy at 80%. I don't know how that's measured but if the scene is fragment shader limited that's what I would expect. The fact the CPU is at low usage is a good thing?

@Nolram12345 Your GPU is busy at 80%. I don't know how that's measured but if the scene is fragment shader limited that's what I would expect. The fact the CPU is at low usage is a good thing?

You may be right with fragment shader fillrate being a bottleneck, I'll profile that further.
I was kind of thinking that it may be a CPU bottleneck though since GPU occupany of the shader cores (labeled "3D" in task manager) varies so much between 60-80% - but I may be wrong on that assumption. I'll do some further testing.

Do you have any suggestions for test scenes that would allow me to check how well Filament is properly able to make use of given graphics & CPU capacity?