Make Scene3D controls also applied actor color 94/284494/5
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 18 Nov 2022 05:43:36 +0000 (14:43 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Fri, 25 Nov 2022 09:51:52 +0000 (09:51 +0000)
Let we make PBR shader use our world color system.

TODO : We should change DepthWrite & AlphaBlend properties on coreside.
Since the model might has 32bit image as texture, we cannot make
DepthWrite / BlendMode as AUTO.

Change-Id: I89c3ce4d144150cac72e01eadbc86c2f4eb5f8d3
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-scene3d/internal/graphics/shaders/default-physically-based-shader.frag
dali-scene3d/internal/graphics/shaders/scene3d-joint-debug.frag
dali-scene3d/internal/graphics/shaders/skybox-shader.frag

index a55e9c3..ee7eeff 100644 (file)
@@ -33,7 +33,8 @@ precision mediump float;
 #endif //GLTF_CHANNELS
 #endif //THREE_TEX
 
-uniform lowp vec4 uColorFactor;
+uniform lowp vec4 uColor; // Color from SceneGraph
+uniform lowp vec4 uColorFactor; // Color from material
 uniform lowp float uMetallicFactor;
 uniform lowp float uRoughnessFactor;
 
@@ -221,5 +222,5 @@ void main()
   color += emissive;
 #endif // EMISSIVE
 
-  FragColor = vec4(pow(color, vec3(1.0 / 2.2)), baseColor.a);
+  FragColor = vec4(pow(color, vec3(1.0 / 2.2)), baseColor.a) * uColor;
 }
index a1153c9..633e91c 100644 (file)
@@ -1,11 +1,12 @@
 #version 300 es
 
 precision mediump float;
+uniform lowp vec4 uColor;
 flat in float vColor;
 out vec4 FragColor;
 
 void main()
 {
   vec3 rgb = vec3(fract(vColor), fract(vColor * 0.00390625), fract(vColor * 0.00390625 * 0.00390625));
-  FragColor = vec4(rgb, 1.);
+  FragColor = vec4(rgb, 1.) * uColor;
 }
\ No newline at end of file
index 2a6024d..7bf6e42 100644 (file)
@@ -1,9 +1,10 @@
 uniform samplerCube   uSkyBoxTexture;
+uniform lowp    vec4  uColor;
 uniform mediump float uIntensity;
 varying mediump vec3  vTexCoord;
 
 void main()
 {
   mediump vec4 texColor = textureCube(uSkyBoxTexture, vTexCoord) * uIntensity;
-  gl_FragColor = texColor;
+  gl_FragColor = texColor * uColor;
 }
\ No newline at end of file