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
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# lab06-debugging
Team members: Leo Liang, Wayne Wu
[Shader Toy link](https://www.shadertoy.com/view/dsSGRt)

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

Let's practice debugging! We have a broken shader. It should produce output that looks like this:
[Unbelievably beautiful shader](https://user-images.githubusercontent.com/1758825/200729570-8e10a37a-345d-4aff-8eff-6baf54a32a40.webm)

It don't do that. Correct THREE of the FIVE bugs that are messing up the output. You are STRONGLY ENCOURAGED to work with a partner and pair program to force you to talk about your debugging thought process out loud.

Extra credit if you can find all FIVE bugs.

# Submission
- Create a pull request to this repository
- In the README, include the names of both your team members
- In the README, create a link to your shader toy solution with the bugs corrected
- In the README, describe each bug you found and include a sentence about HOW you found it.
- Make sure all three of your shadertoys are set to UNLISTED or PUBLIC (so we can see them!)
Bug:
1. `vec uv2 = 2.0 * uv - vec2(1.0);`
It's a syntax error and it won't compile with this.
Should be `vec2 uv2 = 2.0 * uv - vec2(1.0);`
2. `raycast(uv, dir, eye, ref);`
The camera looks off so there could be something wrong with the raycast.
So I found that uv2 is computed but uv is used instead. Should be `raycast(uv, dir, eye, ref);`
3. `H *= len * iResolution.x / iResolution.x;`
The aspect ratio still looks wrong after fixing the above bugs. By looking through the code I found iResolution.x/iResolution.x, which looks absolutely wrong.
It should be `H *= len * iResolution.x / iResolution.y;`
4. `dir = reflect(eye, nor);`
There is no reflection so something must be wrong. We figured out it's something wrong with how `dir` is computed but didn't figure out how to fix it properly. Adam taught us how to do it.
It should be `dir = reflect(dir, nor);`
5. Not sure if this is a bug but if we keep `i < 64` in `void march()`, there will be some artifacts on the floor.
It's technically not a bug because sometimes people just want smaller marching distance for better performance. If we increase it to `i < 128`, there will be no more artifacts on the floor.