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

Window width affects directional shadow resolution (fixed in master) #23603

Open
EzraT opened this issue Nov 8, 2018 · 9 comments · Fixed by #37678
Open

Window width affects directional shadow resolution (fixed in master) #23603

EzraT opened this issue Nov 8, 2018 · 9 comments · Fixed by #37678

Comments

@EzraT
Copy link

EzraT commented Nov 8, 2018

Godot version:
Affects both 3.0.6 and Official 3.1 Alpha 2

OS/device including version:
Linux Mint 19 - 64bit
Nvidia GeForce GTX 1060 on driver version: 396.54

Issue description:
For some reason the directional shadow resolution decreases as the window width increases, and increases as the width decreases.
Happens in the editor window and also in a running game.
Video

I'm assuming this isn't intended behaviour?
OmniLight and SpotLight do not seem affected.

Steps to reproduce:

  1. Set up a scene with meshes and a Directional Light with shadows enabled.
  2. Decrease and increase the width of the 3D scene window and observe shadows.
@Calinou
Copy link
Member

Calinou commented Nov 8, 2018

This is already mentioned in #12148 (comment) and #13575 (comment), but since there doesn't appear to be a dedicated issue for this bug, I'll leave this one open.

@EzraT
Copy link
Author

EzraT commented Dec 25, 2018

Any chance this one can be added to the 3.1 milestone?
The quality difference is quite dramatic.

@akien-mga akien-mga added this to the 3.1 milestone Dec 27, 2018
@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jan 24, 2019
@and3rson
Copy link
Contributor

and3rson commented May 8, 2019

Bumping as this issue still persists.

@Calinou
Copy link
Member

Calinou commented May 8, 2019

I'm not sure if this can be resolved completely (any ideas?). Still, we could make it so the shadow quality becomes worse when the viewport becomes taller, instead of wider. This would play better with ultrawide displays which are becoming more common.

@Calinou
Copy link
Member

Calinou commented Jul 29, 2019

I tested how shadow quality changes when the camera is set to use Keep Width (Vert-) aspect instead of Keep Height (Hor+, the default). The shadow quality still decreases as the viewport becomes wider (even though the horizontal FOV doesn't increase, causing the image to look "zoomed in"), but it doesn't decrease as the viewport becomes taller.

This may hint at a configuration issue somewhere in the rendering code or shader.

@lawnjelly
Copy link
Member

This makes sense. If your shadow map is fixed in width, in the video, as he changes the width (aspect ratio) the width of the box relative to the viewport width decreases as the viewport width goes up, even though the apparent size stays the same. Thus there are less texels in the shadow map for the box in widescreen, and the observed pixellation increases.

If you changed the width and height at the same time, the box decreases / increases in size and thus the observed pixellation stays the same. The apparent size of objects is based on the height, rather than width, such that changing the aspect ratio just widens the view.

@Calinou
Copy link
Member

Calinou commented Nov 15, 2020

Reopening as this isn't fixed in 3.x yet. See #43582 for a workaround (use a rotated Viewport).

It's likely possible to backport shadow pancaking to 3.2.x, both in the GLES3 and GLES2 renderers. I don't know how to do it though. So far, I've only managed to backport the directional shadow width fix: #43207

@Calinou Calinou reopened this Nov 15, 2020
@Calinou Calinou changed the title Window width affects directional shadow resolution. Window width affects directional shadow resolution Nov 15, 2020
@Calinou Calinou changed the title Window width affects directional shadow resolution Window width affects directional shadow resolution (fixed in master) Oct 1, 2021
@Calinou Calinou modified the milestones: 4.0, 3.4 Oct 1, 2021
@akien-mga akien-mga modified the milestones: 3.4, 3.5 Nov 8, 2021
@SkanerSoft
Copy link

Hello! Is there any solution for this problem?
I'm using 3.5.2 and I'm getting a shadow resolution issue on my monitors, when the game is running on a 4:3 monitor the shadows are nice, but if I drag the game to a wide monitor the shadows become cubic and ugly...
123

@Calinou
Copy link
Member

Calinou commented Apr 24, 2023

Hello! Is there any solution for this problem?

Yes, merge #43207 locally against 3.5.2 then build custom export templates using it 🙂

If you don't want to build custom export templates, you could double the directional shadow size from the default value when the viewport's aspect ratio is wider than a certain threshold: #54165
This will have a greater performance impact than this PR though.

@Calinou Calinou modified the milestones: 3.5, 3.x Apr 24, 2023
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.

6 participants