godotengine / godot

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

GI Probe Broken when using procedural meshes #35200

Open DEF7 opened 4 years ago

DEF7 commented 4 years ago

Godot version: 3.2b5

OS/device including version: Windoze 10 / Ryzen 5 2600 / RX 5700 XT

Issue description: GI probe is not properly calculating lighting for surfaces from an omni-light source (perhaps others, I've only tested the OmniLight) and is dependent on the orientation of the GI probe. It appears that the GI probe is baking incorrectly, causing lighting to be calculated wrong for the GI volume.

brokengiprobe

Note that only half of the ceiling and the opposite half of the floor have light in the reflections of the sphere and capsule in this GIF as I move the light left/right: https://imgur.com/a/akCR71U

If I rotate the GI probe 45 degrees and re-bake then the issue occurs but at a 45-degree angle on the ceiling/floor, so it would appear to be specific to the GI probe baking. I'm surprised nobody has even noticed this because I first noticed it with beta 4 and just downloaded beta 5 to see if it was fixed yet.

The surfaces also appear to be depicting the incorrect GI probe lighting back onto themselves in tandem with the illumination from the OmniLight source, but this behavior seems normal - just not the lighting being gathered from the GI Probe itself.

Steps to reproduce: Create GLES3 project, make a room out of cube MeshInstances with basic SpatialMaterials for walls/ceiling to have unique albedo color, set the MeshInstances to be used in baked lighting, create sphere MeshInstance with full metalic and zero roughness SpatialMaterial, add OmniLight, create GI probe encompassing entire room and bake, observe wrong room lighting reflected in sphere.

Minimal reproduction project: Project is attached. Open the Spatial.tscn scene in the project and select the OmniLight, move it left/right and observe the incorrect ceiling/floor lighting reflecting in the sphere. BrokenGIProbeReflections.zip

DEF7 commented 4 years ago

This problem also exists in v3.1. I am thinking maybe it has something to do with the fact that the room was built out of cube meshes produced by Godot.

Calinou commented 4 years ago

@DEF7 I've always had issues with procedural meshes when baking GIProbe or BakedLightmap. I don't know how this can be fixed. Try creating the scene in Blender instead.

clayjohn commented 4 years ago

Looks like the issue has to do with the interaction between the omnilight and the GIProbe. Notice that the problem moves around as you move the light around.

edit: I've figured out what needs to change in order to fix this. Just need to make sure I'm not inadvertently breaking anything else

Screenshot (35)

DEF7 commented 4 years ago

Great!

wacyym commented 2 years ago

This problem appears only if ROTATION applied for meshes which "use in baked light". Examples: no rotation rotated

You can check it in this project: FixedGIProbeReflections.zip

1) Rotate "Room" mesh in Y axis by 90 degrees 2) Bake GI Probe 3) See weird result

DEF7 commented 2 years ago

This problem appears only if ROTATION applied for meshes which "use in baked light".

Good catch! Is this still happening in current builds?

wacyym commented 2 years ago

This problem appears only if ROTATION applied for meshes which "use in baked light".

Good catch! Is this still happening in current builds?

Yes, i use Godot_v3.5-stable_win64

Calinou commented 2 years ago

It might be worth checking whether this issue occurs in 4.0.alpha14 (with the exact same test scene).

wacyym commented 2 years ago

Its seems the issue occurs in 4.0.alpha14, but in some different situations. For some reason i will able to catch this only for room node (BLUE color), while room is rotated on Y axis by 90 degrees: G4_rot G4_norot

Ive tried to rotate other nodes (ceiling(red), floor(green), wall), but reflections seems ok, example - wall (white): wall wall_rotated

Tested on 4.0.alpha13-14, updated test scene (materials from 3.5 wont migrate to 4.0): GIProbe 4.zip

wacyym commented 2 years ago

Screenshots with debugging "Voxel GI Lighting": debug1 rotated and baked mesh "room" : debug2

Calinou commented 2 years ago

This could also be related to https://github.com/godotengine/godot/issues/62930 in master.