16‑825 · Learning for 3D Vision · Assignment 1

Rendering Basics with PyTorch3D

Cameras, hand-built meshes, point clouds, and implicit surfaces. Every result below is a 360° turntable gif rather than a single still, since a moving view is what actually proves the geometry (and the camera math) is right.

Andrew ID farnazaa Renderer PyTorch3D 0.7.8 (CPU build) Base 90 pts Extra credit +20 pts

1 · Practicing with Cameras

360° renders & the dolly zoom

1.1 · 5 pts, 1.2 · 10 pts

A full turntable of the cow establishes the camera rig reused for every later section: look_at_view_transform(dist, elev, azim) swept over azimuth. The dolly zoom keeps the cow's apparent height constant while the focal length changes, by solving distance = half_height / tan(fov/2) from the mesh's own bounding box each frame, so only the ground plane behind it visibly warps.

360 degree turntable of the cow mesh
1.1 Cow, 36-frame turntable, dist 3, elev 0.
Dolly zoom effect on the cow on a plane
1.2 Dolly zoom: fov 5°→120°, distance solved per-frame so the cow's height stays fixed.

2 · Practicing with Meshes

Hand-built tetrahedron & cube

2.1 · 5 pts, 2.2 · 5 pts

Both shapes are defined purely by hand, using explicit vertex coordinates and triangle index lists, with the winding order of every face checked via the cross-product/right-hand-rule so HardPhongShader lights each one correctly (an inward-pointing normal looks wrong even though the triangle still renders).

360 degree turntable of a hand-built tetrahedron
Tetrahedron, built from 4 alternating corners of a cube: 4 vertices, 4 faces
360 degree turntable of a hand-built cube
Cube, using 2 triangles per square face: 8 vertices, 12 faces

3 · Re-texturing a Mesh

Front-to-back color gradient

10 pts

Per-vertex color is linearly interpolated along z: alpha = (z − z_min)/(z_max − z_min), blending from color1 at the front (min z) to color2 at the back (max z).

color1 = (0, 0, 1) blue, front color2 = (1, 0, 0) red, back
Cow mesh retextured with a blue-to-red gradient
Blue→red gradient, 360° turntable.

4 · Camera Transformations

Solving (R_relative, T_relative)

10 pts

Starting from the default camera (R₀ = I, T₀ = (0,0,3)), each target view is reproduced by a relative rotation/translation composed as R = R_relative @ R₀, T = R_relative @ T₀ + T_relative. Each one was solved by reasoning about the axis arrows in the target image, then confirmed by rendering and comparing pixel-for-pixel.

Transform 1: camera rolled 90 degrees
1 · Roll. The camera doesn't move at all. T stays exactly at the default (0,0,3). Only its orientation changes: it rotates 90° about its own line of sight, the axis pointing straight out of the lens toward the cow. That's exactly like tilting a photograph in-plane: nothing about depth or distance changes, so the cow appears to have fallen onto its side even though the camera is looking at the exact same view, just rotated.
R_rel=[[0,1,0],[-1,0,0],[0,0,1]] T_rel=(0,0,0)
Transform 2: camera orbited to the side
2 · Orbit. The camera genuinely moves through space this time: it swings 90° around the world's vertical (Y) axis, ending up beside the cow instead of in front of it, while staying the same 3 units away throughout. Because the rotation isn't identity, it also redirects where the default position (0,0,3) would have landed, so T_relative has to correct for that redirection on top of specifying the new camera position. That's why its value looks less clean than the other three.
R_rel=[[0,0,1],[0,1,0],[-1,0,0]] T_rel=(-3,0,3)
Transform 3: camera pushed back
3 · Push back. No rotation at all. The camera keeps looking at the cow from exactly the same angle. The only change is a translation straight back along the camera's own line of sight, increasing its distance from 3 units to 5. Since the field of view stays fixed while distance grows, the cow occupies a smaller fraction of the frame: the classic "zoom out," with no reorientation involved.
R_rel=I T_rel=(0,0,2)
Transform 4: camera slid sideways
4 · Slide. Also no rotation. The camera keeps the same orientation and distance; it just slides sideways along the world's X axis. Since the cow stays fixed at the origin, sliding the camera to one side makes the cow appear to shift the opposite way within the frame, the same effect as watching a stationary object glide past while looking out a moving car window.
R_rel=I T_rel=(0.5,0,0)

5 · Rendering Generic 3D Representations

Point clouds & implicit surfaces

5.1 · 10 pts, 5.2 · 10+5 pts, 5.3 · 15+5 pts

5.1 RGB-D point clouds

Two RGB-D captures of the same plant are unprojected into world space with unproject_depth_image, then rendered alone and as a merged union. The dataset's world coordinates treat −Y as "up" (opposite PyTorch3D's default), so the turntable camera's up vector is flipped to keep the plant right-side up.

Three plant point clouds side by side: image 1, image 2, and their union
Left→right: image 1 alone, image 2 alone, the union. The union fills gaps where either single view was occluded.

5.2 Parametric functions

A torus sampled directly from its parametric equation, colored by tube angle so the hole reads clearly at a tilted elevation. The bonus object reuses the same tube cross-section, swept along a helical path instead of closing into a loop.

360 degree turntable of a parametric torus point cloud
Torus point cloud (required)
360 degree turntable of a parametric spring point cloud
Spring / coil bonus

5.3 Implicit surfaces

Both are the zero level-set of F(x,y,z), discretized on a voxel grid and meshed with marching cubes. Torus: (√(x²+y²) − R)² + z² − r². The bonus object blends three implicit spheres with an inverse-square falloff ("metaballs") so their surfaces merge smoothly instead of intersecting.

360 degree turntable of an implicit torus mesh
Torus mesh (required)
360 degree turntable of a metaballs blob mesh
Metaballs blob bonus

Mesh vs. point cloud

Rendering quality: the mesh is watertight with real surface normals, so it shades smoothly and reads as solid from any distance; the point cloud is only ever a sampled approximation and thins out under zoom or at grazing angles. Speed & memory: marching cubes pays a fixed voxelization cost up front (64³ samples here) for one fixed mesh; a point cloud's cost scales directly with however many points you draw, cheaper for a quick preview but needing far more points to match the mesh's apparent density. Ease of use: a point cloud comes straight from sampling F (or a depth camera) with no reconstruction step; a mesh needs connectivity (marching cubes here) and is sensitive to voxel resolution. Too coarse, and thin features like the torus's tube can vanish between samples.

6 · Do Something Fun

A Menger sponge, grown from the cube

extra credit · 10 pts

The same cube mesh from Part 2.2 is recursively instanced: each round keeps the 20 corner-and-edge sub-cubes of a 3×3×3 split and discards the face-center and volume-center cubes, and every surviving sub-cube is merged into one Meshes object.

360 degree turntable of a Menger sponge fractal built from cubes
Menger sponge, level 2: 400 cubes, 3,200 vertices, 4,800 faces

7 · Sampling Points on Meshes

Area-weighted stratified sampling

extra credit · 10 pts

Each triangle is picked with probability proportional to its own area, then a point is placed at a uniformly random barycentric coordinate inside it. Sampling vertices directly would instead bias toward wherever the mesh happens to be tessellated finely.

Original cow mesh next to point clouds sampled at 10, 100, 1000, and 10000 points
Left to right: original mesh, then 10, 100, 1,000, 10,000 sampled points, converging on the mesh's own silhouette.