Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterFp.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: 690 bytes
Line 
1#version 100
2
3precision mediump int;
4precision mediump float;
5
6uniform sampler2D diffuseMap;
7
8varying vec4 oUv0;
9varying vec2 oDepth;
10
11//////////////////////// GRASS SHADOW CASTER
12void main()
13{       
14        float alpha = texture2D(diffuseMap, oUv0.xy).a;
15
16    // Do manual alpha rejection because it is not built into OpenGL ES 2
17    if (alpha < 0.588)
18    {
19        discard;
20    }
21
22        if (alpha > 0.001)
23    {
24       gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);
25    }
26    else
27    {
28        float finalDepth = oDepth.x / oDepth.y;
29        // just smear across all components
30        // therefore this one needs high individual channel precision
31        gl_FragColor = vec4(vec3(finalDepth), 1.0);
32    }
33}
Note: See TracBrowser for help on using the repository browser.