Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float intersect(in vec3 ro, in vec3 rd)
- {
- return -ro.y / rd.y;
- }
- void mainImage(out vec4 fragColor, in vec2 fragCoord)
- {
- vec2 uv = ((fragCoord + vec2(0.5)) / iResolution.xy * 2.0 - 1.0) * vec2(16.0 / 9.0, 1.0);
- vec3 ro = vec3(0.0, 1.0, 0.0);
- vec3 rd = normalize(vec3(uv, 2.0));
- float t = intersect(ro, rd);
- vec3 col = vec3(0.0, 0.0, 0.0);
- if (t >= 0.0)
- {
- vec3 pos = ro + t * rd;
- vec2 tex = floor(pos.xz);
- col = vec3(mod(tex.x + tex.y, 2.0));
- }
- fragColor = vec4(col, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement