Confused by the ShadowOnlyMaterial

Hi there,

I know the ShadowOnlyMaterial is a transparent material for ground like stuff, but why it does not show any shadow there?

code snippet:

    const dirLight = new DirectionalLight("shadowLight", new Vector3(0, -1, 0), this);
    dirLight.position.set(0, 10, 3);
    dirLight.diffuse = Color3.Red();

    const testPlane = Mesh.CreatePlane("testGrd", 50, this);
    testPlane.rotation.x = Tools.ToRadians(90);
    testPlane.position.y = -1;
    testPlane.material = new ShadowOnlyMaterial("testGrdMat", this);
    testPlane.material.activeLight = dirLight;  // ?? need or not need

no shadows on the plane at all…

am i missing something? like, the ShadowGenerator? (i thought if i use ShadowOnlyMaterial than I don’t need this stuff?).
I inspect on the debug panel, there is a generated depth texture, so i think the ShadowOnlyMaterial works, but why it does not appear?

I’m sorry there are 2 reasons I can’t create demo on playground:
1, our project is confidential.
2, if you type BABYLON.ShadowOnlyMaterial it pops error. (anyway I know this material is an extension, I can use it locally)


You need a shadow generator in your scene, even with a ShadowOnlyMaterial.

For an example that works in the PG: (from this thread Issue with CascadedShadowMap + ShadowOnlyMaterial)

1 Like

it works! thanks man, I thought IShadowLight has a ShadowGenerator already, so I don’t need to create a new one, it seems i was wrong, hah.