-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adjust PSM distortion to use entire SM texture #12166
Conversation
... instead of SM texture center...
Also checked in all other presets: none of them the shadows are not rendered. Except that, I noticed the performance doesn't change at all when switching between presets (FPS hesitates within 59-60 ). That is, the engine just refuses to render them for some reason, this is not a result of e.g. the shadows color is transparent and therefore invisible. |
@Andrey2470T I don't believe MTG supports shadows currently, you'll need to use a recent version of devtest, and possibly have to enable shadows within the game, via chat command, to see them. |
@Andrey2470T currently only devtest game supports dynamic shadows. You need to type |
@Andrey2470T Also #12157 will enable shadows by default and change the command to |
I can confirm that the shadow quality is (much) better with the same settings. Both at the same time with just slightly different view angles. Probably due to blocks behind the player not being rendered (and hence casting no shadows). Note that happens also without this change. (Although it seems to be less.) |
On the code I'll mostly trust you. Seems to all make sense, but I didn't time to reason through the changes formulas and changed constants. |
Can you describe the netty shadow? Does it disappear when you disable the filtering?
Yeah, shadow draw list is still generated with an old algorithm which does not account for the new light frustum. I'll fix it and let's see if it causes problems for @Andrey2470T :) |
No. I disabled the poisson filtering in the settings and it didn't disappear. |
This is only specific to devtest. MCL2 and MTG do not have the lag problem. |
Use non-perspective frustum culling (direction + radius) Remove occlusion culling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! Nothing stands out with the code.
See the few comments I left.
Unfortunately, the last commit didn't fix those bugs which I reported about. I looked into a bit deeper the conditions on which they happen: first off, I want to say there are no the self-shadowing and the ripple on the model in the master branch. So maybe did your PR break something in the code? And what I noticed is the self-shadowing appears only during walking and only when the sun is behind of you. The last condition also relates to the ripple bug. However, nothing of that happens on first world startup until how the sun passes over the zenith point. Other bug that I already mentioned in the previous comment is the shadow falls back for updating its location somewhere at half-second interval when a player is walking. Also, could you please fix the waving artifact around the edges of the shadows? |
@Andrey2470T I have not observed the issues you see. I definitely do not see the shadow "falling behind". |
Also dev-test is special here in how the player is rendered. I do see the shadow lag of one frame there, but IMHO we do not need to fix that as dev-test is so special... Same with self-shadowing of the 2d player model. Edit: Spelling |
That's what I mean: shadow_fall_behind.mp4As you see on this short video, at a high speed the shadow casted from the player is a bit falling behind in that moment. Maybe does this happen of the shadowmap is got updated after somewhere a half-second, not so often as the main rendering? |
@Andrey2470T @lhofhansl I hacked shadows into MCL2 and MTG and checked that there is no lag for the player shadow, so it is devtest-specific. |
I maintain my "One Approval". If we feel devtest is a significant problem I propose fixing that in a different PR. |
@lhofhansl Filtering and biases/offsets are known to be off and are on my list of things to fix. Zoom is changes the scale of the shadow map, making SM texels and filter radius larger. I an only see this being solved by non-square SM texture or cascaded shadow maps. I will merge this PR now. |
May I ask you to file a bug for this, so we do not forget? |
Yes, the offset parameters to avoid self-shadowing are now wrong because of a different distortion function for the shadows. Tuning these parameters is the next task on my list, and after that I will optimize filtering.
This is a good insight, thank you. I will take a look when fixing self-shadowing.
"Waving artiact" happens due two reasons:
|
This PR aims to improve quality and visible distance of the dynamic shadows.
What's done:
To do
This PR is Ready for Review.
How to test
For example, Medium preset should have decent shadow quality and support viewing distance up to 200 nodes.