| 1 |
#X3D V3.2 utf8 |
| 2 |
PROFILE Interchange |
| 3 |
|
| 4 |
# Adds on test_terrain.gltf simple effect that applies additional texture layers. |
| 5 |
|
| 6 |
Effect { |
| 7 |
initializeOnly SFNode texture_1 ImageTexture { |
| 8 |
url "textures/dirt%201.png" |
| 9 |
flipVertically TRUE # adjust to glTF texture coordinates |
| 10 |
} |
| 11 |
initializeOnly SFNode texture_2 ImageTexture { |
| 12 |
url "textures/paving%205.png" |
| 13 |
flipVertically TRUE # adjust to glTF texture coordinates |
| 14 |
} |
| 15 |
initializeOnly SFNode texture_3 ImageTexture { |
| 16 |
url "textures/paving%206.png" |
| 17 |
flipVertically TRUE # adjust to glTF texture coordinates |
| 18 |
} |
| 19 |
initializeOnly SFNode texture_with_alpha ImageTexture { |
| 20 |
url "textures/tex_alpha.png" |
| 21 |
flipVertically TRUE # adjust to glTF texture coordinates |
| 22 |
} |
| 23 |
parts [ |
| 24 |
EffectPart { |
| 25 |
type "FRAGMENT" |
| 26 |
url "data:text/plain, |
| 27 |
#ifndef GL_ES |
| 28 |
// avoid redeclaring castle_TexCoord0 when GLSL doesn't support separate compilation units |
| 29 |
varying vec4 castle_TexCoord0; |
| 30 |
#endif |
| 31 |
|
| 32 |
uniform sampler2D texture_1; |
| 33 |
uniform sampler2D texture_2; |
| 34 |
uniform sampler2D texture_3; |
| 35 |
uniform sampler2D texture_with_alpha; |
| 36 |
|
| 37 |
void PLUG_main_texture_apply(inout vec4 fragment_color, const in vec3 normal_eye) |
| 38 |
{ |
| 39 |
vec4 col_1 = texture2D(texture_1, castle_TexCoord0.xy * 2); |
| 40 |
fragment_color.rgb += col_1.rgb; |
| 41 |
|
| 42 |
vec4 col_2 = texture2D(texture_2, castle_TexCoord0.xy* 3); |
| 43 |
fragment_color.rgb += col_2.rgb; |
| 44 |
|
| 45 |
vec4 col_3 = texture2D(texture_3, castle_TexCoord0.xy * 5); |
| 46 |
fragment_color.rgb += col_3.rgb; |
| 47 |
|
| 48 |
vec4 col_with_alpha = texture2D(texture_with_alpha, castle_TexCoord0.xy * 0.33); |
| 49 |
fragment_color.rgb = mix(fragment_color.rgb, col_with_alpha.rgb, col_with_alpha.a); |
| 50 |
}" |
| 51 |
} |
| 52 |
] |
| 53 |
} |
| 54 |
|
| 55 |
Inline { url "test_terrain.gltf" } |