Pytorch3D Assignment 1

1. Practicing with Cameras

1.1. 360-degree Renders

1.2 Re-creating the Dolly Zoom

2. Practicing with Meshes

2.1 Constructing a Tetrahedron

For constructing a tetrahedron, my mesh have four vertices and four (triangle) faces as below:

faces_list= [[0,1,2],[0,2,3],[0,3,1],[1,2,3]]

vertices_list = [[0,0,0],[1,0,2],[2,1,0],[0,2,1]]


2.2 Constructing a Cube

For constructing a cube, my mesh have eight vertices and twelve (triangle) faces as below:

faces_list= [[7,3,0],[0,4,7],[0,1,2],[0,2,3],[4,5,6],[4,6,7],[6,5,1],[6,2,1],[4,0,5],[0,1,5],[3,6,7],[2,3,6]]

vertices_list = [[0,0,0],[0,1,0],[1,1,0],[1,0,0],[0,0,1],[0,1,1],[1,1,1],[1,0,1]]



3. Re-texturing a mesh

My choice of color for re-texturing the cow mesh is blue and red. The color of cow gradually changes from blue to red. Color 1 refers blue, and color 2 refers red. The color code as below:

color1 = [0, 0, 1]

color2 = [1, 0, 0]

4. Camera Transformations

4.1 Horizontal Cow

In order to make the cow rotates 90 degree, I need to rotate the camera around Z-axis. Therefore, I need to change the R_relative by compute a rotation matrix (image on the right) while rotating a camera 90 degree clockwise.

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

T_relative=[0, 0, 0]


4.2 Smaller Cow

In order to make the cow become smaller, I need to move the camera away from the cow. Therefore, I change the T_relative and move the camera on Z-axis in the positive direction.

R_relative=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]

T_relative=[0, 0, 3]


4.3 Cow in the corner

Based on observation, I find that the size of cow does not change. It only change the angle between camera and cow. Thus, I change the T_relative and slightly move the camera on X-axis and Y-axis.

R_relative=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]

T_relative=[0.5, -0.5, 0]


4.4 Side Cow

In order to see the side cow, I need to both rotate the camera around Y-axis 270 degree clockwise and change the position of the camera. Therefore, I need to change the R_relative by compute a rotation matrix (image on the left), and adjust the camera position to see the cow.

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

T_relative=[-3, 0, 3]


5. Rendering Generic 3D Representations

5.1 Rendering Point Clouds from RGB-D Images

The point cloud corresponding to the first image

The point cloud corresponding to the second image

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

5.2 Parametric Functions

Torus point cloud with 100x100 grid of pairs

Torus point cloud with 1000x1000 grid of pairs

5.3 Implicit Surfaces

Render a torus as a mesh defined by an implicit function

Compared with rendering as a point cloud, rendering a torus is much more faster. On my computer, it takes 8-14 seconds to render a torus as a point cloud, but only takes 4 seconds to render a torus as a mesh. For the memory usage, the saved torus mesh is smaller than point cloud one. From my perspective, the point cloud has better rendering quality. In this case, when the torus point cloud with larger than 300x300 grid of pairs, it has smooth surface and high rendering quality. For feasibility, I personally think that render a torus as a mesh is easier to use in this example.


6. Do Something Fun

Mesh a shark🦈