Forget to update grass pass 2 sun location
This commit is contained in:
parent
edd11e3fd2
commit
84cf087ae6
@ -8,8 +8,6 @@ uniform sampler2D dtex;
|
|||||||
uniform sampler2D SpecMap;
|
uniform sampler2D SpecMap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform vec3 SunDir;
|
|
||||||
|
|
||||||
in vec3 nor;
|
in vec3 nor;
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
@ -35,10 +33,11 @@ void main(void)
|
|||||||
vec3 eyedir = normalize(xpos.xyz);
|
vec3 eyedir = normalize(xpos.xyz);
|
||||||
|
|
||||||
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
|
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
|
||||||
float fEdotL = clamp(dot(SunDir, eyedir), 0., 1.);
|
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
|
||||||
|
float fEdotL = clamp(dot(L, eyedir), 0., 1.);
|
||||||
float fPowEdotL = pow(fEdotL, 4.);
|
float fPowEdotL = pow(fEdotL, 4.);
|
||||||
|
|
||||||
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
|
float fLdotNBack = max(0., - dot(nor, L) * 0.6 + 0.4);
|
||||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||||
float specmap = texture(SpecMap, uv).g;
|
float specmap = texture(SpecMap, uv).g;
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ uniform sampler2D SpecMap;
|
|||||||
uniform sampler2D dtex;
|
uniform sampler2D dtex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform vec3 SunDir;
|
|
||||||
|
|
||||||
#ifdef GL_ARB_bindless_texture
|
#ifdef GL_ARB_bindless_texture
|
||||||
flat in sampler2D handle;
|
flat in sampler2D handle;
|
||||||
flat in sampler2D secondhandle;
|
flat in sampler2D secondhandle;
|
||||||
@ -41,10 +39,11 @@ void main(void)
|
|||||||
vec3 eyedir = normalize(xpos.xyz);
|
vec3 eyedir = normalize(xpos.xyz);
|
||||||
|
|
||||||
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
|
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
|
||||||
float fEdotL = clamp(dot(SunDir, eyedir), 0., 1.);
|
vec3 L = normalize((transpose(InverseViewMatrix) * vec4(sun_direction, 0.)).xyz);
|
||||||
|
float fEdotL = clamp(dot(L, eyedir), 0., 1.);
|
||||||
float fPowEdotL = pow(fEdotL, 4.);
|
float fPowEdotL = pow(fEdotL, 4.);
|
||||||
|
|
||||||
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
|
float fLdotNBack = max(0., - dot(nor, L) * 0.6 + 0.4);
|
||||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user