Hi Yves,

On Wed, 23 May 2007, Yves wrote:

> I experimented with the nurbs in version OpenSG 1.8, had some problems. 
> I built surfaces in Autodesk's Maya. I then printed out the informations 
> about the surfaces and programmed them using the testRationalSurface.cpp 
> program as a base, changing only the maketorus function. When I exported 
> an open surface everything is fine, but when I try to build a close 
> surface. I either get a crash if I try to pass on the knots in the 
> format that I think would represent a closed surface:

>From the source code you posted I suppose you used makeTorus2() and 
makeCylinder2(). At least that's how I had to modify it to compile. :-)

Your problem basically is that it seems Maya gives unclamped knotvectors
for closed surfaces while OpenSG expects clamped knotvectors (just like 
OpenGL or OpenInventor, although maybe .iv files can contain unclamped 
knotvectors I'm not 100% sure about it right now). I admit the crash is 
not nice, and actually there should've been at least a warning about not 
being able to properly set the knot vectors...

> i.e for a surface that is closed in 1 direction the knots in that direction
> are
>
> float knots11[15] = {-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
>
> or I obtain bad seams (as expected) if I use
>
> float knots11[15] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7,8,8,8,8};

of course, this is a completely different knotvector altering your 
surface-definition somewhat.

The solution is simple: use clamped knotvectors. :-) I had some code lying 
around that I was able to quickly hack into your code that converts 
unclamped knotvectors to clamped ones, unfortunately it needs a modified
version of OSGBSplineTensorSurface.cpp to work (a check for clamped 
knotvectors has to be commented out and insertKnot_U/_V has to be slightly 
modified as they have an overindexing bug that is never exposed during 
tessellation but crashes when doing knotvector clamping) so I'm not sure 
if it's very useful for you. But using this hack I was able to 
tessellate/display both of your models (although the normals face inwards 
on your surface of revolution). Maybe this clampSurface() stuff should be 
integrated into the OSGSurface class but I'm not quite sure right now how 
could it be integrated cleanly.

Yours,
        Akos

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to