Created
May 2, 2017 22:05
-
-
Save nkint/66db01619e3a15b57e7b78ce9b1b85d4 to your computer and use it in GitHub Desktop.
Vertex shader with 4 texture (tiling satellite image)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform sampler2D satellite0; | |
uniform sampler2D satellite1; | |
uniform sampler2D satellite2; | |
uniform sampler2D satellite3; | |
uniform sampler2D elevation; | |
varying vec2 vUv; | |
void main() { | |
if (vUv.x <= 0.5 && vUv.y >= 0.5) { | |
vec2 mappedUv = vUv / 0.5 - vec2(0, 1.); | |
gl_FragColor = texture2D(satellite0, mappedUv); | |
} | |
if (vUv.x >= 0.5 && vUv.y >= 0.5) { | |
vec2 mappedUv = vUv / 0.5 - vec2(1., 1.); | |
gl_FragColor = texture2D(satellite1, mappedUv); | |
} | |
if (vUv.x >= 0.5 && vUv.y <= 0.5) { | |
vec2 mappedUv = vUv / 0.5 - vec2(1, 0.); | |
gl_FragColor = texture2D(satellite3, mappedUv); | |
} | |
if (vUv.x <= 0.5 && vUv.y <= 0.5) { | |
gl_FragColor = texture2D(satellite2, vUv / 0.5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment