ModelView using scene-loader
[platform/core/uifw/dali-toolkit.git] / dali-scene-loader / internal / graphics / shaders / default-physically-based-shader.frag
index 8f927f5..a55e9c3 100644 (file)
@@ -1,3 +1,5 @@
+#version 300 es
+
 // Original Code
 // https://github.com/KhronosGroup/glTF-Sample-Viewer/blob/glTF-WebGL-PBR/shaders/pbr-frag.glsl
 // Commit dc84b5e374fb3d23153d2248a338ef88173f9eb6
@@ -15,8 +17,6 @@
 // [4] \"An Inexpensive BRDF Model for Physically based Rendering\" by Christophe Schlick
 //     https://www.cs.virginia.edu/~jdl/bib/appearance/analytic%20models/schlick94b.pdf
 
-#version 300 es
-
 #ifdef HIGHP
 precision highp float;
 #else
@@ -64,10 +64,11 @@ uniform vec3 uEmissiveFactor;
 #endif
 
 //// For IBL
+uniform sampler2D sbrdfLUT;
 uniform samplerCube sDiffuseEnvSampler;
 uniform samplerCube sSpecularEnvSampler;
-uniform sampler2D sbrdfLUT;
 uniform float uIblIntensity;
+uniform vec3 uYDirection;
 
 // For Alpha Mode.
 uniform lowp float uOpaque;
@@ -201,8 +202,8 @@ void main()
   mediump vec3 reflection = -normalize(reflect(v, n));
 
   lowp vec3 color = vec3(0.0);
-  lowp vec3 diffuseLight = linear(texture(sDiffuseEnvSampler, n).rgb);
-  lowp vec3 specularLight = linear(texture(sSpecularEnvSampler, reflection).rgb);
+  lowp vec3 diffuseLight = linear(texture(sDiffuseEnvSampler, n * uYDirection).rgb);
+  lowp vec3 specularLight = linear(texture(sSpecularEnvSampler, reflection * uYDirection).rgb);
   // retrieve a scale and bias to F0. See [1], Figure 3
   lowp vec3 brdf = linear(texture(sbrdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb);