Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# lab02-debugging

# Submission
Collaborators: Didn't directly collaborate with anyone, but overheard lots of what Nico's and Lillian's thinking out loud as well as Rui's conversation with Rebecca about reflection.
Solution: https://www.shadertoy.com/view/wflBDf
Bugs:
- Line 97 where uv2 is created, the type was declared as vec but should be vec2. This was easy to find because Shadertoy was throwing a syntax error.
- Line 100 where raycast() is called should be passed the uv2 variable instead of uv because we want the range of pixel coordinates to be in [-1, 1] instead of [0, 1]. I noticed after fixing the first bug that the screen was stretched horizontally, so I figured that the bug would be somewhere in the raycast definitions of H and V.
- Line 11 where H is being updated had length being multiplied by (iResolution.x / iResolution.x) aka 1, so I changed the denominator to be iResolution.y in order to fix the stretching effect in the horizontal direction.
- Line 18 where the raymarching loop is defined, the number of iterations is too small so I increased it to 256 from 64 in order to march far enough to hit all areas of the floor as is shown in the video. The floor being warped and not expanding far enough was one of the first things that I noticed and I figured it would be in the raymarch function.
- Line 75 where dir is updated to be reflect(eye, nor) is incorrect because to get a reflection we need the direction of the camera ray (not the location of the camera) and the normal of the object so if we instead call reflect(dir, nor) to update dir we get the correct reflection. This was also an obvious issue of the program from the start, but harder to find within the functions because of how many functions and lines there are related to the material, reflection, specular reflection, etc.

# 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).
Expand Down