sugar
New Member
Posts: 2
|
Post by sugar on Aug 9, 2021 12:25:21 GMT
Hi, I'm stucking on chapter 7's putting it together. In the final nested loop, I have looped through camera's vsize and hsize, draw every point on the canvas, but I only got this. I don't know what was wrong. I thought it was because I didn't render the six sphere, but I don't know how to render the sphere. I'm using html + js, and I'm sure I passed the tests before. Thanks.
|
|
|
Post by Jamis on Aug 9, 2021 16:06:30 GMT
Hey sugar, welcome! I'm sorry to hear you've run into some difficulty. :/ If you can share your code somewhere, I can take a look. You might also try paring your scene down to just a single element and see if that renders. I wonder---from the odd little white sphere at the top-left---if your view transformation is not working correctly. Try defining the simplest scene you can (a single sphere, at the origin, perhaps) and see what that gives you.
|
|
sugar
New Member
Posts: 2
|
Post by sugar on Aug 10, 2021 14:17:25 GMT
Hey sugar , welcome! I'm sorry to hear you've run into some difficulty. :/ If you can share your code somewhere, I can take a look. You might also try paring your scene down to just a single element and see if that renders. I wonder---from the odd little white sphere at the top-left---if your view transformation is not working correctly. Try defining the simplest scene you can (a single sphere, at the origin, perhaps) and see what that gives you. Hi Jamis, Thanks very much for your advice---"Try define the simplest scene you can", finally I fixed it! The problem is, I was using html's canvas api, which needs a alpha for every color, I forgot to set a default value (should be 255) for the Color contructor, so everything became transparent. Another mistake was that I make the wrong world, I should use every object to construct the world (for my situation, an array), but I didn't. The debug processing was helpful, make the size smaller so I can see result fast, make just one scene so the ppm file is easier to observe. They are the skills that I can use in my daily work. Thanks Jamis.
|
|
|
Post by Jamis on Aug 10, 2021 14:47:05 GMT
Wonderful! I'm glad that was helpful.
|
|