Shadow and Transparency


I have got different Problems with shadows and transparency, for example:

Is there a way to fix that a shadow can be seen on a transparent texture?

Besides I added a UI Picture which shows a ViewPort with a transparent background to the screen and than all shadows behind this picture were removed. (So I used nifty and now everything works fine)

place your tree in the translucent bucket instead of the transparent bucket

1 Like

I use the PssmShadowRenderer and changing the bucket does not have an effect.

Check out from JME3 Tests.

Same Problem. Is there no possibility that a tree can cast and receive shadows?





It makes the tree receive it’s own shadows, but if you look through the leaves from above, the floor doesn’t receive a shadow anymore. I don’t think this problem is easily solvable.

Edit: It works like below, but then there’s a problem with the fire (transparent vs. translucent vs. geometry sorting?).






Are you using the FilterPostProcessor? if you do you have to add a translucentBucketFilter at the end of your filter stack in order this to work.

If this does not work post some code so we an look into it

1 Like

I refer to The fire is a ParticleEmitter. If I play around with the shadow mode and buckets of the geometry (tree, floor, fire), there’s always at least one thing that looks ugly. Is correct self shadowing of the tree while also seeing the remaining shadow in the floor possible?

Wait i totally misled you…

Forget about the translucent bucket.

You have to set the alphaDiscardThreshold parameter of your leaves material to something above 0. 0.1 or 0.2 should work

look at leaves.j3m material used for the transparent shadows on the tree

sorry about the confusion

@survivor that’s strange i don’t have these issues

You did not activate self shadowing (“teaGeom.setShadowMode(ShadowMode.CastAndReceive);”).


Spatial teaGeom = assetManager.loadModel(“Models/Tree/Tree.mesh.j3o”);

Spatial leaves = ((Node)teaGeom).getChild(“Tree-geom-2”);

Material leavesMat = assetManager.loadMaterial(“Models/Tree/Leaves.j3m”);

leavesMat.setFloat(“AlphaDiscardThreshold”, 0.15f); // <<< ???



teaGeom.setShadowMode(ShadowMode.CastAndReceive); // <<<


Guys, y' know…that…that…it doesn't work for me. I gotta have more cowbell!

I'll leave it to the OP to find out if and how correct self shadowing works in this example. But I'd be interested in the solution.

Update: I have set the imagen in the correct way.

If I change teaGeom.setShadowMode(ShadowMode.CastAndReceive); to teaGeom.setShadowMode(ShadowMode.Cast); on TestTransparentShadow, I get the same result that @survivor mentions:





Hope this help

I think you mean it the other way round (pic1 = Cast, pic2 = CastAndReceive).

@survivor: Yes, you are right! Sorry! I will fix that.

Also, if you set the shadowMode to CastAndReceive and move the camera around the tree, you will see that from one side of a leaf (displayed as a plane), “transparency” is working fine, but for the other side, the “transparecy” is wrong. The side of the plane that is wrong is the side that receive the shadow.

Guys you’re killing me…

This transparency thing is hardcore…

maybe the problem is that the post shadow material does not discard the transparent pixels…I’ll look into it…

1 Like

What’s new? Everytime i test my application I see the ugly trees and every update I hope it will contain the fix.