From 5f69cd4fb3d8ffaf8b4ff103fc6643696f53f21a Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Tue, 24 Oct 2023 23:05:43 +0900 Subject: [PATCH] [Tizen] Ensure blendshape weight between [0..1] Let we ensure the blendshape weight is between 0 and 1. So ignore cases when weight value is bigger than 1, less than 0. Change-Id: I3bdd0a3f59498654e6e7ac65a4a2e665a58a9fcc Signed-off-by: Eunki Hong --- .../graphics/shaders/default-physically-based-shader.vert | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.vert b/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.vert index a0ffd0b..4f19310 100644 --- a/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.vert +++ b/dali-scene3d/internal/graphics/shaders/default-physically-based-shader.vert @@ -80,6 +80,7 @@ void main() highp int vertexId = 0; highp int x = 0; highp int y = 0; + highp float weight = clamp(uBlendShapeWeight[index], 0.0, 1.0); #ifdef MORPH_POSITION // Calculate the index to retrieve the geometry from the texture. @@ -88,7 +89,7 @@ void main() y = vertexId / width; // Retrieves the blend shape geometry from the texture, unnormalizes it and multiply by the weight. - if( 0.0 != uBlendShapeWeight[index] ) + if(0.0 != weight) { #ifdef MORPH_VERSION_2_0 highp float unnormalizeFactor = uBlendShapeUnnormalizeFactor; @@ -96,7 +97,7 @@ void main() highp float unnormalizeFactor = uBlendShapeUnnormalizeFactor[index]; #endif - diff = uBlendShapeWeight[index] * unnormalizeFactor * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); + diff = weight * unnormalizeFactor * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); } position.xyz += diff; @@ -111,9 +112,9 @@ void main() y = vertexId / width; // Retrieves the blend shape normal from the texture, unnormalizes it and multiply by the weight. - if( 0.0 != uBlendShapeWeight[index] ) + if(0.0 != weight) { - diff = uBlendShapeWeight[index] * 2.0 * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); + diff = weight * 2.0 * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); } normal += diff.xyz; @@ -128,9 +129,9 @@ void main() y = vertexId / width; // Retrieves the blend shape tangent from the texture, unnormalizes it and multiply by the weight. - if( 0.0 != uBlendShapeWeight[index] ) + if(0.0 != weight) { - diff = uBlendShapeWeight[index] * 2.0 * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); + diff = weight * 2.0 * ( texelFetch( sBlendShapeGeometry, ivec2(x, y), 0 ).xyz - 0.5 ); } tangent += diff.xyz; -- 2.7.4