16-825 Assignment 1: Rendering Basics with PyTorch3D

Yu-Rou Tuan (Andrew ID: yurout)

1. Practicing with Cameras

1.1 360-degree Renders

1.2 Re-creating the Dolly Zoom

Keeping the cow the same size means keeping the visible width constant: width / 2 = distance * tan(fov / 2), so distance = (width / 2) / tan(fov / 2) with width = 5.

2. Practicing with Meshes

2.1 Constructing a Tetrahedron

4 vertices and 4 triangle faces — each face leaves out one vertex.

2.2 Constructing a Cube

8 vertices and 12 triangle faces, two triangles per square side.

3. Re-texturing a mesh

I used color1 = [0.0, 0.0, 1.0] (blue) for the front of the cow (smallest z) and color2 = [1.0, 0.0, 0.0] (red) for the back of the cow (largest z), interpolated per vertex with alpha = (z - z_min) / (z_max - z_min).

4. Camera Transformations

PyTorch3D maps the world into the camera frame with X_cam = X_world @ R + T; in the image the camera +x points left and +y points up.

ResultR_relativeT_relativeWhat it does
[[ 0, 1, 0],
 [-1, 0, 0],
 [ 0, 0, 1]]
[0, 0, 0] Rotates the camera 90 degrees about its own viewing (z) axis. The camera does not move, so only the image is rolled.
identity [0, 0, 2] Moves the camera back along its viewing direction, from distance 3 to 5, so the cow looks smaller.
identity [0.5, -0.5, 0] Slides the camera in its own image plane, shifting the cow left and down.
[[ 0, 0, 1],
 [ 0, 1, 0],
 [-1, 0, 0]]
[-3, 0, 3] Rotates 90 degrees about the world up (y) axis to view the cow from the side. The translation puts the camera back at distance 3 after the rotation.

5. Rendering Generic 3D Representations

5.1 Rendering Point Clouds from RGB-D Images

First image, second image, and the union of the two:

5.2 Parametric Functions

The torus is sampled from x = (R + r cos(theta)) cos(phi), y = (R + r cos(theta)) sin(phi), z = r sin(theta) on a 200x200 grid of (phi, theta), with R = 1 and r = 0.4, colored by position. The hole lies along z, so it comes into full view twice per revolution.

For a new object, a wavy torus: the same parameterization with the ring radius oscillating, ring = R + 0.3 cos(3 phi), giving x = (ring + r cos(theta)) cos(phi), y = (ring + r cos(theta)) sin(phi), z = r sin(theta) with R = 1, r = 0.3. The cos(3 phi) term makes the three lobes.

5.3 Implicit Surfaces

The same torus as the zero level set of (sqrt(x^2 + y^2) - R)^2 + z^2 - r^2, with R = 1 and r = 0.4, evaluated on a 96^3 voxel grid and turned into a mesh with marching cubes.

Mesh vs. point cloud.

A new implicit object: the tanglecube, x^4 - 5x^2 + y^4 - 5y^2 + z^4 - 5z^2 + 11.8 = 0, on a 128^3 grid over [-3, 3]^3. It is genus 5, a rounded cube with a hole through each face.

6. (Extra Credit) Do Something Fun

A cow and its mirror image, joined hoof to hoof into a single mesh.

7. (Extra Credit) Sampling Points on Meshes

Original mesh on the left, sampled point cloud on the right.

10 points100 points
1000 points10000 points

At 10000 samples the cloud is nearly indistinguishable from the mesh; 10 or 100 points only hint at the shape.