I read that for a depth precision issue we use cull face during shadow mapping. Unfortunately, I have a scenario where objects must be rendered double sided… Making cull facing impossible and the depth precision issue appearing…
First… from where this precision issue come from? I actually don’t see the issue. Then, is there any way to use shadow mapping for double sided objects?
Ah, I see. This theory only applies fully when your objects are ‘closed’ meshes and have a thickness that is non-zero. My best guess is to use polygon offset in your case.
Depth of 2 (back face) gets rendered into depth map.
Comparisons:
1-depthmap: lit - accurate
2-depthmap: shadowed - inaccurate but shadowed anyway because normal faces away from light
3-depthmap: shadowed - accurate
4-depthmap: shadowed - accurate and shadowed anyway because normal faces away from light
for zero thickness
________
| | |
L -------- | ----- | ----- |------> Ray
| |_______|
light 1+2 3 4
origin
Depth of 2 (back face) gets rendered into depth map.
Comparisons:
1-depthmap: lit/shadowed - inaccurate!!
2-depthmap: shadowed - inaccurate but shadowed anyway because normal faces away from light
3-depthmap: shadowed - accurate
4-depthmap: shadowed - accurate and shadowed anyway because normal faces away from light