Announcement
Dynamic shadows artifacts
-
Originally posted by Zeblote View Post
This is caused by shadows. Shadows don't actually work at all for orthographic cameras, so the problem will not appear.
Ortho camera is broken in-world it appears. It's unrelated, but the issue probably involves the lack of the perspective matrix.
Comment
-
Originally posted by Ohriginal View Post
Simply false. You can rotate the light in an ortho mode in a mesh-viewer without issue. Shadows look clean. Switch to perspective and the shadows become blocky. Like I said, the fix is to simply factor the perspective matrix into the shadowing. I'd do it myself but the rendering pipeline is closed source.
Ortho camera is broken in-world it appears. It's unrelated, but the issue probably involves the lack of the perspective matrix.
Also, all code is available on github. Unreal has no closed source parts.
Comment
-
Originally posted by Ohriginal View Post
Simply false. You can rotate the light in an ortho mode in a mesh-viewer without issue. Shadows look clean. Switch to perspective and the shadows become blocky. Like I said, the fix is to simply factor the perspective matrix into the shadowing. I'd do it myself but the rendering pipeline is closed source.
Ortho camera is broken in-world it appears. It's unrelated, but the issue probably involves the lack of the perspective matrix.
If you want to check the shaders they're under Engine/Shaders.
Comment
-
Originally posted by Chosker View Postyep got some evidence now
btw is it me or does Fortnite completely ignore Landscape for the terrain to rely on static meshes? :O
Fortnite used meshes per zones the world of fornite are random generated so place meshes per zones of 20x20m +- to build a puzzle level for say it in some way.
Seems like this still no fixed.
Happy New YearHevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
Hevedy - Image Tools: https://hevedy.itch.io/imagetools
Comment
-
Personally even if Epic doesn't want to address this problem at this time, I would like to know what is causing it and if there is a solution for it, since i've seen it come up in other realtime software, can someone explain why is it such a universal problem? is it a hardware limitation thing or software or...?
Comment
-
Originally posted by William K View PostPersonally even if Epic doesn't want to address this problem at this time, I would like to know what is causing it and if there is a solution for it, since i've seen it come up in other realtime software, can someone explain why is it such a universal problem? is it a hardware limitation thing or software or...?
A bit more details under the spoiler.
Shadow mapping typically works by rendering the scene depth from point of view of the shadowcasting light.
Coordinates of scene pixels/fragments are then transformed into coordinate space of the light and their Z coordinate is compared to the depth, stored in shadowmap.
If pixel's Z coordinate in light space is larger than depth, stored in shadowmap, it is in shadow. Otherwise, it is not.
Everything would be cool, if all screen pixels would always map to a corresponding shadow map texels. In reality they don't and quite a few neighboring pixels would be mapped to a single shadow map texel. That means that when comparing Z coordinate of a pixel in lightspace, with a depth stored in shadowmap, there will be certain error, and some pixels would be falsely shadowed, while others would be erroneously unshadowed. This effect is commonly known as shadow acne.
The most straightforward way of dealing with it, is to add a certain fixed value to the shadowmap depth, reliably pushing problematic pixels out of the shadow. While such method efficiently deals with the issue, it also reduces the shadowed area on the objects. If overdone, it cause object's shadow to be smaller than the object, resulting in objects levitating above the surface look.
This approach is implemented in UE4 and you can tweak it with a value called Shadow Bias on each light.
However, when you add shadow filtering for smoother shadow edges, the problem worsens considerably. Now for a single pixel you would need to test it against several neighboring shadowmap texels, and when doing so, you are still using light-space Z coordinate value of the the original pixel, which greatly inflates the error.
To compensate, you would need to increase the bias considerably.
There are few ways of dealing with it.
Firstly, reducing shadow filter size would reduce the amount of biasing required. It can be done by setting quality presets.
Secondly, slope scaled depth bias can be implemented.
The idea is to add little amount of bias on the surfaces, that are perpendicular to the light and large amount of bias on the surfaces, which are parallel to the light.
Slope-scaled depth bias is not implemented in UE4
The last common tool in dealing with the issue is receiver plane depth bias. In the essence, it works somewhat like slope scaled depth bias, but the amount of bias applied varies per each shadow filter sample taken instead of per shadow texel, resulting in even greater precision.
Receiver plane depth bias is implemented for PCSS shadows, but not for ordinary percentage closer shadow filtering, which is default.
Implementation of Slope scaled depth bias can be done by using a special shader for shadow depth rendering, or by setting slope bias in rasterizer state, the latter one being more tricky, but preferable. Both would require engine code adjustments and tug along certain complications.
Receiver plane depth bias can be implemented in shader files alone, without need to build the engine from source.
The essence of this thread is request to have slope-scaled depth bias and/or receiver plane depth bias as a part of stock UE4.Last edited by Deathrey; 01-01-2018, 11:35 AM.
- 2 likes
Comment
-
Thanks Deathrey . It greatly enlightned the issue for me now. I shall meditate on this for a while.Nilson Lima
Technical Director @ Rigel Studios Ltda - twitter: @RigelStudios
Join us at Discord: https://discord.gg/FUwTvzr
UE4 Marketplace: Cloudscape Seasons
supporting: Community FREE Ocean plugin
Comment
-
Originally posted by Deathrey View PostThis is more or less universal problem for shadow mapping algorithms.
A bit more details under the spoiler.
]
Comment
-
Originally posted by William K View Post
Hey thanks man for taking the time to explain this, any guesses on the pros and cons as to why Epic may not have chosen the latter two options that would result with relatively better shadowing?
If someone want to make raytracing in realtime there sure is a hardware performance problem, but there is always other ways so...Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
Hevedy - Image Tools: https://hevedy.itch.io/imagetools
Comment
Comment