Skip to content

Commit c276b9c

Browse files
committed
Add new TerrainOverlay shader/material
Use this snippet in your VRML file: DEF coShaderTerrainOverlay_Transparency%0&6_DepthBump%$0&001 Transform { children [ # ... ] }
1 parent 8c09b65 commit c276b9c

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<TerrainOverlay transparent="true">
2+
3+
<uniform name="Transparency" type="float" value="0.5" />
4+
<uniform name="DepthBump" type="float" value="0.0" />
5+
<uniform name="diffuseMap" type="sampler2D" value="0" />
6+
7+
<vertexProgram>
8+
varying vec2 Texcoord;
9+
10+
void main( void )
11+
{
12+
Texcoord = gl_MultiTexCoord0.xy;
13+
gl_ClipVertex = gl_ModelViewMatrix*gl_Vertex;
14+
gl_Position = ftransform();
15+
}
16+
17+
</vertexProgram><fragmentProgram>
18+
19+
varying vec2 Texcoord;
20+
21+
uniform float Transparency;
22+
uniform float DepthBump;
23+
uniform sampler2D diffuseMap;
24+
25+
void main( void )
26+
{
27+
vec4 DiffuseColor = texture2D( diffuseMap, Texcoord );
28+
DiffuseColor.a = DiffuseColor.a * Transparency;
29+
30+
gl_FragColor = DiffuseColor;
31+
gl_FragDepth += DepthBump;
32+
}
33+
34+
</fragmentProgram>
35+
</TerrainOverlay>

0 commit comments

Comments
 (0)