Renderscript Teapot
Newell’s teapot is sort of the hello world of graphics weenies. I don’t really feel comfortable with a graphics library until I can draw the teapot with it. Here’s my first whack at it with Renderscript.
It still has a few issues. For example, that glitch at the top is the classic teapot nipple normal bug. There are a couple of ways to compute the normals, but my favorite is by computing the 2 first partial derivatives of the patch, and then taking their cross product. That works really well, except for at the very top and bottom of the teapot. At each of those points, there are 4 patches which each have a zero-length side. Along those edges, one of the partials is zero length. That means that the resulting normals a zero length. You can hack around it, but the best thing to do is to offset into the patch a little ways and recompute. I’ll add that next, but that’s close enough for tonight.
1 Response
[…] course I started with the same thing I always do (e.g. Renderscript, MATLAB, …), the […]