Learning for 3D Vision [16889] - Assignment 1

NAME: Shefali Srivastava

ANDREW ID: shefalis

Instructions:

Change to folder solutions to run the below mentioned commands.

1. Practicing with Cameras

1.1. 360-degree Renders (5 points)

On your webpage, you should include a gif that shows the cow mesh from many continously changing viewpoints.

python main.py --question "q11" --input-path "../data/cow.obj" --output-path "../output_final/q11.gif"

Question 1.1

1.2 Re-creating the Dolly Zoom (10 points)

On your webpage, include a gif with your dolly zoom effect.

python main.py --question "q12" --input-path "../data/cow_on_plane.obj" --output-path "../output_final/q12.gif"

Question 1.2

2. Practicing with Meshes

2.1 Constructing a Tetrahedron (5 points)

On your webpage, show a 360-degree gif animation of your tetrahedron. Also, list how many vertices and (triangle) faces your mesh should have.

python main.py --question "q21" --output-path "../output_final/q21.gif"

Number of Faces = 4, Number of Vertices = 4

Question 2.1

2.2 Constructing a Cube (5 points)

On your webpage, show a 360-degree gif animation of your cube. Also, list how many vertices and (triangle) faces your mesh should have.

python main.py --question "q22" --output-path "../output_final/q22.gif"

Number of Faces = 12, Number of Vertices = 8

Question 2.2

3. Re-texturing a mesh (10 points)

In your submission, describe your choice of color1 and color2, and include a gif of the rendered mesh.

python main.py --question "q3" --input-path "../data/cow.obj" --output-path "../output_final/q3.gif"

Color choices:

color1 = torch.tensor([255/255, 242/255, 0/255])
color2 = torch.tensor([255/255, 82/255, 82/255])

Question 3

4. Camera Transformations (20 points)

In your report, describe in words what R_relative and T_relative should be doing and include the rendering produced by your choice of R_relative and T_relative.

4.1

python main.py --question "q41" --input-path "../data/cow.obj" --output-path "../output_final/q41.jpg"

Question 3

Description: For this view, the cow is rotated by -90 degrees with z axis as the axis of rotation. There is no translation.

R_relative = pytorch3d.transforms.euler_angles_to_matrix(
        torch.tensor([0, 0, -1 * np.pi / 2]), "XYZ"
    )
T_relative = [0, 0, 0]

4.2

python main.py --question "q42" --input-path "../data/cow.obj" --output-path "../output_final/q42.jpg"

Question 4

Description: There is no rotation. For translation, the camera moves back by 3 units along the z axis.

R_relative = [[1.0, 0, 0], [0, 1, 0], [0, 0, 1]]
T_relative = [0.0, 0, 3]

4.3

python main.py --question "q43" --input-path "../data/cow.obj" --output-path "../output_final/q43.jpg"

Question 4

Description: There is no rotation. For translation, the camera moves in the right by 3 units along the -x axis and up by 3 units along with +y axis.

R_relative = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
T_relative = [0.5, -0.5, 0]

4.4

python main.py --question "q44" --input-path "../data/cow.obj" --output-path "../output_final/q44.jpg"

Question 4

Description: For this view, the cow is rotated by 90 degrees with y axis as the axis of rotation. To position the camera to view the object now, the camera moves 3 units along +x axis and -3 units along -z axis.

R_relative = pytorch3d.transforms.euler_angles_to_matrix(
        torch.tensor([0, np.pi / 2, 0]), "XYZ"
    )
T_relative = [-3, 0, 3]

5. Rendering Generic 3D Representations

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

In your submission, include a gif of each of these point clouds side-by-side.

5.1.1 The point cloud corresponding to the first image

python main.py --question "q511" --input-path "../data/rgbd_data.pkl" --output-path "../output_final/q511.gif"

5.1.2 The point cloud corresponding to the second image

python main.py --question "q512" --input-path "../data/rgbd_data.pkl" --output-path "../output_final/q512.gif"

5.1.3 The point cloud formed by the union of the first 2 point clouds.

python main.py --question "q513" --input-path "../data/rgbd_data.pkl" --output-path "../output_final/q513.gif"

Question 5 Question 5 Question 5

5.2 Parametric Functions (10 points)

In your writeup, include a 360-degree gif of your torus point cloud, and make sure the hole is visible. You may choose to texture your point cloud however you wish.

python main.py --question "q52" --output-path "../output_final/q52.gif" --num-points 100

Number of points = 100

Question 5

Number of points = 1000

Question 5

5.3 Implicit Surfaces (15 points)

In your writeup, include a 360-degree gif of your torus mesh, and make sure the hole is visible. In addition, discuss some of the tradeoffs between rendering as a mesh vs a point cloud. Things to consider might include rendering speed, rendering quality, ease of use, memory usage, etc.

python main.py --question "q53" --output-path "../output_final/q53.gif"

Trade-Offs:

Question 5

6. Do Something Fun (10 points)

python main.py --question "q6" --output-path "../output_final/q6.gif"
Trefoil

x = (2 + torch.cos(2 * t)) * torch.cos(3 * t)
y = (2 + torch.cos(2 * t)) * torch.sin(3 * t)
z = torch.sin(4 * t)

Question 6

7. (Extra Credit) 7. Sampling Points on Meshes (10 points)

For this part, write a function that takes a triangle mesh and the number of samples and outputs a point cloud. Then, using the cow mesh, randomly sample 10, 100, 1000, and 10000 points. Render each pointcloud and the original cow mesh side-by-side, and include the gif in your writeup.

python main.py --question "q7" --input-path "../data/cow.obj" --output-path "../output_final/q7.gif" --num-points 100

Question 7 Question 7 Question 7 Question 7