Posted 03 December 2011 - 12:40 AM
Currently rewriting my old Rasterizer based on Nicolas Capens Half-Space Rasterizer.
In one of his comment(which is not accessible atm) he showed and example on how to interpolate any given value on the 3D Triangle face using normalvector. Because i lost some of my source, this part is gone, too.
Googled the whole day, but it seemed i missed it. Maybe someone here knows/rememberes how it worked? Its been a long time...since i have worked on my rasterizer.
Link to Cached Post of Nicolas:
Posted 03 December 2011 - 01:35 AM
Posted 03 December 2011 - 03:03 PM
Sofar, if iam misremembering, any tip on how to interpolate the Barycentric coordinates without calculating the 3 subtriangles everytime?(avoiding to much calculation per pixel)
Posted 03 December 2011 - 08:03 PM
This might be the post you're referring to (on page 3):
Let's say we want to interpolate some component z linearly across the polygon (note that z stands for any interpolant). We can visualize this as a plane going through the x, y and z positions of the triangle, in 3D space. Now, the equation of a 3D plane is generally:
A * x + B * y + C * z + D = 0
From this we can derive that:
z = -A / C * x - B / C * y - D
Note that for every step in the x-direction, z increments by -A / C, and likewise it increments by -B / C for every step in the y-direction. So these are the gradients we're looking for to perform linear interpolation. In the plane equation (A, B, C) is the normal vector of the plane. It can easily be computed with a cross product.
Now that we have the gradients, let's call them dz/dx (which is -A / C) and dz/dy (which is -B / C), we can easily compute z everywhere on the triangle. We know the z value in all three vertex positions. Let's call the one of the first vertex z0, and it's position coordinates (x0, y0). Then a generic z value of a point (x, y) can be computed as:
z = z0 + dz/dx * (x - x0) + dz/dy * (y - y0)
Once you've computed the z value for the center of the starting pixel this way, you can easily add dz/dx to get the z value for the next pixel, or dz/dy for the pixel below (with the y-axis going down).
I hope this helps! Don't hesitate to ask for further clarification.
Posted 03 January 2012 - 08:17 AM
A * x + B * y + C * z + D = 0
Care to explain how or why?
Posted 04 January 2012 - 07:35 AM
And under what law should I care to follow the mathematical operations given to provide an "ideal" measurement of something in a space from an already generated "perspective" of how it works?
I can tell you that a Nivotyev Lokiq is 3 * 44 ^ *33 + X.
What is X? Nobody knows but me because I made it up to represent something in MY head.
How do you understand it? By listening to what I tell you.
Nivotyev Lokigs are something I made up as well and you MUST understand that 3 * 44 ^ *33 + X = a polygonal, six-faced 3-point lighted scale of a Nivotyev Lokig.
Accept or you'll never learn.
Also, it is stored in Pomerazquep memory. Memory in circles. Don't ask, just accept it.
Not accepting? Never will learn what I tell you then and you'll never work for me or succeed in Nivotyev programming logic.
Posted 04 January 2012 - 01:19 PM
If you still can't understand, you might need to brush up on the mathematics behind it.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users