godotengine / godot

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

Incorrect GridMap behavior with baked shadows #46231

Closed SkanerSoft closed 3 years ago

SkanerSoft commented 3 years ago

Godot version: 3.2.4 RC 2

OS/device including version: Develop in Windows, Run in Android

Issue description: GridMap objects react to both lighting and baked shadows, creating image imbalance and difficulty adjusting shadows. Feels like they are baked and dynamically receive shade at the same time.

Steps to reproduce:

  1. Create a Project
  2. Import 3D models (or create MeshInstances)
  3. Create MeshLib from pack of models
  4. Create a scene with GridMap and regular objects
  5. Add DirectionalLight (or another)
  6. Add BackedLightmap node
  7. Backed Shadows
  8. Try to adjust the shadows for dynamic objects

My simple project

Full Scene Image 001

Settings for MeshLib objects Image 002

Settings for regular objects Image 003

My GridMap node Image 004

Settings DirectionalLight Image 005

Settings for BackedLightmap Image 006

GridMap behavior when setting lighting AFTER baking 2021-02-19-21-15-53

Minimal reproduction project: shadows_test.zip

Calinou commented 3 years ago

It looks like https://github.com/godotengine/godot/pull/41629 isn't applying to GridMaps?

cc @JFonS

SkanerSoft commented 3 years ago

Also, I noticed that when turning off Shadows to Directional Light, the GridMap objects start to flicker on my device. No errors or warnings, just flickering. When the shadows are turned on, the flickering disappears, but the GridMap objects become too dark where the shadow falls on them, as they receive it.

https://user-images.githubusercontent.com/13809475/108548058-5c40ae80-72fc-11eb-9d01-cef0190e370f.mp4

Calinou commented 3 years ago

Also, when you're using the All bake mode for a given light, you're kind of giving up on using shadows for dynamic objects. This is a difficult-to-solve problem that should be discussed in a proposal.

If you want to keep shadows for dynamic objects, a good compromise is to use the Indirect bake mode for your DirectionalLight and the All bake mode for everything else. This is similar to what games like CS:GO do. Alternatively, set up a blob shadow system for your dynamic objects so they can still feel "grounded" somehow.

SkanerSoft commented 3 years ago

Also, when you're using the All bake mode for a given light, you're kind of giving up on using shadows for dynamic objects @Calinou

Sorry, I meant shading objects, not just shadows) It's just that the GridMap becomes too light when the light source is turned on, since it is both baked and receives light. And if you turn off the shadows, then on my Android objects start to flicker. I attached the video above.

NHodgesVFX commented 3 years ago

Also, when you're using the All bake mode for a given light, you're kind of giving up on using shadows for dynamic objects. This is a difficult-to-solve problem that should be discussed in a proposal.

Isnt shadowmasking and distance shadowmasking the exact solution to this problem, granted it would need to be added to godot, So i guess that would make a good proposal.

Calinou commented 3 years ago

Isnt shadowmasking and distance shadowmasking the exact solution to this problem, granted it would need to be added to godot, So i guess that would make a good proposal.

It is, but I doubt it'll be implemented in Godot anytime soon given the added complexity.

Edit: See also https://github.com/godotengine/godot-proposals/issues/2354.

SkanerSoft commented 3 years ago

Still wrong in RC 3.

akien-mga commented 3 years ago

Fixed by #46590.