Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSL150/Example_BumpMappingFp.glsl @ 12083

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

Reorganised shader programs

File size: 592 bytes
Line 
1#version 150
2
3uniform vec4 lightDiffuse;
4uniform sampler2D normalMap;
5
6in vec4 oUv0;
7in vec3 oTSLightDir;
8
9out vec4 fragColour;
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(texture(normalMap, oUv0.xy).xyz);
26
27        // Calculate dot product
28        fragColour = lightDiffuse * dot(bumpVec, lightVec);
29}
Note: See TracBrowser for help on using the repository browser.