-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheffect_track.frag
32 lines (26 loc) · 1.25 KB
/
effect_track.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
///////////////////////////////////////////////////////
//*-------------------------------------------------*//
//| Part of Project One (https://www.maus-games.at) |//
//*-------------------------------------------------*//
//| Copyright (c) 2010 Martin Mauersics |//
//| Released under the zlib License |//
//*-------------------------------------------------*//
///////////////////////////////////////////////////////
void FragmentMain()
{
//
vec4 v4Texture = coreTexture2D(0, v_av2TexCoord[0]);
// calculate dot-3 bump factor
vec3 v3MathLightDir = normalize(v_av4LightDir[0].xyz);
vec3 v3BumpNormal = normalize(v4Texture.xyz * 2.0 - 1.0);
float v1BumpFactor = dot(v3MathLightDir, v3BumpNormal);
// calculate dot-3 reflection factor
vec3 v3MathViewDir = normalize(v_v3ViewDir);
vec3 v3ReflNormal = normalize(v3MathLightDir + v3MathViewDir);
float v1ReflFactor = max(dot(v3ReflNormal, v3BumpNormal), 0.0);
// calculate diffuse and specular value
vec3 v3Diffuse = vec3(v4Texture.a * max(v1BumpFactor * 1.2 + 0.6, 0.0));
vec3 v3Specular = vec3(0.1 * min(coreGGX(v1ReflFactor, 0.09), 1.0));
// draw final color
gl_FragColor = vec4((v3Diffuse + v3Specular) * u_v4Color.rgb, 1.0);
}