Create a Shadertoy account. Either fork this shadertoy, or create a new shadertoy and copy the code from the Debugging Puzzle.
Let's practice debugging! We have a broken shader. It should produce output that looks like this: Unbelievably beautiful shader
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.
- 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!)
-
Here is my lab 02 link, with explanations both as comments in the code and right below.
-
Bug 1: At line 97, there is a bug of compile error that should be using vec2 for uv2 but a typo of type uv.
- Reason Found: Compile error
-
Bug 2: At line 100, the code is using uv instead of modified version uv2. Changing back to uv2 make the center calculated correctly.
- Reason Found: Actually based on a random test. Since there was a compile error on uv2, I just randomly test here as uv2 seems to be unused after assigned, and then found that it work properly.
-
Bug 3: At line 11, the H calculation should be x divided by y, but x divided by x used here. Changing the denominator from x to y makes the image normal with proper format
- Reason Found: x divided by x is meaningless, so check typo by changing x to y that is also more logical.
-
Bug 4: At line 75, reflect direction calculated with wrong parameter. Instead of using position or origin of the path, the direction of the in path should be used as parameter to calculate the reflect direction here.
- Reason Found: Checking line by line and found equation mismatch.
-
Bug 5: At line 18, change the step from 64 to 256 to include more or all details
-
Reason Found: Test for better precision
(PS: I personally don't think that this is a bug, but just not enough precision which may be used for functionality test with lower performance, may just be used in testing version, but not final version)
-