Shadow Exponential filter / Transparent Mesh Problem

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
eduardor
Gnoblar
Posts: 9
Joined: Wed Jul 26, 2017 2:50 am

Shadow Exponential filter / Transparent Mesh Problem

Post by eduardor »

Hello. I have this problem. I need to use I transparent floor, but in the shadow I want Exponential Filter for soft shadow.

I was doing some test in the Sample_ShadowMapDebugging project.

I realized, that if the shadow filter is PCF #x# shadow look the same no matter if the floor is or not transparent.

Image

However, when I set the filter in ESM if the floor is transparent look like the filter is not working, is very sharp the shadow.

Image

Looking the debug image below, I suppose that probably is something about that the plane transparent is not present in the shadow map.

But this is a bug?, is a limitation of the exponential filter?, is there any trick to get the soft shadow in the transparent object?.

Regards.
Eduardo
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by dark_sylinc »

What you're seeing is a limitation of exponential shadow maps, but there is a possible solution.

Here's what happening:
  • ESM doesn't look good if there is a lot of distance between casters. In this case, because the plane isn't rendering, the distance is almost infinite.
  • The solution would be to put some other caster (e.g. another floor) behind the current floor that's failing. How far behind? You experiment.
  • Transparency disables casting shadows, which is why the floor stopped casting shadows, and thus the shadow map had only the shadows of the cubes (and because the gigantic distance between the clear colour aka the max possible depth, and the cube's depth, the issue appeared)
eduardor
Gnoblar
Posts: 9
Joined: Wed Jul 26, 2017 2:50 am

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by eduardor »

Hi dark_sylinc.

Thanks for the answer :) . I did what you mention, I placed a plane under the transparency one, but the issue keep.

Even I realize that in the plane below (has no transparency) the shadow has the same problem.

Image.
Image

Really thanks.
Eduardo
eduardor
Gnoblar
Posts: 9
Joined: Wed Jul 26, 2017 2:50 am

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by eduardor »

Testing some values in the shadow project, created an concern about something.

Why ESM pay attention to the transparency?, I ask that because normal Depth Map Shadow don't pay attention if the object is transparent or not. If the object is transparent Depth Map shadow create a normal shadow like it's was opaque.

I ask that because for example if a I use transparent object the ESM don't project the shadow correctly . PCF filter work as I expected. I reviewed the code that use ESM filter and I don't see anything in the code that considerer the alpha.

Image

Thanks and regards.
Eduardo
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by dark_sylinc »

Could you post the modified code of ShadowMapDebugging? I want to check it myself to see if it's a bug or wrong param, etc
eduardor
Gnoblar
Posts: 9
Joined: Wed Jul 26, 2017 2:50 am

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by eduardor »

Hi Dark, here I send you the file in the upload.

I don't know if this file "ShadowMapDebuggingGameState.cpp" is what are you ask me for, but was the only that I changed.

Regards.
Attachments
ShadowMapDebuggingGameState.cpp
(22.46 KiB) Downloaded 51 times
eduardor
Gnoblar
Posts: 9
Joined: Wed Jul 26, 2017 2:50 am

Re: Shadow Exponential filter / Transparent Mesh Problem

Post by eduardor »

Hi. Any idea about this problem?.

Thx for any help.
Post Reply