add DH overdraw prevention toggle.

This commit is contained in:
Xonk
2024-02-12 17:54:00 -05:00
parent b91c1f796f
commit f99a3c33b5
5 changed files with 51 additions and 14 deletions

View File

@ -93,11 +93,14 @@ uniform vec3 cameraPosition;
/* RENDERTARGETS:1,7,8 */
void main() {
// overdraw prevention
if(clamp(1.0-length(pos.xyz)/max(far - 16.0,0.0),0.0,1.0) > 0.0 ){
discard;
return;
}
#ifdef DH_OVERDRAW_PREVENTION
// overdraw prevention
if(clamp(1.0-length(pos.xyz)/max(far - 16.0,0.0),0.0,1.0) > 0.0 ){
discard;
return;
}
#endif
vec3 normals = viewToWorld(normals_and_materials.xyz);
float materials = normals_and_materials.a;