From 21f98c549b06305ed847ac7fd57d5a65285cb8b3 Mon Sep 17 00:00:00 2001 From: Zixiao Wang <95837786+Lanbiubiu1@users.noreply.github.com> Date: Wed, 17 Sep 2025 11:49:14 -0400 Subject: [PATCH 1/2] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index fc7863a..6b54a91 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # lab02-debugging +[shadertoy](https://www.shadertoy.com/view/wcsBWf) + + +1. Line 101, vec uv2 = 2.0 * uv - vec2(1.0); uses an invalid type vec instead of vec2. This cause a compilation error since vec is not a valid GLSL type +2. Line 105, raycast(uv, dir, eye, ref); passes the [0,1] coordinates instead of the [-1,1] coordinates that were calculated in uv2. I saw that uv2 was calculated to convert from [0,1] to [-1,1] range, but then wasn't actually used. +3. Line 13, line H *= len * iResolution.x / iResolution.x; divides x by x, which equals 1, causing an incorrect aspect ratio. I noticed the division was x/x = 1 instead of x/y, which cause the image to appear stretched +4. Line 78, In the sdf3D function, dir = reflect(eye, nor); uses the eye position instead of the ray direction for reflection calculation. I recognized that the reflect() function expects an incident direction vector. +5. + # Setup Create a [Shadertoy account](https://www.shadertoy.com/). Either fork this shadertoy, or create a new shadertoy and copy the code from the [Debugging Puzzle](https://www.shadertoy.com/view/flGfRc). From 67bb42d6217b924b57c72dd70a385d08e2f679aa Mon Sep 17 00:00:00 2001 From: Zixiao Wang <95837786+Lanbiubiu1@users.noreply.github.com> Date: Wed, 17 Sep 2025 13:49:51 -0400 Subject: [PATCH 2/2] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b54a91..3fdd506 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ [shadertoy](https://www.shadertoy.com/view/wcsBWf) -1. Line 101, vec uv2 = 2.0 * uv - vec2(1.0); uses an invalid type vec instead of vec2. This cause a compilation error since vec is not a valid GLSL type -2. Line 105, raycast(uv, dir, eye, ref); passes the [0,1] coordinates instead of the [-1,1] coordinates that were calculated in uv2. I saw that uv2 was calculated to convert from [0,1] to [-1,1] range, but then wasn't actually used. +1. Line 102, vec uv2 = 2.0 * uv - vec2(1.0); uses an invalid type vec instead of vec2. This cause a compilation error since vec is not a valid GLSL type +2. Line 106, raycast(uv, dir, eye, ref); passes the [0,1] coordinates instead of the [-1,1] coordinates that were calculated in uv2. I saw that uv2 was calculated to convert from [0,1] to [-1,1] range, but then wasn't actually used. 3. Line 13, line H *= len * iResolution.x / iResolution.x; divides x by x, which equals 1, causing an incorrect aspect ratio. I noticed the division was x/x = 1 instead of x/y, which cause the image to appear stretched -4. Line 78, In the sdf3D function, dir = reflect(eye, nor); uses the eye position instead of the ray direction for reflection calculation. I recognized that the reflect() function expects an incident direction vector. -5. +4. Line 79, In the sdf3D function, dir = reflect(eye, nor); uses the eye position instead of the ray direction for reflection calculation. I recognized that the reflect() function expects an incident direction vector. +5. Line 21, we need more iterations to find hits. # Setup