Sign in to follow this  
dr4cula

Bezier Teapot Tessellation

Recommended Posts

Hi,

 

I've been messing around with the tessellation pipeline and Bezier surfaces and I seem to have run into a strange artefact that I just can't figure out: it only seems to appear for the teapot model (from here) but surely this widely used model isn't broken? Here's what happens when I'm tessellating it. My method is similar to the one presented here slides 23-25, except it seems that the Bezier evaluation function given on those slides is summing u and v basis functions backwards, hence my version evaluates the control points as follows:

int ptIndex = 0;
for(int i = 0; i < 4; ++i) {
for(int j = 0; j < 4; ++j) {
position += patch[ptIndex].position * bu[i] * bv[j];
du += patch[ptIndex].position * dbu[i] * bv[j];
dv += patch[ptIndex].position * bu[i] * dbv[j];
++ptIndex;
}
}
 
Here bu/bv and dbu/dbv are the Bernstein polynomials/derivatives of Bernstein polynomials for the tessellated uv parameter coordinates. If I swap the polynomial multiplication order, e.g. for the position set multiplication to bv[i] * bu[j], then I get the exact same, inside-out model as with the copy-paste code from the given slides (the artefact is still there, just need to move the camera inside of the model to see it). After debugging this for the entire day I'm beginning to think it might be a problem with the model but like I said - seems unlikely considering the popularity of the model. Does anyone have any experience with Bezier teapot tessellation and could chip in? I've tried the other models from Newell's teaset, i.e. the spoon and the cup, and neither seemed to have any similar artefacts. If anyone could recommend any (advanced) test Bezier models, I'd be grateful!
 
Thanks in advance!
Edited by dr4cula

Share this post


Link to post
Share on other sites

The teapot is "broken", or rather, not everything should be a quad patch. The patches at the top degenerate to triangles. That's why the derivatives can fail and produce those artifacts. I remember "solving" it by clamping the domain values for the derivatives to (e, 1-e) with some small e.

Share this post


Link to post
Share on other sites

The teapot is "broken", or rather, not everything should be a quad patch. The patches at the top degenerate to triangles. That's why the derivatives can fail and produce those artifacts. I remember "solving" it by clamping the domain values for the derivatives to (e, 1-e) with some small e.

 

Ah! I see, yes, when I was looking at the model in wireframe, indeed the top part looked triangular but I didn't associate this with the fact that tessellator is using the quad domain.

 

Your "solution" worked out great:

static const float epsilon = 1e-5f;
float u = min(max(coordinates.x, epsilon), 1.0f - epsilon);
float v = min(max(coordinates.y, epsilon), 1.0f - epsilon);
Thanks a lot! :)
Edited by dr4cula

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