Shadows with alpha maps

I’m trying to get a shadow effect through a quad. This quad has applied a texture and an alpha mask. I can see through this quad but it’s all shadowed.

Is it possible that this “hole” does not block the light, or this feature isn’t been implemented?

This image show my results and what I want to get

Thanks!

Do you use the shadow renderer? If you do you can exclude an object from the shadow pass by doing geom…setShadowMode(ShadowMode.Off);

Yes, I’m using PointLightShadowRenderer and the first quad is in ShadowMode.Cast and the second one is in ShadowMode.Receive.

The first quad cast the shadow on the second but the hole is inexistent for the shadow renderer, it shadow the entire quad.

A fragment of my code:

[java]

// Material definition
Material darkSandMat = new Material( assetManager, “Common/MatDefs/Light/Lighting.j3md”);
darkSandMat.setTexture(“DiffuseMap”, assetManager.loadTexture(“Textures/Terrain/dark-sand.jpg”));
darkSandMat.setTexture(“NormalMap”, assetManager.loadTexture(“Textures/Terrain/dark-sand-normals.jpg”));
darkSandMat.setTexture(“AlphaMap”, assetManager.loadTexture(“Textures/Terrain/testAlpha.jpg”));
darkSandMat.setTransparent(true);
darkSandMat.setFloat(“AlphaDiscardThreshold”,0.6f);
darkSandMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
darkSandMat.getAdditionalRenderState().setAlphaTest(true);

Material lightSandMat = new Material( assetManager, "Common/MatDefs/Light/Lighting.j3md");
lightSandMat.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/light-sand.jpg"));
lightSandMat.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/light-sand-normals.jpg"));

// Models
Spatial terrainQuad = assetManager.loadModel(“Models/TerrainQuad/TerrainQuad.j3o”);
terrainQuad.setMaterial(darkSandMat);
terrainQuad.setQueueBucket(Bucket.Transparentt);
terrainQuad.setShadowMode(ShadowMode.Cast);
rootNode.attachChild(terrainQuad);

Spatial terrainQuadback = assetManager.loadModel("Models/TerrainQuad/TerrainQuad.j3o");
terrainQuadback.setMaterial(lightSandMat);
terrainQuadback.setShadowMode(ShadowMode.Receive);	        
rootNode.attachChild(terrainQuadback);

// Lights and shadows
PointLight lamp_light = new PointLight();
lamp_light.setColor(ColorRGBA.Yellow);
lamp_light.setRadius(4f);
lamp_light.setPosition(new Vector3f(0,0,3));
rootNode.addLight(lamp_light);

plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
plsr.setLight(lamp_light);
plsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
viewPort.addProcessor(plsr);
  
plsf = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
plsf.setLight(lamp_light);     
plsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
plsf.setEnabled(false);

FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
fpp.addFilter(plsf);
viewPort.addProcessor(fpp);
        
DirectionalLight sun = new DirectionalLight();
sun.setDirection(cam.getDirection());
rootNode.addLight(sun);

[/java]

ohhh ok it’s a hole…i didn’t get it from the screen shot.
You have to set the AlphaDiscardThreshold parameter on the casting quad’s material. that’s the actual alpha value below which the pixel is not rendered.