I have PBRMaterials with opacityTextures applied, with useBlurExponentialShadowMap, enableSoftTransparentShadow & transparencyShadow. I’m seeing the shadows for the mesh but it’s not taking into consideration the opacityTextures.
Do transparent shadows work for PBR materials or only standard?
Here’s a PG using PBRMaterial which doesn’t seem to work:
And working StandardMaterial version:
In more of a fair comparison, I made a version using StandardMaterial with transparency coming from opacityTexture rather than diffuseTexture.hasAlpha and that doesn’t work either.
In my use case I have a single opacity texture applied to many different materials with opaque diffuse/albedo maps. It doesn’t make sense to add the same alpha channel to each of these instead of using a common opacity texture. It would incur too much additional bandwidth.
Is there a way to get transparent shadows working with opacityTexture in PBRMaterial?
By default the texture used to retrieve alpha data when generating the depth map texture is the diffuse texture. You can override the
mat.getAlphaTestTexture function to use your opacity texture instead: