Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Updated programs and adjusted Material to work with GLSL>150

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