I am trying to implement conservative voxelization as part of real time GI in my hobby rendering engine. I find this article by NVIDIA. I am stuck at understanding the second algorithm. The problem that I have is that I don't understand this section of the article
We describe both algorithms in window space, for clarity, but in practice it is impossible to work in window space, because the vertex program is executed before the clipping and perspective projection. Fortunately, our reasoning maps very simply to clip space. For the moment, let us ignore the z component of the vertices (which is used only to interpolate a depth-buffer value). Doing so allows us to describe a line through each edge of the input triangle as a plane in homogeneous (x c , y c , w c )-space. The plane is defined by the two vertices on the edge of the input triangle, as well as the position of the viewer, which is the origin, (0, 0, 0). Because all of the planes pass through the origin, we get plane equations of the form
ax c + by c + cw c = 0 a(xw c ) + b (yw c ) + cw c ) + cw c = 0 ax + by + c = 0
The planes are equivalent to lines in two dimensions. In many of our computations, we use the normal of an edge, which is defined by (a, b) from the plane equation.
First, I don't understand how to visualize a plane that use w value as one of this coordinates and what is the meaning of this plane. And then later in the article, they calculate this plane by doing a cross product like this
// Compute equations of the planes through the two edges float3 plane; plane = cross(currentPos.xyw - prevPos.xyw, prevPos.xyw); plane = cross(nextPos.xyw - currentPos.xyw, currentPos.xyw);
Again, I still don't understand why this is true.
Is there any relation between the plane normal with the line normal because in the next part, the algorithm use this normal xy value to move the line outwards by substracting the z value of this plane.
// Move the planes by the appropriate semidiagonal plane.z -= dot(hPixel.xy, abs(plane.xy)); plane.z -= dot(hPixel.xy, abs(plane.xy)); // Compute the intersection point of the planes. float4 finalPos; finalPos.xyw = cross(plane, plane);
I can understand it if the xy component of the plane's normal is actually the normal of the line as well and the z value of the plane's normal represent the line distance from point (0, 0)
Can someone please explain in more detail or provide me some visualization of this algorithm ?