Nurbs Surface is missing a part

while working on the quake3->egg converter i had serious need to convert curved surfaces. cause i didnt want calculate the stuff myself i decided to try nurbssurface as provided by panda.

so here’s the problem:

white is my base-mesh ( i manually added it), red the resulting surface
as you can see. it works quite well. except that it’s not covering the entire base mesh. i managed to shift it to the other corner. but it still spawns over 75% of the mesh only. i also had it working so it was only 50% covering only around the center.

here’s the egg

<CoordinateSystem> { Z-Up } 
<Comment> {   }  
<Group>{
	<VertexPool> BSPmap {
		<Vertex> 0 { 
			0 0 0
			}
		<Vertex> 1 { 
			1 0 1 
			}
		<Vertex> 2 { 
			2 0 0 
			}
		<Vertex> 3 { 
			0 1 0 
			}
		<Vertex> 4 { 
			1 1 1 
			}
		<Vertex> 5 { 
			2 1 0 
			}
		<Vertex> 6 { 
			0 2 1 
			}
		<Vertex> 7 { 
			1 2 0 
			}
		<Vertex> 8 { 
			2 2 1 
			}
	}
	
	<Polygon> {
		<VertexRef> { 0 1 3 <Ref> { BSPmap } } 
		}
	
	<Polygon> {
		<VertexRef> { 3 1 4 <Ref> { BSPmap } } 
		}
	<Polygon> {
		<VertexRef> {  1 2 4 <Ref> { BSPmap } } 
		}
	<Polygon> {
		<VertexRef> { 4 2 5 <Ref> { BSPmap } } 
		}
	<Polygon> {
		<VertexRef> { 3 4 6 <Ref> { BSPmap } } 
		}
	<Polygon> {
		<VertexRef> { 6 4 7 <Ref> { BSPmap } } 
		}
    <Polygon> {
		<VertexRef> { 4 5 7 <Ref> { BSPmap } } 
		}
	<Polygon> {
		<VertexRef> { 7 5 8 <Ref> { BSPmap } } 
		}	


	<NURBSSurface> patch1 {
	
        <Order> { 3 3 }
        <U-knots> {   0 0 1 2 2 2  }
        <V-knots> {   0 0 1 2 2 2  }
        <Scalar> U-subdiv { 10 }
        <Scalar> V-subdiv { 10 }
        <RGBA> { 1 0 0 1 }
        <VertexRef> { 
            0 1 2 3 4 5 6 7 8 
            <Ref> { BSPmap } 
            } 
    }
}

i converted it to non-nurbs using

egg-qtess  -e nurbtest.egg >out.egg

i was able to get a full basemesh covered with order set to 2 2 but thats not what i want. quake3 sais it uses bi-cubic interpolation. (dunno if that would be 3 3 but it guess so cause 4 4 would totaly not work)
any ideas how to fix this?

Bi-cubic is order 4 4, which is the most common kind of nurbs surface. Remember, the order is one more than the degree, so order 4 is degree 3, which is cubic.

I think your knot vector is the reason your surface is not fully defined. You repeat 2 2 2, which is too many repeats for an order 3 curve (but the right number of repeats for an order 4 curve).

David

i am playing with the numbers for many hours now. no matter what. i cant manage to get it right. its either missing half a grid length on one or both ends of each u and v.
i’d so LOVE to have the order set to 4x4 but i was totaly unlucky with that one. no matter how many knots i specified it would never generate any geometry based on nurbs at all.
since i only have 9 input vertices. that means i have 3 x 3 knots. and for a bicubic sufrace i’d need 3+4 knots. like [ -2 -1 0 1 2 3 4] but it seems to be unable to produce any result

for example when using

<NURBSSurface> patch1 {
	
        <Order> { 4 4 }
        <U-knots> {      -2 -1 0 1 2 3 4   }
        <V-knots> {      -2 -1 0 1 2 3 4  }
        <Scalar> U-subdiv { 6 }
        <Scalar> V-subdiv { 6 }
        <RGBA> { 1 0 0 1 }
        <VertexRef> { 
            0 1 2 3 4 5 6 7 8 
            <Ref> { BSPmap } 
            } 
    }

egg-qtess spawns many errors.

Assertion failed: !_segments.empty() at line 75 of
panda/src/parametrics/nurbsBasisVector.I

it works fine if i use 3 3 as order and cut of one value of V-knots each (aside from the fact that it’s missing a part of the surface)

if i use 3 3 order… i can get the surface to be correct on one side using
[0 0 1 2 2 2] and i can make it correct on the other side using [0 0 0 1 2 2 ] … but i cant make both fit. 4 4 orders… well no luck at all as i already mentioned.

hm ok using [0 0 0 2 2 2] looks like what i was trying to get. or at least it fits the original surface without stuff beeing cut off.
though i still had no luck with 4 4 orders. are those even possible using 3x3 vertices as input?

whupsie. i just noticed panda has no support for uv-coords on nurbs??
that totaly breaks my plan of using them in my converter… sigh

Right, you need at least 4x4 vertices for an order 4 nurbs. UV coordinates are implicitly generated for a nurbs surface, based on the knot vector. You can also scale or offset the generated uv’s with a TexMatrixAttrib.

David