Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Lighting Issues in 4.2 Beta using Compatibility Mode #83528

Closed
chrisl8 opened this issue Oct 17, 2023 · 8 comments · Fixed by #83906
Closed

Strange Lighting Issues in 4.2 Beta using Compatibility Mode #83528

chrisl8 opened this issue Oct 17, 2023 · 8 comments · Fixed by #83906

Comments

@chrisl8
Copy link
Contributor

chrisl8 commented Oct 17, 2023

Godot version

v4.2.beta3.official [e8d57af]

System information

Godot v4.2.beta3 - Windows 10.0.22621 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3080 Ti (NVIDIA; 31.0.15.4584) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

Strange lighting issues only in Compatibility Mode on 4.2 Beta.
Notice the strange box on the upper left corner and the triangles on the walls.
SideBySide

This is just using an Omni Light with only these settings changed:
OmniLightSettings

These issues do NOT show up in ANY mode in 4.1, and do not show up in Mobile or Forward+ modes in 4.2 Beta.

4.2 Compatibility, strange lighting issues:
CompatibilityMode-4 2

4.1 Compatibility, no issues:
CompatibilityMode-4 1

4.2 Forward+, no issues:
ForwardPlusMode-4 2

4.2 Mobile, no issues:
MobileMode-4 2

It seems like some enhancement of the Compatibility mode has resulted in worse behavior, but I'm not sure how to obtain the working 4.1 Compatibility behavior in 4.2, or how to obtain the Forward+ or Mobile behavior.

This is mainly annoying because the Compatibility results are also what I see when doing an HTML5 export, which looks fine in 4.1, but looks bad in 4.2.

Steps to reproduce

Use Compatibility mode or export any mode to HTML5 in 4.2 Beta and use an Omni or Directional Light with possibly complex imported meshes.

I have included a demo project below.

Minimal reproduction project

This file includes two projects, one in 4.1 and one in 4.2, but they are identical. The 4.2 project was an upgrade from the 4.1 project. I included them both though so that it is easy to open both at the same time.

LightingIssueProjects.zip

EDIT: Just to be entirely clear, here are the lighting issues I am referring to:
CompatibilityMode-4 2-MarkedUp

I realize these may be artifacts of settings or bad meshes, but since it doesn't happen in any mode in 4.1 or in any other mode in 4.2, it seems like a regression.

Update: FYI: Same issue in Beta 3, in case it matters.

Update: I've built a minimum example of the mesh that demonstrates the issue:
Screenshot 2023-10-24 102508

It appears to be related to how the "light" bounces off of those 45 degree angled bits on the edges of the block. If I remove both of them, the odd box in the upper left corner goes away.
This also works fine in 4.1 and fine in 4.2 Forward+ or Mobile rendering, so it is still some issue with 4.2 Beta's Compatibility renderer.

It is interesting that these odd results happen even if the light isn't aimed at the surface where they occur!

Here is the project that the screenshot above is from. I used a directional light instead of omni, as that appears to disable the "global" light. I also added a camera.
minimum-example.zip

@Calinou
Copy link
Member

Calinou commented Oct 17, 2023

You can disable shadow rendering to get similar rendering to 4.1. 4.1 did not support shadows when using the Compatibility rendering method, while 4.2 does.

Can you reproduce this if you remove the .godot folder in the project while the editor is closed, then open the 4.2 editor?

@chrisl8
Copy link
Contributor Author

chrisl8 commented Oct 17, 2023

You can disable shadow rendering to get similar rendering to 4.1. 4.1 did not support shadows when using the Compatibility rendering method, while 4.2 does.

Can you point me to that setting? I dug around a lot but didn't find one that works.

Can you reproduce this if you remove the .godot folder in the project while the editor is closed, then open the 4.2 editor?

Yes, deleting the .godot folder does not help, it still produces these results. Even just building up the project from scratch in 4.2 with that .glb file produces the same results in 4.2 Compatibility mode.

@clayjohn
Copy link
Member

There are two likely culprits

  1. Shadows (as Calinou pointed out). Shadows are enabled/disabled in your light source under the "shadow" section of the Light's inspector
  2. Mesh compression. To test if the issue is caused by mesh compression, click on the glb in the asset panel. Then click on "import" and enable the setting "force disable compression"

@chrisl8
Copy link
Contributor Author

chrisl8 commented Oct 17, 2023

There are two likely culprits

  1. Shadows (as Calinou pointed out). Shadows are enabled/disabled in your light source under the "shadow" section of the Light's inspector

Shadows are off by default on lighting sources, and are off in all of the examples posted above for the only light source in the scene:
image

However, there is a "global" light source, right? Perhaps it has a shadow on by default? I have not found a setting that fixes this if there is though.

  1. Mesh compression. To test if the issue is caused by mesh compression, click on the glb in the asset panel. Then click on "import" and enable the setting "force disable compression"

This does not appear to help. I've tried setting that flag and Reimporting and closing and reopening and closing and deleting the .godot folder and reopening but the result is the same
image

Thank you for the suggestions though.

@Calinou
Copy link
Member

Calinou commented Oct 17, 2023

However, there is a "global" light source, right? Perhaps it has a shadow on by default? I have not found a setting that fixes this if there is though.

The preview DirectionalLight3D (which is used if the scene has no DirectionalLight3D node) always has shadows enabled.

@chrisl8 chrisl8 changed the title Strange Lighting Issues in 4.2 Beta1 using Compatibility Mode Strange Lighting Issues in 4.2 Beta using Compatibility Mode Oct 21, 2023
@chrisl8
Copy link
Contributor Author

chrisl8 commented Oct 24, 2023

However, there is a "global" light source, right? Perhaps it has a shadow on by default? I have not found a setting that fixes this if there is though.

The preview DirectionalLight3D (which is used if the scene has no DirectionalLight3D node) always has shadows enabled.

Using a DirectionalLight3D appears to disable the "preview DirectionaLight3D", but the issue remains.

The comparison between Compatibility and Forward+ still demonstrates the issue with 4.2 Beta's compatibility renderer
Screenshot 2023-10-24 102508

image

@clayjohn
Copy link
Member

Screenshot from 2023-10-24 19-17-13

This is what the normals of the mesh look like. So clearly an issue with the normals. However disabling compression doesn't fix the situation. Will need to debug further

@chrisl8
Copy link
Contributor Author

chrisl8 commented Oct 24, 2023

@clayjohn I built godot from source using PR #83906 and it looks beautiful!
image
Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants