Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. float intersect(in vec3 ro, in vec3 rd)
  2. {
  3. return -ro.y / rd.y;
  4. }
  5.  
  6. void mainImage(out vec4 fragColor, in vec2 fragCoord)
  7. {
  8. vec2 uv = ((fragCoord + vec2(0.5)) / iResolution.xy * 2.0 - 1.0) * vec2(16.0 / 9.0, 1.0);
  9. vec3 ro = vec3(0.0, 1.0, 0.0);
  10. vec3 rd = normalize(vec3(uv, 2.0));
  11.  
  12. float t = intersect(ro, rd);
  13.  
  14. vec3 col = vec3(0.0, 0.0, 0.0);
  15.  
  16. if (t >= 0.0)
  17. {
  18. vec3 pos = ro + t * rd;
  19. vec2 tex = floor(pos.xz);
  20. col = vec3(mod(tex.x + tex.y, 2.0));
  21. }
  22.  
  23. fragColor = vec4(col, 1.0);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement