Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL120/BumpMapping/Example_BumpMappingFp.glsl @ 12115

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

Changed folder structure, deletet some unused files and cleaned up code

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