Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // uniforms
- uniform mat4 inv_proj;
- uniform vec2 screen_resolution;
- uniform vec2 uv_scale = vec2(1.0, 1.0);
- // calculate world space
- vec2 screen_normalized = (gl_FragCoord.xy / screen_resolution) * 2.0 - 1.0;
- vec2 world_space = (inv_proj * vec4(screen_normalized, 0.0, 1.0)).xy;
- // sample texture
- vec3 color = texture(terrain_texture, world_space * uv_scale).rgb;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement