Trying to implement Shadow Mapping

For people working on the C++ code.
Liso
Member
Posts: 22
Joined: Thu Feb 06, 2020 10:21
GitHub: anlismon
In-game: Liso
Location: Valencia - Spain.
Contact:

Re: Trying to implement Shadow Mapping

by Liso » Post

Andrey01 wrote:
Wed Jan 06, 2021 21:41
I tested out the shadows today and after that I understood why this is currently even "pre-alpha" version. There is my list of discovered bugs/lacks:
And these bugs are only a small subset of them xD.


First of all, THANK YOU for testing it. You make my day :).

Second, Sorry I didn´t push the last changes in to the master branch. Could you try it with the changes I just commit in to the master?
or, you can checkout the "shadowmap" branch.


And I mostly worked in the CSM version, and it's not enabled by default. to enable it go to the all settings menu, search shadows, and enable the "Cascade Shadow Mapping" and the texture in 32 bits:

Something like this:
Image

Most of the bugs you listed are because the lack of code in the non-CSM mode.


About the "ripple" is a well known (but not easy to fix) problem with shadow mapping. The self-shadowing, or shadow acne, and basically it's a problem with precision.

The way to face it is to use a small bias when we build the shadows, but if we use too much bias we can have the opposite problem, the Peter-Panning . In theory this can be fixed using "glDepthOffset" but I don't know how to use it in Irrlicht3D.

The last version has a naive basic implementation of Slope-Scale Depth Bias, that try to minimize that problem.

I want to say I'm sorry for my lack of activity.

And again, Thank you for your help.
Attachments
settings.jpg
Settings
(60.33 KiB) Not downloaded yet
Liso. - My twitter -

User avatar
Andrey01
Member
Posts: 2464
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: Trying to implement Shadow Mapping

by Andrey01 » Post

Liso wrote:Could you try it with the changes I just commit in to the master?
or, you can checkout the "shadowmap" branch.
Ok, I will try out it tonight.
Liso wrote:And I mostly worked in the CSM version, and it's not enabled by default. to enable it go to the all settings menu, search shadows, and enable the "Cascade Shadow Mapping" and the texture in 32 bits:
Hmm, i.e. those shadows that I tested were handled server-side and for that reason it caused so heavy lags? I think their rendering should occur fully client-side.
Liso wrote:I want to say I'm sorry for my lack of activity.
I am currently learning OpenGL bases and then I plan switch to learn GLSL. Maybe I can somehow help with code and fix those bugs, but that's rather long-term process because I need to learn also the part of the engine where the rendering occurs itself.

Liso
Member
Posts: 22
Joined: Thu Feb 06, 2020 10:21
GitHub: anlismon
In-game: Liso
Location: Valencia - Spain.
Contact:

Re: Trying to implement Shadow Mapping

by Liso » Post

Andrey01 wrote:
Thu Jan 07, 2021 11:03

Hmm, i.e. those shadows that I tested were handled server-side and for that reason it caused so heavy lags? I think their rendering should occur fully client-side.
Yes. All the shadow mapping is done in the client.
Liso. - My twitter -

User avatar
Andrey01
Member
Posts: 2464
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: Trying to implement Shadow Mapping

by Andrey01 » Post

It is strange, the game gets playable only if the shadow map texture size <= 2048 as FPS ranges 56-60 in such case. If I increase it twice (4096), FPS will drop down five times what is not in inverse ratio to the size growth. If one more increase twice (8192), FPS will be somewhere lower 5. Why does FPS so much drop down in the second case? At fact, then in third one it should be equal to 1, not higher.

Also, I`ve noticed nodes of 'plantlike', 'flowingliquid' and 'torchlike' drawtypes are not affected by shadows, they have the same tint as if the dynamic shadows were be disabled.

Liso
Member
Posts: 22
Joined: Thu Feb 06, 2020 10:21
GitHub: anlismon
In-game: Liso
Location: Valencia - Spain.
Contact:

Re: Trying to implement Shadow Mapping

by Liso » Post

Yes, the texture size can cause a high impact in the performance and that depends on the GPU because is often limited by fillrate or memory bandwidth.

But the shadows should be good enough with 2048, or even 1024.

About the drawtypes not affected by shadows, probably the shader is wrong ;), I remember I turned off the shadow casting on torchlike.
Liso. - My twitter -

User avatar
Andrey01
Member
Posts: 2464
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: Trying to implement Shadow Mapping

by Andrey01 » Post

Hello Liso. Just I'm interested in knowing how your development is going on :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest