Sign in to follow this  
ArnoAtWork

Hermite patch

Recommended Posts

Hey guys! I am developping a landscape where I would like to generate a Hermite patch or a patch closed to its behaviour. What I need is a patch defined by positions and normals and with a surface going through control points. The problem is that I find a lot of documentation about 2D curve but not for 3D surface. Do you know where I can find it? Thansks a lot! Arno. [Edited by - ArnoAtWork on June 8, 2006 7:46:03 AM]

Share this post


Link to post
Share on other sites
Hi!

I think you would be better off with bezier patches, which have all the characteristics you're looking for.

After a quick search I came across this article: http://web.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html
which covers bezier patches quite nicely.

Hope that helps.

Cheers!

Share this post


Link to post
Share on other sites
The patch goes trough the corner control points of the Bezier patch and the rest of the control points define the normals. This is also the case with Hermite patches, and I don't know of a patch that would go through ALL control points, as then you could not define the normals.

Why not use the heightdata for the points the patch goes through, and calculate the points which define the normals?

Cheers!

Share this post


Link to post
Share on other sites
"The patch goes trough the corner control points of the Bezier patch and the rest of the control points define the normals"

The control points do not only define the normals but the behaviour of the curve. In Hermite case the patch go through all control points because you define a patch of four points and the calculation is done using position and tangents of each of these four control points...

Share this post


Link to post
Share on other sites
Yes, I was actually simplifying a "little" with stating the control points define the normals, they truly define tangents in both directions and also "twist" at the corners.

However, in the only references I found, they state that the Hermite patch has more or less the same layout, 4 points defining the corners, tangents in both directions and "twist" vectors (for example here: http://www.dotcsw.com/poy2002.txt)

As I see it, the difference between Bezier and Hermite patches is conceptually the same as between Bezier and Hermite splines, that being the different representation of the tangents.

I hope someone more qualified than me will come over here and shed some light on this though, as you made me a bit uncertain here... :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thank you for your help.

I finally found a document talking about Hermite patch ;)
http://www.microflown.com/data/2005_Development%20of%20an%20Energy-based%20Nearfield%20Acoustic%20Holography%20System.pdf

Arno.

Share this post


Link to post
Share on other sites
You want to have a look at natural cubic splines

There it is guaranteed that the surfaces goes through the control points and they are pretty easy to implement

Evaluate natural cubic splines

Lets say you got N control points.
To calculate the coefficients(Z0,...,Zn) you need to evaluate a n-2 dimensional tridiagonal matrix(linear equation system).
So you get the coefficients (Z1,...,Zn-1)
Z0 = Zn = 0
1.
Just calculate the determinant of the tridiagonal matrix.
2.
Now you need to calculate the other N-2 determinants for the result vector
z=(Z1,...,Zn-1)
Az = B

For Z1:
Use the unmodified tridiagonal matrix
a)replace the first column of the matrix with the result vector B
b)calculate determinant dz1
c) Z1 = dz1 / det(tridiagonal matrix)

analog for the other coefficients Z2,...,Zn-1

Just let me know if you need some reference code, I have implemented a general matrix class which is used by my natrual cubic spline evaluator. ~ 250 lines of code all together.

Share this post


Link to post
Share on other sites
Consider one square of the grid whose four corners are points whose positions and normals are known. To illustrate, let the corners be P[i][j] = (i,j) for i and j either 0 or 1. You know the heights H[i][j] and unit-length normals N[i][j]. For a height field h(x,y), a unit-length normal is (n0,n1,n2) = (-dh/dx,-dh/dy,1)/L, where L = sqrt((dh/dx)^2+(dh/dy)^2+1). So dh/dx = -n0/n2 and dh/dy = -n1/n2. In effect, you have first-order partial derivatives Hx[i][j] and Hy[i][j] at the four corners.

A bicubic function may be used for interpolation on the square, B(x,y) = row(1,x,x^2,x^3)*M*column(1,y,y^2,y^3), where M is a 4-by-4 matrix of constants (16 numbers to be computed). You have 3 pieces of information at each corner: height H, derivatives Hx and Hy. That gives you in total 12 pieces of information but you need 16. This is where the "twist" information at the corners comes in. You get 1 more piece of information per corner for a total of 16 pieces of information.

Use these to set up a linear system of 16 equations in 16 unknowns for M. For example, H[0][0] = B(0,0) = M[0][0] and H[0][1] = B(0,1) = M[0][0] + M[0][1] + M[0][2] + M[0][3]. Also, Hx[0][0] = (dB/dx)(0,0) = M[1][0] and Hx[0][1] = M[1][0] + M[1][1] + M[1][2] + M[1][3].

Share this post


Link to post
Share on other sites
Quote:
Original post by griffin2000
You will need a border region of unused points along the edge of your surface however.


Heu,...no. As you define your surface with only 4 vertices at time, there is no problem. In fact, with Hermite, you cut your patch in a subpatch of 2x2 vertices to generate the surface. For this reason, editing a control point means recalculating 4 subpatches around this control point.

Quote:
Original post by Basiror
You want to have a look at natural cubic splines.


I don't know a lot of surface type(only Bezier, Nurbs and Hermite). So this one seems good because you have controls points on surface. However I think that Hermite has an advantage. A control point can have 2 tangents per direction(u or v). It's then easy to "break" the surface curvature.

Quote:
Original post by griffin2000
True but they are (as I understanding by quickly skimming the link :-) ) less GPU friendly

In my case it's not really the problem. But it's a good point however ;)

Arno.

[Edited by - ArnoAtWork on June 9, 2006 4:41:34 AM]

Share this post


Link to post
Share on other sites
They aren t GPU unfriendly in any way since they are usually applied in a preprocess either at load time or when compiling the map data into an engine readable format

They are pretty easy to implement as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this