Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvFp.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 6 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 760 bytes
Line 
1#version 100
2precision mediump int;
3precision mediump float;
4
5// General functions
6
7// Expand a range-compressed vector
8vec3 expand(vec3 v)
9{
10        return (v - 0.5) * 2.0;
11}
12
13uniform sampler2D shadowMap;
14uniform sampler2D normalMap;
15uniform vec4 lightDiffuse;
16
17varying vec4 uvproj;
18varying vec4 oUv0;
19varying vec3 oTSLightDir;
20
21void main()
22{
23        // retrieve normalised light vector, expand from range-compressed
24        vec3 lightVec = expand(normalize(oTSLightDir).xyz);
25
26        // get bump map vector, again expand from range-compressed
27        vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz);
28
29        // get shadow value
30        vec3 shadow = texture2DProj(shadowMap, uvproj).xyz;
31
32        // Calculate dot product
33        gl_FragColor = vec4(shadow * lightDiffuse.xyz * dot(bumpVec, lightVec), 1.0);
34}
Note: See TracBrowser for help on using the repository browser.