16-825 Assignment 1: Rendering Basics

My results for the rendering assignment, using PyTorch3D.

1. Practicing with Cameras

1.1. 360-degree Renders

I changed the camera azimuth over a full circle, keeping the distance and elevation fixed.

360-degree cow turntable
Cow viewed from different sides.

1.2. Dolly Zoom

I increased the field of view from 5° to 120° and moved the camera closer at the same time. The distance is proportional to 1 / tan(fov / 2). This keeps the scale fixed at the center plane, although the cow's head still changes shape because it has depth.

Dolly zoom with a cow on a checkerboard
The checkerboard makes the perspective change easier to see.

2. Practicing with Meshes

2.1. Tetrahedron

The tetrahedron has 4 vertices and 4 triangular faces. I used four alternating corners of a cube and connected them with outward-facing triangles.

360-degree tetrahedron turntable

2.2. Cube

The cube has 8 vertices and 12 triangular faces. Each square side is split into two triangles.

360-degree cube turntable

3. Re-texturing a Mesh

I used blue color1 = [0, 0, 1] at the front (z_min) and red color2 = [1, 0, 0] at the back (z_max). The color depends on each vertex's z-coordinate, so the middle becomes purple.

alpha = (z - z_min) / (z_max - z_min)
color = alpha * color2 + (1 - alpha) * color1
Cow with a blue-to-red gradient rotating through 360 degrees

4. Camera Transformations

I used the composition in the starter code, with R_0 = I and T_0 = [0, 0, 3]:

R = R_relative @ R_0
T = R_relative @ T_0 + T_relative

The results below follow the order in the README: 1, 3, 4, 2. PyTorch3D applies rotation to row vectors; positive view-space x points left and positive y points up.

Target 1

Cow rolled 90 degrees clockwise
R_relative = [[ 0, 1, 0],
              [-1, 0, 0],
              [ 0, 0, 1]]
T_relative = [0, 0, 0]

This rolls the image 90° clockwise. The cow's head points right. No translation is needed, and the final T stays at [0, 0, 3].

Target 3

Smaller cow after moving the camera farther away
R_relative = [[1, 0, 0],
              [0, 1, 0],
              [0, 0, 1]]
T_relative = [0, 0, 2]

I kept the rotation unchanged and added 2 to the z-translation. The camera distance becomes 5, so the cow looks smaller.

Target 4

Cow shifted left and down
R_relative = [[1, 0, 0],
              [0, 1, 0],
              [0, 0, 1]]
T_relative = [0.5, -0.5, 0]

The rotation stays the same. Positive x shifts the cow left in the image, and negative y shifts it down. Its z-depth is unchanged.

Target 2

Side view of the cow facing left
R_relative = [[ 0, 0, 1],
              [ 0, 1, 0],
              [-1, 0, 0]]
T_relative = [-3, 0, 3]

The 90° rotation about y gives a side view. Rotating T_0 gives [3, 0, 0], so I add [-3, 0, 3] to get the final T back to [0, 0, 3]. Without this correction, the cow would not stay centered.

5. Rendering Generic 3D Representations

5.1. Point Clouds from RGB-D Images

I used unproject_depth_image with each image's camera, depth, and mask, then concatenated the two clouds in world coordinates. To keep CPU rendering manageable, I kept every 32nd valid point from each view. All three panels use the same camera path, with camera up set to -y so the plant appears upright.

Side-by-side rotating RGB-D point clouds: image 1, image 2, and their union
Image 1 / Image 2 / Union.

The union fills in some areas that only one camera sees. It still has gaps: combining two views cannot recover surfaces that neither image captured.

5.2. Parametric Functions

For the torus I used major radius R = 0.75 and tube radius r = 0.25. I sampled an 80 × 80 grid of angles. The camera is elevated 30° so the hole is visible.

x = (R + r cos(v)) cos(u)
y = r sin(v)
z = (R + r cos(v)) sin(u)
u, v in [0, 2π)

For the additional object, I made a Möbius strip. The half-angle terms give the strip its twist. Here u runs around the ring and v runs across the strip, from -0.3 to 0.3.

x = (0.8 + v cos(u/2)) cos(u)
y = v sin(u/2)
z = (0.8 + v cos(u/2)) sin(u)
360-degree torus point cloud with its hole visible
Torus point cloud.
360-degree point cloud of a twisted Mobius strip
Extra object: Möbius strip.

Both use colors based on normalized x, y, and z coordinates.

5.3. Implicit Surfaces

I used the same torus dimensions, but evaluated this function on a 64 × 64 × 64 grid over [-1.5, 1.5]³. Marching cubes extracts the zero level set.

F(x, y, z) = (sqrt(x² + z²) - 0.75)² + y² - 0.25²

The additional mesh is a simple snowman made from three overlapping spheres. Their centers are (0, -0.55, 0), (0, 0.2, 0), and (0, 0.8, 0), with radii 0.65, 0.5, and 0.35. Taking the minimum of the three sphere functions gives their union.

F_i(p) = ||p - center_i||² - radius_i²
F_snowman(p) = min(F_1(p), F_2(p), F_3(p))
360-degree implicit torus mesh with its hole visible
Torus mesh.
360-degree implicit snowman made from three joined spheres
Extra object: snowman.

Mesh vs. point cloud: A mesh gives a continuous surface and supports surface shading. With points, the result depends more on point density and the drawing radius: a small radius leaves holes, while a large radius can hide details. Point clouds are easier to get directly from RGB-D data because no face connections are needed.

Point clouds skip the marching-cubes step, but lots of points can still be slow to rasterize. Meshes have a surface-extraction cost first, then store both vertices and triangle indices. Neither is always smaller or faster; it depends on the sampling density and mesh resolution. For this torus, the cloud has 6,400 points and the mesh has 4,608 vertices plus 9,216 faces. The implicit method also needs a voxel grid during construction, whose memory grows cubically with resolution.

6. Do Something Fun (Extra Credit)

I made a Saturn cow: the cow is in the middle of a tilted golden ring, with three small colored moons around it. The ring is a thin torus rotated 25°, and the moons are scaled and translated spheres. The animation moves the camera around the whole scene.

360-degree scene of a cow surrounded by a tilted golden ring and three colored moons
Saturn cow.

7. Sampling Points on Meshes (Extra Credit)

I first choose a triangle with probability proportional to its area. Then I draw two uniform random numbers and use square-root barycentric sampling to get a point inside that triangle:

area = 0.5 * ||(v1 - v0) × (v2 - v0)||
P(face) = area / sum(all face areas)
u, v ~ Uniform(0, 1)
w0 = 1 - sqrt(u)
w1 = sqrt(u) * (1 - v)
w2 = sqrt(u) * v
point = w0*v0 + w1*v1 + w2*v2

The square root makes samples uniform over triangle area. Simply normalizing three uniform random numbers would not do that. I used seed 825 and kept the camera and point radius the same for all four sample counts.

Side-by-side rotating cow reconstructions with 10, 100, 1000, and 10000 sampled points, followed by the original mesh
10 / 100 / 1,000 / 10,000 points / original mesh. Click to view at full size.

Ten points are too sparse to show much of the cow. Increasing the count makes the outline and body easier to recognize. At 10,000 points the shape is much more complete, although the point rendering still differs from a shaded triangle mesh.