Shadow on semitransparent receiver

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Shadow on semitransparent receiver

Post by kubatp »

Hi,
I have been reading and searching whole day and didn't find a solution, so I am trying my luck here.
I am newbie in Ogre shadows, so I apologize if some of the sound very basic.

I want to add additive texture shadows to my project, however there are some issues with this.
  1. The most annoying problem is that when I am projecting shadow to a semitransparent receiver, this receiver is no longer semitransparent but fully solid. I know from the manula that this is the default behavior, however I already read some questions that this can be changed?
  2. I set ShadowTextureSelfShadow to true and I can see it working, however it gives me strange result. Basically I have a manual object (terrain) which should cast shadows from hills and mountains. Unfortunately the shadow is not only where it should be (the correct side of the mountain), but also partially on the other side of the mountain.
    Image
    Here you can see the result
    Image
    Pink is the peak, blue is correct shadow and red is the issue
  3. Another issue are the lits of the entities. When I run exactly the same code, just with different shadow technique (stencil additive), I get nice lit on entities. When I run it with texture additive, the whole entities are darker without lit.
    Image
  4. Is there a way how to let semitransparent caster (using pixel shader) stay semitransparent?
  5. How to apply filtering on the shadow?
Thank you very much for your help. I would appreciate any advices, hints or links, which could help me.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Shadow on semitransparent receiver

Post by xrgo »

I don't have much experience with shadows in Ogre 1.X, when I was using Ogre 1.9 I used this shadows http://www.ogre3d.org/forums/viewtopic.php?f=11&t=71142 and they were amazing, maybe you can try that?. in Ogre 2.1 shadows just works.
Anyways... 2 and 3, seems to be a biasing problem, if you have access to the caster shader try to adjust (or add) the bias on the depth calculation.
4. in the caster shader you have to read the texture that contains the alpha channel and discard when alpha is beyond some threshold.
5. if you're using shaders in your materials try to implement PCF its the most simpler one, or you can look at this post where I put more filters to test http://www.ogre3d.org/forums/viewtopic.php?f=25&t=82998
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Shadow on semitransparent receiver

Post by kubatp »

Hi xrgo,
thank you very much for your answer. I tried to use the "Cascaded Shadow Mapping & Poisson Disk filtering", but I am having a problem to port it to MOGRE (because I use it) http://www.ogre3d.org/addonforums/viewt ... =8&t=30475.
I will try it again this weekend and I hope that I will make a progress:)
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: Shadow on semitransparent receiver

Post by scrawl »

Unfortunately the shadow is not only where it should be (the correct side of the mountain), but also partially on the other side of the mountain.

When I run it with texture additive, the whole entities are darker without lit.
This is to be expected with fixed-function texture shadows. The shadow maps are basically just the scene rendered from the light's point of view, so there's no way to determine if a pixel is behind the shadow caster or between shadow caster and light. When using this type of shadow map you can't have an object be a shadow receiver and a shadow caster at the same time.

For better shadow techniques, you'll need to look into using shaders (depth shadows, there are some snippets on the wiki, although they're very difficult to set up if you don't know shaders). Or use stencil shadows, but they're slow, don't scale, and can't do soft edges.
Post Reply