There are two parameters in polygon offset, m and r. m is said to be the greatest slope of z. The method that i do is:
for every triangle, there are three edges and for every edge there are two values dz/dx and dz/dy. Then there are six values, and m is the Max of them. Is that right?
But i don’t know how to get the value of r. Could anyone give me an example of the method to get r?
Well, I have found that the parameters that you put into glPolygonOffset are off the cuff, roll-the-dice see if it looks good type values. Play with it, see what works.
Originally posted by Poma: There are two parameters in polygon offset, m and r. m is said to be the greatest slope of z. The method that i do is:
for every triangle, there are three edges and for every edge there are two values dz/dx and dz/dy. Then there are six values, and m is the Max of them. Is that right?
Actually no, m is defined as
m = sqrt((dz/dx)^2 + (dz/dy^2))
but can be approximated as
m ~= max(abs(dz/dx), abs(dz/dy))
You can calculate dz/dx annd dz/dy for a polygon as follows (considering x0-2, y0-2 and z0-2 the coords of the three vertices)