I have a plain textured (lighting) quad.
Just above it I have a separate textured (lighting) quad.
The “floating” quad has a partially transparent texture and has alphaTest and falloff set.
Both are set to receive shadows, PSSM shadow renderer is running.
Everything looks and works perfectly, until I move a card (casting shadows) over the floating quad.
Over the areas with no overlap the shadow looks normal, as soon as it crosses over the area though it gets a darker (looks as though it is being applied twice). This definitely happens in the area with the transparent pixels (and there is a very clear line where the shadow crosses the edge of the quad). It’s harder to see on the non-transparent ones but it looks as though the shadow is normal there.
Thanks,
Z
Screen shot?
use AlphaDiscardThresold on the lighting material instead of the alphaFalloff render state
1 Like
@t0neg0d said:
Screen shot? :D
I had one ready to go but the image upload site refused to upload it and I didn't have time to go back and upload it to our servers.
@nehon said:
use AlphaDiscardThresold on the lighting material instead of the alphaFalloff render state
http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/transparency-and-shadows-possible-breaking-change/
Didn't that say to switch to alphaFaloff instead of alphaDiscard?
Ok, I removed the render state stuff and added:
[java]
mat.setBoolean("UseAlpha", true);
mat.setFloat("AlphaDiscardThreshold", 0.5f);
[/java]
It works perfectly now. Thanks
Yep but I had to revert it back.
All is explained here http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/shadows-again/?topic_page=1&num=15#post-191211
Ahh, ok. Thanks again
@zarch said:
[java]
mat.setBoolean("UseAlpha", true);
[/java]
I'm too tired to go look at the shader. Why does this uniform exist? I don't recall any encapsulation around the discard check. Does it really have anything to do with that? I seem to remember is looking something like:
[java]if (color.a < m_AlphaDiscardThreshold) {
discard;
}[/java]
Probably just not remembering correctly... but I don't remember this being used with AlphaMap... as that's a define. Seeeeew.... what's this for?
EDIT: Betting it's further into the light calculation and decides if to set the alpha after the fact or leave it at the current 1.0