dog

Only here to post about CD-ROMs

I want!!
⬅️ this mark
🍷white
and Taste 🦆11
require

 

 

(Avatar by @texture, CD-ROM Journal button by @candiedreptile)


CD-ROM Journal
cdrom.ca/

quephird
@quephird

The first bug I had was that the function I used to generate the surface of revolution was wrong.I needed the square of the cubic spline function, x² + z² = g²(y). Not doing that resulted in surfaces that weren’t wide enough. Below is the rendering of a surface of revolution equivalent to a cylinder next to a native cylinder shape, and you can see that the left one doesn't have the correct radius:

So, that was an easy fix, and I made sure to write some tests to defend against that bug. But, that revealed another bug which caused problems at the tops and bottoms of surfaces of revolution. Namely, I wasn’t properly weeding out intersections that were above or below the object, and the result was that I never saw its interior even though the camera was well above it. You can see that in the picture above; the object on the left looks weird. Once I fixed that, I realized that my implementation for computing intersections with an implicit surface only returned at most one intersection. That was a conscious decision that I had previously made and thought there wouldn’t be any problems with that. Ooops.

So… I needed to fix that which involved modifying my code to continue advancing the ray after a hit. That was trickier than anticipated because I needed to track whether I was inside or outside the shape, and flip that flag whenever I encountered a new intersection.

Once that was fixed, then I could finally filter out intersections knowing that there were potentially multiple of them… and the result was much better but revealed another problem. You can see weirdness on the back of the surface of revolution, and can see through it:

And that problem was due to prematurely exiting the while loop that computes intersections; I needed to go just a little bit beyond the edge of the bounding box to make sure I didn’t omit potential intersections. And once I did that, EVERYTHING LOOKED AMAZINGGGGGGG 😻😻😻


You must log in to comment.

in reply to @quephird's post: