Skip to content

Lab 2 - Debugging! - Nadine Adnane #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# lab06-debugging

# Setup
Teammates: I worked alone for this lab!

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).
ShaderToy Link: https://www.shadertoy.com/view/cscczj

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)
- Bug #1: There was a compilation error because on line 97, uv2 was declared as a vec when it needed to be a vec2! After changing uv2 to a vec2, the shader compiled.

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.
- Bug #2: Now that I had something on the screen, it looked like something was off with the camera, so I looked at the raycast() function. On line 11, the H value was set to * iResolution.x / iResolution.x instead of * iResolution.x / iResolution.y! Correcting the denominator fixed the stretched camera issue.

Extra credit if you can find all FIVE bugs.
- Bug #3: It still looks like there is an issue with the camera, as the spheres are not really centered in view. The raycast function seemed ok, so I looked at mainImage() where it was being called. On line 100, the uv vector was passed-in instead of the uv2 vector! Now the scene is centered properly in our view.

# 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 #4: The next big issue is that the specular reflections are missing, so I took a look at the sdf3D function, and knew it had to be at/after line 74 because of the comment. On line 75, the reflect() function was being called with eye instead of the direction vector, so once I changed eye to dir, the reflections came back! :D


- Bug #5: I know something is still wrong with the edges of the sphere, but I'll submit this for now and come back if I have time :)