KA Hearth

A small blog where Matthias posted thoughts on things happening around Khan Academy. (Archived) About Me

View the Project on GitHub

All 3D on KA is bad

I am very proud of the 3D effect I created for Terra Magma. It was much more flexible then what I ended up using it for, and in my opinion, looked a lot better than the other options at the time.

A fair number of people just use P3D for creating 3D graphics. While this works well, without glitches, it requires you to make everything 3D (pretty much), requires you to mess around with light and camera angles, and the result has a distinctive appearance that doesn’t look great—I think it’s the harsh corners. Additionally, it can be laggy compared to a custom implementation.

Peter Collingridge has a popular set of tutorials he made for KA on making 3D things, but these aren’t the best. They oversimplify, and lose linear perspective. If you look at the opposite sides of Collingridge’s cube, they are parallel, when an actual cube the sides don’t look parallel.

Phil helped me with Terra Magma’s graphics. They’re based on linear perspective alone. The drawback of this is that it makes rotating the camera near-impossible. Terra Magma is all viewed head-on.

Green Ghost’s contest entry here, is very impressive, but suffers from another issue; the order with which to display objects. It tries to calculate this, and does a good job most of the time, but you can see it glitch some times.
For Terra Magama, again, I had to display the left half of the blocks on the screen starting from the left and drawing to the right, and the right half of the screen starting from the right and drawing to the left. So that the blocks in the center get drawn last, from either side, and show up in front. Same goes for vertically. Even with that though, I had rules, like there can’t be blocks above lava (or other short blocks) in the top half of the screen, because the bottoms of these top blocks got drawn over the front of forward blocks.

I was extremely impressed with Pond Wars, the recent program by ReubenZ (StudioZ), because its 3D effect seemed to be perfect. I left a comment to the effect that this was the best 3D I had seen on KA, and I saw several comments from other people saying similar things. However, this program suffers from the same issue as Collingridge’s cube, that it doesn’t take into account the further half of objects being smaller than the front half. It just works on a small enough scale that the results of this aren’t noticeable. I had to go into his code and change the boat to a giant cube in order to convince myself his rending wasn’t perfect.