Assignment 1: Rendering Basics with PyTorch3D

16-825 Learning for 3D Vision

Question 0: Setup & First Render

0.1 Rendering First Mesh

Successfully rendered the cow mesh using PyTorch3D with basic lighting and camera setup.

Cow Mesh Render

Question 1: Practicing with Cameras (15 Points)

1.1 360-degree Renders (5 points)

Created a 360-degree turntable animation of the cow mesh using the look_at_view_transform function.

360 Degree Cow
Implementation Details:
  • 100 frames for smooth rotation
  • Distance: 2.7, Elevation: 30-degrees
  • Blue-tinted texture ([0.2, 0.5, 1.0])

1.2 Dolly Zoom Effect (10 points)

Recreated the dolly zoom effect by adjusting camera distance and FOV simultaneously.

Dolly Zoom Effect
Implementation Details:
  • FOV ranges from 5 to 120
  • Camera distance formula: z = -fov/47 + 3

Question 2: Practicing with Meshes (10 Points)

2.1 Constructing a Tetrahedron (5 points)

Manually constructed a tetrahedron mesh with vertices and faces.

Tetrahedron

There are 4 vertices and 4 faces to the tetrahedron.

2.2 Constructing a Cube (5 points)

Constructed a cube mesh using triangular faces.

Cube

There are 8 vertices and 12 faces to the cube.

Question 3: Re-texturing a Mesh (10 Points)

Gradient Texture Based on Z-coordinate

Applied a gradient texture that smoothly transitions from front to back of the cow.

Re-textured Cow

Color Choices: I choose color 1 to be [0, 0.5, 1] and color 2 to be [1, 0.5, 0]. This creates a gradient from blue to orange.

alpha = (z - z_min) / (z_max - z_min) color = alpha * color2 + (1 - alpha) * color1

Question 4: Camera Transformations (10 Points)

Relative Camera Transformations

Applied different rotation and translation transformations to achieve specific viewpoints.

Transform 1

Transform 1: Rotation Z

R = [[0,-1,0],[-1,0,0],[0,0,1]] T = [0,0,0]
Transform 2

Transform 2: Rotation Y + Translation

R = [[0,0,1],[0,1,0],[-1,0,0]] T = [-3,0,3]
Transform 3

Transform 3: Translation Z

R = [[1,0,0],[0,1,0],[0,0,1]] T = [0,0,1]
Transform 4

Transform 4: Combined Translation

R = [[1,0,0],[0,1,0],[0,0,1]] T = [0.5,-0.75,-0.5]

R_relative is a Rotation matrix providing a rotation on the cameras coordinate frame. While T_Relative is a translation matrix translating the cameras coordinate frame in space. By adjusting these two we can create any type of transformation we want.

Question 5: Rendering Generic 3D Representations (45 Points)

5.1 Rendering Point Clouds from RGB-D Images (10 points)

Constructed point clouds from RGB-D images using depth unprojection.

Point Cloud 1

Point Cloud from Image 1

Point Cloud 2

Point Cloud from Image 2

Combined Point Cloud

Combined Point Cloud

5.2 Parametric Functions (15 points)

Rendered 3D shapes using parametric equations.

Parametric Torus

Torus (Parametric)

Parametric Mobius

Klein Bottle (Parametric)

Torus Parameters:
  • Major radius R = 3
  • Minor radius r = 1
  • 200x200 sampling grid

5.3 Implicit Surfaces (20 points)

Rendered 3D shapes using implicit functions and marching cubes.

Implicit Torus

Torus (Implicit)

Implicit Ellipsoid

Ellipsoid (Implicit)

Discussion: Tradeoffs between Mesh vs Point Cloud Rendering

Rendering as a Mesh has a much faster render speed than rendering a point cloud. We also get complete shapes without holes. Point cloud rendering take much longer and have holes where information is missing, but they give a much more accurate viewing of the object where information is present and have the ability to easily map the texture and color of the object to the render. As you scale mesh based volumetric rendering up, the memory usage increases highly, while point cloud memory usage scales better. The point clouds are easier to use and render as you don't need to define the function for the shape and just need to take the depth data and render it.

Question 6: Do Something Fun (10 Points)

Angel Emoji - Combining Implicit Functions

Created an angel emoji by combining a sphere (head) and torus (halo) using implicit function union.

Angel Emoji
Implementation:
  • Sphere for head (radius = 2.0)
  • Torus for halo (R = 2, r = 0.5, shifted upward)
  • Combined using min() operation (CSG union)
  • Gold color for halo, skin tone for head

Extra Credit: Sampling Points on Meshes (10 Points)

Stratified Surface Sampling

Implemented stratified sampling to generate point clouds from the cow mesh with varying densities.

10 Points

10 Points

100 Points

100 Points

1000 Points

1,000 Points

10000 Points

10,000 Points

Original Mesh

Original Mesh

Algorithm:
  1. Calculate face areas for probability distribution
  2. Sample faces proportional to area
  3. Generate uniform barycentric coordinates using sqrt transformation
  4. Convert barycentric to 3D points on selected faces