Assignment 1: Rendering Basics with PyTorch3D
1. Practicing with Cameras
For the turntable animation, I changed the camera azimuth while keeping its distance and elevation fixed.
For the dolly zoom effect, we change the camera distance together with the field of view to keep the cow approximately the same size. Its an illusion.
2. Practicing with Meshes
Each square side of the cube is represented by two triangles, giving 12 triangular faces (2x6) in total.
3. Re-texturing a Mesh
I chose blue, color1 = [0, 0, 1], and red,
color2 = [1, 0, 0]. I used each vertex's z-coordinate to interpolate between the colors.
alpha = (z - z_min) / (z_max - z_min)
color = (1 - alpha) * color1 + alpha * color2
4. Camera Transformations
I changed the camera extrinsics using the relative rotation and translation from the starter code:
R = R_relative @ R_0
T = R_relative @ T_0 + T_relative
Target 1
The relative rotation changes the cow's orientation in the image by 90 degrees clockwise, around the viewing axis.
R_relative = [[0, 1, 0],
[-1, 0, 0],
[0, 0, 1]]
T_relative = [0, 0, 0]
Target 2
I kept the rotation unchanged and increased the cow's depth in camera coordinates. This makes it appear smaller.
R_relative = [[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]
T_relative = [0, 0, 2]
Target 3
The rotation is kept unchanged and I just adjusted the x and y translation. In PyTorch3D camera coordinates, positive x points left and positive y points up. A positive x translation and negative y translation move the cow toward the lower left of the image.
R_relative = [[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]
T_relative = [0.5, -0.5, 0]
Target 4
I used a rotation about the y-axis to obtain a side view. Because the starter code also rotates the original translation, I added a relative translation to bring the cow back in front of the camera (tried multiple values here).
R_relative = [[ 0, 0, 1],
[ 0, 1, 0],
[-1, 0, 0]]
T_relative = [-3, 0, 3]
5. Rendering Generic 3D Representations
5.1 Point Clouds from RGB-D Images
5.2 Parametric Surfaces
5.3 Implicit Surfaces
Mesh vs. Point Cloud
- Meshes use triangles to cover the surface continuously, although coarse meshes can look angular. Point clouds can have gaps when the samples are sparse. As shown in Question 7, increasing the number of sampled points makes the shape easier to recognize.
- Mesh rendering speed depends on the number of triangles, image resolution, and shading settings. Similarly, for point clouds, rendering speed depends on the number of points, their screen coverage, and rasterization settings. A dense point cloud is not necessarily faster to render than a mesh.
- Meshes store vertices and face connectivity, along with colors or textures. Point clouds store positions and features without face connectivity, but may need many points to represent a surface densely. Their memory usage depends on the number of sampled points and the features stored.
- Since Point clouds only store sampled points, it is just a massive list of unordered coordinates. On the other hand, meshes have structured data to define connectivity between vertices to form triangles.
- Point clouds have a very large file size usually due to the large number of point clouds needed to render a decent object. In meshes, the the file size to store could be really small in comparison to the point clouds.
- Meshes require both vertex positions and information about how they connect into faces. Point clouds are simpler to construct from sampled coordinates or by unprojecting depth maps, since no face connectivity is needed.
6. Creative Rendering: Re-texturing a Football
I downloaded a football mesh and used its material labels to distinguish the white panels from the black panels. I recolored the white panels while keeping the black panels black.
I used blue [0.1, 0.3, 0.9] and white
[1.0, 1.0, 1.0]. I calculated each triangle's center
and normalized its z-coordinate. The blend is strongest at the
middle of the ball, creating a white band that fades into blue
toward both ends.
7. Sampling Points on Meshes
Sampled points from the cow's surface by first selecting triangles with probability proportional to their area. For each selected triangle, I generated a uniformly distributed point using barycentric coordinates.
area = 0.5 * ||(B - A) × (C - A)||
probability = area / total_area
point = (1 - u - v) * A + u * B + v * C
I sampled each point cloud once before rotating the camera, so the points remain fixed during the animation. Increasing the sample count gives more coverage of the surface and makes the cow's shape easier to recognize and pixels more dense.