godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.12k stars 20.2k forks source link

Vulkan swapchain and graphics queue error happening when light baking #89075

Open LightShade12 opened 6 months ago

LightShade12 commented 6 months ago

Tested versions

System information

Windows 10 - Godot.4.2.1.stable.- Forward Renderer- Nvidia Geforce GTX 1650 4GB

Issue description

When attempting light baking a custom mesh scene, increasing bake quality causes editor to stop refreshing visually, while mouse events are still processed underneath(resizing subwindow .etc) similar to https://github.com/godotengine/godot/issues/74700 . lowering rays_per_pass project property value allows to prevent this upto the high quality bake settings. Bake progress goes upto 14% before the console starts spamming errors and the editor doesn't refresh.

dev4: success: low quality/4 bounces failure: low quality/5 bounces (refer attached for console log) after modification(Set bake_performance/max_rays_per_pass=16(previously 32 by default)) success: low quality/6 bounces, medium quality/3 bounces, medium/6 bounces failure: high quality/3 bounces(refer attached for console log)

stable: success: low quality/4 bounces, medium quality/3 bounces failure: low quality/5 bounces (refer attached for console log), medium quality/6 bounces(see attached), high quality/3 bounces(see attached)

Attachments: stable: failure console log(low quality/5 bounces): image

failure console log(medium quality/6 bounces): image

failure console log(high quality/3 bounces): image

dev4: failure console log (low quality/ 5 bounces): image

after rays per pass modification:

failure console log (high quality/3 bounces): image Additional: Bake progress meter did not even show up. reducing max rays per pass to 8 or 2 did not change the outcome.

Steps to reproduce

Maybe specific to my environment, regardless: -Open the zip file. -Run project with console enabled -Set LightmapGI bake quality to high -Hit bake -Progress goes upto 14% before the console spams error -In case of High Quality Bake, the progress popup shows but the bake progress meter doesnt even show up

Minimal reproduction project (MRP)

bakeTest.zip

Felipe-Sena commented 6 months ago

I've also encountered this problem (was quite a headache as I was about to finish a project I needed to turn in the next day). I remember reading something about it running out of VRAM (and that's what I also saw when looking at task manager) but idk. I'll do some bake tests later to see if I can reproduce it.

LightShade12 commented 6 months ago

I've also encountered this problem (was quite a headache as I was about to finish a project I needed to turn in the next day). I remember reading something about it running out of VRAM (and that's what I also saw when looking at task manager) but idk. I'll do some bake tests later to see if I can reproduce it.

I was suspecting the same thing. Any ideas on how to reduce vram usage with lightmapping? I only see 3 properties under bake performance settings and only 2 of them are relevant to my case(rays per pass and rays per probe pass)

Edit: Texel size when importing also helps with vram usage during bake

Calinou commented 6 months ago

I can't reproduce this on 4.2.1, even with Ultra bake quality (Linux, GeForce RTX 4090 with NVIDIA 545.29.06). It seems to bake just fine if you have enough VRAM. Note that the sun in your scene is extremely bright; I've reverted its color to the default value for testing.

According to nvidia-smi, Godot needs 859 MB when running normally and 1621 MB while baking lightmaps in High quality. System VRAM usage goes from 2599 to 3378 MB.

We should look into printing a warning if the lightmap bake is going to require a lot of VRAM, and abort if it'll require more VRAM than is available on the graphics card at the time of starting the bake.

Any ideas on how to reduce vram usage with lightmapping?

Try increasing the Lightmap Texel Size property for 3D scenes in the Import dock. In 4.3 or later, you can also decrease the Texel Scale property in LightmapGI to globally multiply the lightmap texel size for all objects (lower Texel Scale values are less detailed).