Shadows for TriangleStripDrawMode is not proper

Hi,
I have rendered two cubes with custom data. One I have drawn with TriangleStripDrawMode and other with TriangleFillMode.

Playground example.
https://www.babylonjs-playground.com/#RL0C2E

Problem:

The shadow generated for the cube with TriangleStripDrawMode is not proper.
The shadow generated for the cube with TriangleFillMode is proper.

Possible Solution

In shadowGenerator.ts file,
Inside private _renderSubMeshForShadowMap () method,

// Draw
mesh._processRendering(subMesh, this._effect, Material.TriangleFillMode, batch, hardwareInstancedRendering,
(isInstance, world) => this._effect.setMatrix(“world”, world));

Here, the value Material.TriangleFillMode is hardcoded. Instead, it has to be obtained from the particular mesh’s fillMode.

Hi @gopivell

Thank you for the playground and the explanation. Can you make a PR?

2 Likes