-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
PSSM artifacts with directional lights #13575
Comments
I just tried the beta build an looks like the problems with the shadows are still there. I opened a couple of issues about this but got closed. I think that this is gonna be a real problem when more users get aboard with the beta and they see that there is no way to tune the shadows to look ok even in the simplest scene. This is the last issue I created #11390. |
Note that directional shadow size changes are effective only after an editor restart (or running the project). However, I can confirm that directional shadow maps will look poor when the viewport is very wide (but not when it's very tall), see the screenshots below: Wide viewport (bad directional shadows): Square viewport (good directional shadows): Tall viewport (good directional shadows): OmniLights are not affected by this issue. Note that you can fix split incoherence by enabling Blend Splits on the DirectionalLight. This should probably be enabled by default, as it looks much better. |
Do blending splits makes it looks better? |
Blend splitting is enabled in my project; disabling it has no impact on this particular issue. |
I insist that the PSSM algorithm is implememted as best as I understand it. It may be a matter of default settings. If anyone wants to research more on this topic, let me know and I will linknto relevant pieces of code |
Blending help a bit but when there so much difference between two splits it seems not be able to smooth the result properly. Some cool pointers, for anyone looking for information : |
The main issue I see with the directional shadows is that the objects don't appear to have contact with the ground. Lowering the bias much further from the default produces artifacts. Here are the results I get using the same bias and normal bias settings from the Unity screenshot: Setting any amount of contact causes pretty nasty artifacting. Here are some examples with a contact value of just 0.1: Increasing the texture resolution of the directional shadows from 4096 to 8192 does let me set the bias lower before artifacting occurs (and thus make the shadows less floaty), but doing this effectively halves my framerate. Why has #7204 been closed? Can it be resurrected? Edit: I am getting much better results if I increase the size of the geometry by 10x: The defaults for shadow and rendering distance don't seem to be designed with this scene size in mind, however: |
Because it was made for Godot 2.1. Godot 3 has a completely new renderer backend, so that PR can't be applied anymore. |
Poking at this some more, it seems like the max shadow distance is what determines the resolution and precision of the shadows (combined with the shadow texture size selected in the project settings). This would explain why enlarging the geometry made the shadows more precise. I wonder how the distance defaults compare to Unity? |
The shadows are still bad for directional lights in 3.1.1. Perhaps have a look at the code of UE4 to see how they did it. |
@jayanam We can't look at UE4 code due to the proprietary license it's under. |
I didnt mean to copy it, just understand how they implemented directional
lights and shadows, because the implementation of PSSM in Godot seams to be
incorrect.
…On Sun, Jun 2, 2019 at 11:40 PM Hugo Locurcio ***@***.***> wrote:
@jayanam <https://github.com/jayanam> We can't look at UE4 code, due to
its license.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13575?email_source=notifications&email_token=AEJUGIB4VJS63NU32HQRS43PYQZJHA5CNFSM4EGMDWKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWX6CBQ#issuecomment-498065670>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJUGIACUC4ZHMRZK4425YTPYQZJHANCNFSM4EGMDWKA>
.
|
@jayanam Even merely reading its code constitutes a legal risk, as one of Epic's lawyers could claim the implementation is too close to the original. This is why reverse engineering is best done in a "clean room" approach 🙂 |
What about Unity? https://blogs.unity3d.com/2018/03/26/releasing-the-unity-c-source-code/ |
That blog posts is pretty clear. Not open source. |
You can't modify the code, but you can read it "... to understand or improve performance of games... made with Unity engine". And if you understand how Unity did it, there's nothing stopping you from improving Godot's implementation? Neither Unity nor UE4 have those issues with shadows... |
Yep, that's what I wanted to say.
…On Mon, Jun 3, 2019 at 3:13 PM Zireael07 ***@***.***> wrote:
You can't modify the code, but you can read it "... to understand or
improve performance of games... made with Unity engine". And if you
understand how Unity did it, there's nothing stopping you from improving
Godot's implementation? Neither Unity nor UE4 have those issues with
shadows...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13575?email_source=notifications&email_token=AEJUGIFDRZGKKUIXLGWKFY3PYUKF7A5CNFSM4EGMDWKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWZLFFQ#issuecomment-498250390>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJUGIAZQIZVD6V7VJNCL33PYUKF7ANCNFSM4EGMDWKA>
.
|
I believe this is one of those gray areas of software licensing and copyright. Some people consider it to be ok to read proprietary source code and take some ideas from it as long as you don't actually copy the code, but there are also precedents like GNU Classpath, for instance, which forbade anyone who had seen the proprietary source code (thus 'becoming tainted') which it aimed to clone from participating to the project, to stay clear of any potential legal problems. |
With the default camera node settings, this makes directional shadows look consistent between the editor and the running project. The original issue occurs because the editor camera defaults to a Z-far value of 500, whereas the Camera node defaults to a Z-far value of 100. Since the directional shadow maximum distance is clamped to the Z-far value, it caused the running project's effective shadow distance to be lower compared to the editor (100 instead of 200). This partially addresses godotengine#13575.
With the default camera node settings, this makes directional shadows look consistent between the editor and the running project. The original issue occurs because the editor camera defaults to a Z-far value of 500, whereas the Camera node defaults to a Z-far value of 100. Since the directional shadow maximum distance is clamped to the Z-far value, it caused the running project's effective shadow distance to be lower compared to the editor (100 instead of 200). This partially addresses godotengine#13575.
Operating system or device, Godot version, GPU Model and driver (if graphics related):
godot master branch
Issue description:
It seems to me pssm and/or pcf need a little more work to be really usable.
For a simple scene with a cube and sphere, the default settings are not great (gap due to bias) but even after many tweaking I would say it's not ok :
Steps to reproduce:
Here my little scene with results (which are very different in every viewports) :
Here a comparison with unity (with no tweaking) :
Link to minimal example project:
The text was updated successfully, but these errors were encountered: