I’m having a z-fighting issue with shadows when the shadow become parallel to a polygon. This is with softShadows disabled. However I would like to have softShadows enabled but here z-fighting is a constant issue.
I’ve read that glPolygonOffset would be a good solution, but can’t find how to enable this. Any advice or other solutions to avoid z-fighting when in softShadows mode?
I believe CesiumJS already applies this glPolygonOffset fix when the browser supports it (according to the PR here https://github.com/CesiumGS/cesium/pull/4559). I don’t know that there’s an easy fix the application can do to improve these artifacts on shadows other than increase the size of the shadow map perhaps.
To check if polygon offset is supported you can add console.log(viewer.scene.shadowMap._polygonOffsetSupported); or step into the code here:
We also apply normal offset bias, which helps, but there are still shadow artifacts. It looks like your model does have normals and can use this technique. You can try tweaking some of the values here and see if it helps: