fix(draw): avoid zero division

This commit is contained in:
yvt 2021-02-08 23:07:19 +09:00
parent 98da38e1da
commit b7ee51167f
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao) {
// ambient occlusion
vec2 ambTexVal = texture3D(ambientShadowTexture, ambientShadowTextureCoord).xy;
float amb = ambTexVal.x / ambTexVal.y;
float amb = ambTexVal.x / (ambTexVal.y + 1.0e-12);
amb = max(amb, 0.); // for some reason, mainTexture value becomes negative
// mix ambient occlusion values generated by two different methods somehow

View File

@ -60,7 +60,7 @@ vec3 Radiosity_Map(float detailAmbientOcclusion, float ssao) {
// ambient occlusion
vec2 ambTexVal = texture3D(ambientShadowTexture, ambientShadowTextureCoord).xy;
float amb = ambTexVal.x / ambTexVal.y;
float amb = ambTexVal.x / (ambTexVal.y + 1.0e-12);
amb = max(amb, 0.); // by some reason, mainTexture value becomes negative
// mix ambient occlusion values generated by two different methods somehow