A mesh is defined by vertex locations , face indices , and textures (per-vertex in RGB) .
Given a mesh primitive and camera parameters , we want to find a rendering function , which is fully differentiable.
Rasterization
Consider the following scenario. We have a mesh which consists of only one triangle with constantly black texture:
Given the camera parameters , we have
Let the projection of the triangle in the image UV coordinates be , then for each pixel in the UV coordinates , the corresponding value is
We can see this function is discontinuous, with zero gradients everywhere. There will be no geometry updates.
Soft Rasterization
Soft rasterization (SoftRas) is a differentiable method, which aggregates the contribution from multiple faces. Given a set of faces , for each pixel , we calculate the influence of a triangle on pixel:
where is a sign function indicating if the pixel is inside or outside the triangle
is the distance from face to pixel, and is face sharpness.
The following shows the graph of as a function of , with increasing . We can see that a larger results in a smoother function.
Next, we want to normalize to with the consideration of depth of face and background influence, such that
Given the depth of each face at pixel , we have
where is the aggregation sharpness and is the background influence.