From: Seungho Baek Date: Tue, 11 Jul 2023 09:20:35 +0000 (+0900) Subject: [Tizen] Change some precision of shader variables to highp X-Git-Tag: accepted/tizen/7.0/unified/20230825.185054~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F296904%2F4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git [Tizen] Change some precision of shader variables to highp - There are some visual artifact to render 3D object in case of adding Directional Light. - Some variable's precision is too low. - This patch changes minimum number of variable's precision to highp Change-Id: I0ff1c30bb3f0eb837434f0dc61d2a461383dfbd2 Signed-off-by: Seungho Baek --- diff --git a/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.frag b/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.frag index 9a436f5..de7b28d 100644 --- a/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.frag +++ b/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.frag @@ -117,7 +117,7 @@ void main() lowp float metallic = uMetallicFactor; lowp float perceptualRoughness = uRoughnessFactor; // If there isn't normal texture, use surface normal - mediump vec3 n = normalize(vTBN[2].xyz); + highp vec3 n = normalize(vTBN[2].xyz); #ifdef THREE_TEX // The albedo may be defined from a base texture or a flat color @@ -222,8 +222,8 @@ void main() for(int i = 0; i < uLightCount; ++i) { - mediump vec3 l = normalize(-uLightDirection[i]); // Vector from surface point to light - mediump vec3 h = normalize(l+v); // Half vector between both l and v + highp vec3 l = normalize(-uLightDirection[i]); // Vector from surface point to light + mediump vec3 h = normalize(l+v); // Half vector between both l and v mediump float VdotH = dot(v, h); lowp vec3 specularReflection = f0 + (reflectance90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0); @@ -231,8 +231,8 @@ void main() lowp float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL))); lowp float geometricOcclusion = attenuationL * attenuationV; - mediump float NdotH = dot(n, h); - lowp float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0; + highp float NdotH = dot(n, h); + highp float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0; lowp float microfacetDistribution = roughnessSq / (M_PI * f * f);; // Calculation of analytical lighting contribution