[X3D-Public] reason / benefits of homogeneous coordinates in NURBS?

Michalis Kamburelis michalis.kambi at gmail.com
Wed Aug 28 13:31:42 PDT 2013


Philipp Serfling wrote:
> Why should there be a speed gain anyway?
> Afaik it´s only possible to pass triangles  (or sometimes quads) to a low
> level API like OpenGL.
> So if i want to render a nurbsPatch, i compute all tesselated triangles and
> let them be rendered.
>
> In this case it doesn´t matter if the coordinates were homogeneous or
> non-hom.,
> before they get passed to the render API, the position of each vertice has
> to be computed.
>
> Please correct me if i´m wrong.
>

1. You can use OpenGL geometry or tessellation shaders to evaluate NURBS 
on GPU. Whether it's a good idea is another matter (your GPU 
requirements will go up, and for many practical purposes doing NURBS on 
CPU is good enough). One can argue that having control points in 
homogeneous coordinates is better here, since you probably want to pass 
ready 4D vectors to your OpenGL shaders (but in practice I suspect this 
is moot: even combining controlPoints (3D) + weights (1D) into one array 
of 4D vectors will probably kill any possible gain from homogeneous 
coordinates).

2. In case of a traditional implementation (evaluate NURBS on CPU, pass 
only triangles to OpenGL) you're still concerned with how fast you can 
calculate the triangles on CPU. Especially if you animate NURBS surfaces 
(by animating control points). Homogeneous coordinates give you a tiny 
speed gain, since you don't have to multiply points by weights. Like the 
equation on 
http://castle-engine.sourceforge.net/x3d_implementation_nurbs.php#section_homogeneous_coordinates 
shows: controls points are already multiplied by weights. Anyway, in my 
experience this is completely-absolutely-totally not noticeable speed gain.

IOW, there *are* cases when you can say that homogeneous coordinates may 
give a tiny speed gain... although, in my experience and opinion, this 
is an absolutely tiny, not noticeable at all, speed gain.

The real reason for using homogeneous coordinates in X3D NURBS remains: 
because that's how other X3D browsers do it. And changing it now (trying 
to persuade everyone to switch to non-homogeneous coordinates) would 
create only more confusion.

Michalis



More information about the X3D-Public mailing list