16-825 Assignment 1 Rendering Basics with PyTorch3D

Everything here renders on CPU. I drive all of it from one script, run_all.py, which writes the vertex counts, point counts and timings into output/facts.json as it goes; this page reads that file, so the numbers below cannot drift away from the runs that produced them.

1.1 360-degree renders (5 pts)

Turntable of the cow mesh

1.2 Dolly zoom (10 pts)

The field of view sweeps 5°→120° while the camera distance follows d = W / (2·tan(fov/2)), holding the frustum width W constant so the cow stays the same size while the background rushes in.

Dolly zoom

2.1 Tetrahedron (5 pts)

A tetrahedron has 4 vertices and 4 triangular faces. Every face is already a triangle, so no subdivision is needed.

Tetrahedron turntable

2.2 Cube (5 pts)

A cube has 8 vertices and 12 triangular faces: the 6 square faces are each split into 2 triangles.

Cube turntable

3 Re-texturing a mesh (10 pts)

Color is interpolated along the z axis with alpha = (z - z_min)/(z_max - z_min), color = alpha·color2 + (1-alpha)·color1. I chose color1 = [0.0, 0.05, 0.85] (deep blue, at the front / z_min) and color2 = [1.0, 0.45, 0.0] (orange, at the back / z_max).

Front-to-back color gradient

4 Camera transformations (10 pts)

Instead of eyeballing which transform produces which target, I rendered every candidate against all four reference images and let the score decide. My first instrument was raw pixel MSE, and it does not work here. The four winning candidates score 0.03437 to 0.04195, but taking the 10 pairs of two different reference images and scoring those against each other gives 0.02698 to 0.09163. The floor of that range sits below my best match, so a pair of images with nothing in common can beat a correct answer. Almost all of the error is the lighting and shader difference between my renders and the provided jpgs, and it swamps the geometry.

Silhouette IoU ignores shading, so that is what the table below reports, and it needs the reference masks cleaned first. Each reference jpg has a 2-pixel black frame: the region common to all five reference masks is 2032 px, and 256² - 252² = 2032 exactly. Discarding all but the largest connected component is not enough, because in transform4 the cow sits close enough to the edge to touch the frame, and the two merge into a single component. That one merge was worth 7 pixels of centroid error and would have made a correct answer look wrong. Dropping a 3-pixel margin removes the frame everywhere.

The control is the identity transform scored against transform_none, a pair correct by construction. It reaches 0.9356, which is the ceiling, and the four answers below land at 0.9306 and up. Each wins its reference by a margin of at least 0.486 IoU, and all four land on different references, so the matching is a bijection rather than four independent guesses.

Rotation about the optical axis

R_relative
010
-100
001
T_relative
000

Pure rotation of the camera about its own optical (z) axis by 90 degrees. The camera stays where it is, so the cow is the same size and distance; only the image is turned on its side.

Matches transform1 · IoU 0.934 (100% of the control), ahead of the runner-up by 0.486

Translation along the view direction

R_relative
100
010
001
T_relative
002

Pure translation along the camera's viewing direction: the camera backs off by 2 units, so the cow keeps its pose but appears smaller.

Matches transform3 · IoU 0.932 (100% of the control), ahead of the runner-up by 0.717

Translation in the image plane

R_relative
100
010
001
T_relative
0.5-0.50

Pure translation in the image plane: the camera slides right and up, which shifts the cow left and down in frame without changing its size or pose.

Matches transform4 · IoU 0.931 (99% of the control), ahead of the runner-up by 0.767

Orbit a quarter turn and re-aim

R_relative
001
010
-100
T_relative
-303

The camera is moved a quarter turn around the cow and re-aimed at it, so we view the cow end-on. The rotation alone would swing the camera off target; the translation puts the cow back in the middle of the frame.

Matches transform2 · IoU 0.960 (103% of the control), ahead of the runner-up by 0.501

5.1 Point clouds from RGB-D images (10 pts)

Left: first image. Middle: second image. Right: the union. Point counts: 125035, 123749, 248784.

First / second / union

5.2 Parametric functions (10 + 5 pts)

Torus, sampled from ((R + r cosθ)cosφ, (R + r cosθ)sinφ, r sinθ) on a 200×200 grid.

Torus point cloud, with the hole visible
Extra credit: Mobius strip

5.3 Implicit surfaces (15 + 5 pts)

Torus as the zero level set of (√(x²+y²) - R)² + z² - r², evaluated on a 96³ voxel grid and meshed with marching cubes → 20256 vertices, 40512 faces.

Torus mesh from an implicit function
Extra credit: a genus-2 surface

For the extra credit I wanted the surface 2x(x²-3y²)(1-z²) + (x²+y²)² - (9z²-1)(1-z²), which is a standard example of a genus-2 surface. That is a claim about topology, not about what any single viewpoint shows, so I measured it rather than taking it on faith, and the first attempt failed the measurement. On a box of half-width 1.35, counting edges from the faces gave 504 boundary edges, meaning the mesh was open: my voxel box had quietly sliced the surface off, and χ = -5 for an open mesh says nothing at all. In the z = 0 plane the equation reduces to r⁴ + 2r³cos3θ + 1 = 0, whose widest solution is the real root of r⁴ - 2r³ + 1 = 0 other than 1, so the surface reaches r ≈ 1.839 and a box of half-width 1.35 was never going to hold it. Widening the box to 2.0 at the same voxel pitch closes the mesh, and only then is the genus well defined:

48,208 vertices, 96,420 faces, one connected component, 0 boundary edges, 0 non-manifold edges → χ = V - E + F = -2, so genus 2. The torus above, measured the same way, comes out at χ = 0 and genus 1, which is the control that says the counter itself is right.

Mesh vs point cloud: trade-offs

Mesh (implicit + marching cubes)Point cloud (parametric)
Rendering qualityWatertight surface with shading and occlusion; silhouettes are clean. Gaps unless sampled densely; no true surface, so lighting is flat and the far side bleeds through.
Memory20256 verts + 40512 faces, but the voxel grid (96³ ≈ 884,736 samples) is the real cost and it is transient. Only the points: 200×200 = 40,000 for the torus. Lighter to store, no connectivity.
SpeedGrid evaluation + marching cubes took 1.41s here; rendering 81.03s.No build step at all; rasterizing points is cheap.
Ease of useTopology comes free: the genus-2 shape above needs no special handling. Trivial to generate, but you must know a parameterization, which not every surface has.
ScalingCost grows with the cube of grid resolution, which bounds the detail you can afford. Cost grows with the number of samples only.

6 Something fun (extra credit, +10)

I wanted to use the sampler from Q7 for something other than a static point cloud, so this is the cow coming apart into its own surface samples and pulling itself back together: 45,000 points drawn with the Q7 area-weighted sampler, pushed outward from the centroid on a cosine schedule and tinted with the Q3 front-to-back palette.

Dissolving cow

7 Sampling points on meshes (extra credit, +10)

Faces are drawn with probability proportional to area, then a uniform barycentric coordinate is sampled on the chosen face. Left to right: the original mesh (2,930 verts / 5,856 faces), then 10, 100, 1000, 10000 sampled points.

Mesh, then 10 / 100 / 1000 / 10000 samples