al12
New Member
Posts: 1
|
Post by al12 on Jun 17, 2022 20:03:19 GMT
Hello, First of all, thanks for writing this book! I've been interested in 3d rendering for a while and following along with the chapters really made me understand the process more intimately. I have an issue with the "putting it together" scene from chapter 7. All of my unit tests pass, but there are some visual artifacts present in the render. The leftmost sphere does not show up in the scene, the walls have weird intersections (see the intersection between the floor and the walls), and the rightmost sphere seems like part of it is chopped off. Also, the wall to wall intersection seems to prioritize the leftmost wall (it seems to be curved when compared to the sample scene). My first intuition was that the problem was with the sphere/intersection order, but for both I wrote compareTo() methods that order based on distance. I was wondering whether anyone had similar issues or any ideas on where to find the source of the errors. Thanks in advance! My rendered scene: The book's scene:
|
|
|
Post by Jamis on Jun 17, 2022 20:08:02 GMT
There may be a few different issues at play, here. At a guess, I wonder if your walls are not being transformed quite like you expect? As for the missing yellow sphere, I'd recommend removing everything from the scene except that sphere and seeing what happens. Maybe it's been translated below the floor, or behind a wall somehow... Or even behind the camera!
As I posted recently in another thread, when facing things like this, I'll simplify the scene to its bare essentials, and then pick one pixel from the output that I believe is wrong. Then, I'll step through the program (either using a debugger, or using print statements) while it processes just that one pixel, checking my work as I go. Look at the objects and where they exist relative to the camera. Make sure transformation matrices are correct. It can be tedious work! I had to do this more than once while writing the book.
|
|