godotengine / godot

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

Unpredictable VoxelGI lighting with interior scenes #80123

Open xana43 opened 1 year ago

xana43 commented 1 year ago

Godot version

4.1.1 stable

System information

Godot v4.1.1.stable - Windows 11 - Vulkan (Forward+) - dedicated AMD Radeon RX 7900 XT (Advanced Micro Devices, Inc.; 31.0.21001.45002) - AMD Ryzen 9 7950X 16-Core Processor (32 Threads)

Issue description

I'm working on an interior scene, and one thing i've been having a ton of issues with is light bleeding using Voxel GI

image

based on a lot of searching around on both the github repos and the forums a lot of people said in order for this to work properly the scene needs to be enclosed in a box so it's easier to control how it bakes image

however that doesn't seem to work either. I've looked over the documentation multiple times to see if I was missing something, and the only thing I can think of is that the walls that are meant to block the light are too thin, even though when I modeled them I made them as thick as possible while making sure that the playable area is unobstructed (the walls and floors are about 1-2 meters thick)

I am unsure if i'm doing something wrong or if it's an issue with the lighting system. Based on the documentation i'm lead to believe it's a bug.

here's my voxel GI lighting settings image

Steps to reproduce

create an interior scene with a directional light 3D and use that as the only light present for the voxelGI

Minimal reproduction project

Lighting minimal preproduction.zip

EDIT: added a minimal reproduction project

Calinou commented 1 year ago

@xana43 Please upload a minimal reproduction project to make this easier to troubleshoot.

PS: Your outer walls appear to be inward-facing. This is not what you should do. Instead, you need to make your room's walls thicker, rather than adding thin walls outside with flipped faces.

xana43 commented 1 year ago

Lighting minimal preproduction - thicker walls.zip

I've even made one with thicker walls, and it still appears to do the same thing

Calinou commented 1 year ago

I've tested the MRP locally, and I can see the mesh has various design issues which need to be fixed in Blender. This is why VoxelGI light leaks happen, even if you set the number of subdivisions to 512 and bake again.

Despite its materials using the Back cull mode (which is what you want), you can still go inside the roof and be able to see the roof's faces (which shouldn't happen if the house was a solid, manifold mesh).

This is one of the downsides of using Blender for level design: it's a powerful tool, but it's easy to end up with incorrect geometry that will behave poorly in game engines (and it won't warn you when doing so!). Even for experienced 3D modellers, this is a recurring problem.

TrenchBroom + Qodot or CyclopsLevelBuilder make it much harder to end up with poor results in game engines, as it was designed for game level design first and foremost.

Roof

image

Walls

https://github.com/godotengine/godot/assets/180032/3f08dab4-3790-478e-8efc-1bc426f7eb35

See the top-down overdraw view, which shouldn't have any "doubled" walls if the mesh is designed to be manifold:

Screenshot_20230803_031339

xana43 commented 1 year ago

Ok, I'll get to work on fixing up the mesh to work properly and will see if that works.

EDIT: so I seem to have made the mesh manifold as I don't see the walls being doubled up in the overdraw view However the lighting situation has appeared to stay the same

Lighting minimal reproduction.zip

Masonface commented 11 months ago

I'm running into the same issue.
Godot Version Godot v4.2 Dev 6

System Information: Windows 10 Home - Vulkan (Forward+) - dedicated Nvidia RTX 3090TI (31.0.15.3742) - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

I used all the default VoxelGI node default values, except for the volume dimensions, which I made fit tightly around the test buildings.

I've uploaded my own minimal reproduction with two Blender models (one as a .blend file, the other exported as a glTF2.0 file, both are manifolds) and one example that is built with the Cyclops plugin, and all three test buildings unfortunately have significant light leaking, even with very thick (1 meter) walls. Increasing the voxel subdivisions doesn't help much.

I've tried everything that I've read in the documents to try to fix it, but I just can't seem to prevent the light leaks, which is a bummer because other than this one problem it looks so much better than the SDFGI, in my opinion.

image

I'm more than willing to try any other suggestions, but I just can't help but feel like the light leaks are a bug.

VoxelGIDemo_Minimal.zip

Masonface commented 10 months ago

Would it be appropriate to add this issue to [TRACKER] Vulkan VoxelGI issues #55328?

As an aside, I want to give props to whoever has been involved with this VoxelGI implementation. It looks great overall and it has huge potential. Outstanding work.

Masonface commented 10 months ago

I don't know if this is at all relevant to this implementation of voxel cone tracing, but I found this bit of info in and old article:

For each voxel we have to store some basic information about its material properties like albedo, normal, emission etc., which we do for each of the six face directions of our box (+x,-x,+y,-y,+z,-z). We can then inject light into the volume, on any voxels that are on the surface, and trace cones a number of times to get our bounce lighting, again storing this information for each of the six directions in another voxel cascade texture.

The six directions I mentioned are important as our voxels are then anisotropic, and without that, light that bounces on one side of a thin wall for example, would leak through to the other side, which is something that we really don't want.

Full article link here: https://www.gamedeveloper.com/programming/graphics-deep-dive-cascaded-voxel-cone-tracing-in-i-the-tomorrow-children-i-

Calinou commented 10 months ago

VoxelGI anisotropy was attempted back in late 2019 in the early Vulkan renderer rewrite, but it was dropped as it was too expensive.

You can already choose whether 4 or 6 traces are performed for VoxelGI in the project settings (VoxelGI quality).

Arazalera commented 10 months ago

Got a similar issue, and tested it by building an enclosed box

With SDFGI, it works as it should with the inside of the box being black

With VoxelGI it is just as bright as it would be without global illumination, the box is properly enclosed as shown by SDFGI, and the walls are much thicker than voxels, even with Interior on

It might be not an issue with the scene but an issue with VoxelGI, as it appears to be simply ignoring walls

reduz commented 8 months ago

Just as a note, VoxelGI leaks a lot of light and its not possible to fix this, even with anisotropy (which is quite expensive). The idea is to eventually improve the new HDDAGI and add dynamic object support to it, so you no longer need to use VoxelGI in most cases.

WickedInsignia commented 6 months ago

Just as a note, VoxelGI leaks a lot of light and its not possible to fix this, even with anisotropy (which is quite expensive). The idea is to eventually improve the new HDDAGI and add dynamic object support to it, so you no longer need to use VoxelGI in most cases.

Is there any possibility to at least fix existing bugs with VoxelGI? It makes for more predictable results in my tests. I hope HDDAGI gets where we all want it to be, but a "stable" live GI (without cascade switching and slope artefacts) would be a shame to lose.

Since the reflection jitter was fixed by #86316 , the only remaining major issue I've found is #84746. Also regarding the leaks: VoxelGI lets light travel through airtight meshes. The outer walls will be voxelized, but the interior is left completely hollow. I've managed to reduce leaks by using black boxes inside of large meshes:

No internal light blocker: VoxelGI_NoBlocker

With internal light blocker: VoxelGI_Blocker

If airtight meshes were filled with black voxels automatically it would help to resolve the leaking considerably. I've also managed to reduce leaks around corners by setting Normal Bias to 0.9 at no real quality loss.