How did it get converted into 1 line of code from 3 lines? Remapping uv and fixing aspect ratio in shaders
How would you get from this vec2 uv = fragCoord/iResolution.xy; // <0, 1> uv -= 0.5; // <-0.5,0.5> uv.x *= iResolution.x/iResolution.y; // fix aspect ratio to this? vec2 uv = (fragCoord - .5 * iResolution.xy) / iResolution.y; // Condense 3 lines down to a single line! Well, I tried breaking it down into components ((fragCoord.x-0.5) / iResolution.x) * (iResolution.x / iResolution.y) ((fragCoord.y-0.5) / iResolution.y)
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.