godotengine / godot

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

LightmapGI does not take transparency into account when baking shadows. #77590

Open EzraT opened 1 year ago

EzraT commented 1 year ago

Godot version

v4.0.3.stable - v4.3.dev3

System information

Godot v4.3.dev3 - Fedora Linux 39 (KDE Plasma) - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 580 Series (RADV POLARIS10) () - Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz (8 Threads)

Issue description

As the title says, LightmapGI bakes shadows for objects with transparent materials as if they are 100% opaque. I tried baking with every transparency mode possible, Alpha, Scissor, Hashed, Depth Prepass, none of it makes a difference. This worked fine in Godot 3, so there is definitely a bug here.

Godot 3: image

Godot 4: image

Steps to reproduce

  1. Download the included MRP's, both Godot 3 and Godot 4 versions are provided.
  2. Load up the projects and compare results.

Minimal reproduction project

mrps.zip

EzraT commented 11 months ago

Retested in v4.2.beta4.official, still present.

Calinou commented 8 months ago

I can still reproduce this on 4.3.dev cae759949 (Linux, GeForce RTX 4090 with NVIDIA 545.29.06):

image

passivestar commented 6 months ago

Encountered this too, 4.2.1, macOS 14.4.0 - Vulkan (Forward+) - Apple M1 Max

EzraT commented 2 months ago

It's honestly quite disappointing and disheartening to see a crucial feature, that every major 3D game engine needs to have, is still incomplete and missing vital functionality, especially in an engine with as much potential as Godot has.

Godot 4 is now in its third point release and LightmapGI is still incomplete, and will likely remain incomplete until 4.4, but even that isn't a certainty.

I get it, Godot is an open source project, and its contributors work on what they want to work on, when they can, I have nothing against that at all, I understand the nature of open source software projects, and I appreciate all the work people pour into it.

But I do think sometimes it's also important to look more objectively at what needs to be done and fixed to actually implement crucial features in a complete way. Godot has great features and insane potential, but the problems become apparent when you realize that some of those features lack functionality, (this issue is an example of that), or otherwise don't work together properly with other engine features. (Yes I know this is a Godot 3 issue, but this is a good example of the problem I'm trying to explain, this has been a long time thing.)

It's just disheartening to see this engine be so close to greatness, but at the same time always so far away from it because of crucial features that lack what they need to be considered complete enough solutions.

I don't want to put any pressure on anyone by voicing this, or point fingers at anyone, I get it, this is by and large how FOSS software development works, and that's okay.

I just wanted throw in my 2 cents on this and voice some of my concerns, sometimes it's important to point out the downsides of the way the development of this project currently functions.

AtlaStar commented 3 weeks ago

@EzraT thought you might be interested in this image Notice though how it only wants to bake the lightmap when it is a child of a meshinstance? Notice how it is a child of something other than the root of the imported .glb

Dunno if that was the behavior previously or not, but it gives some clues as to a possible solution if that isn't intended behavior, and a possible workaround for the time being.

EDIT: should be noted that changing the the way the .glb file for that scene imports and making the root node a meshinstance doesn't work, and it being a child node of anything besides the root causes the lightmap to bake properly

EDIT 2: Oh, should probably mention this was in v4.4.dev.custom_build

AtlaStar commented 3 weeks ago

Further evidence showing that it isn't just showing things correctly in editor, but baking things correctly as well image

I will continue to look into things, although as I have not really onboarded myself onto the engine code, it may be something someone else would be able to solve sooner.

EzraT commented 3 weeks ago

@AtlaStar

I might be missing or misunderstanding something here but, are you sure those shadows are actually baked and part of the actual lightmap? Because they don't look like it, they look like Godot 4's normal dynamic shadows to me.

AtlaStar commented 3 weeks ago

You are right, I lost this thread after I realized I was misinterpreting things and got sidetracked; they are the dynamic lights.

That said I believe that I saw a PR which would properly close this in the works/waiting for a few more things.

atirut-w commented 2 weeks ago

That said I believe that I saw a PR which would properly close this in the works/waiting for a few more things.

Indeed! #90109