<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Andreas,<br>
      <br>
      Great find. <br>
      <br>
      Am I correct in that you haven't had a chance to fully investigate
      the reasons for fragility? It looks like there are a number of
      ways you have found where the library fails (doesn't work as well
      as hoped) including # web workers and tessellation detail. Is
      animation even a reasonable consideration given the time it takes
      to tessellate a NURBS surface? It's probably the case that
      simple/careful animations on a limited NURBS would work, but
      something complex would not. <br>
      <br>
      A few resources on the issue of automatic and/or real-time
      tessellation.<br>
      <br>
      Maya has a mode for determining automatic tessellations. See the
      article at
<a class="moz-txt-link-freetext" href="https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Rendering/files/GUID-F4CCA0A7-C964-4BA5-AE5C-81A6696820F6-htm.html">https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Rendering/files/GUID-F4CCA0A7-C964-4BA5-AE5C-81A6696820F6-htm.html</a><br>
      <br>
      Intel has an article (and sample code) for doing tessellation in
      real-time; however, it's in C++:
<a class="moz-txt-link-freetext" href="https://software.intel.com/en-us/articles/using-nurbs-surfaces-in-real-time-applications">https://software.intel.com/en-us/articles/using-nurbs-surfaces-in-real-time-applications</a><br>
      <br>
      There is a research paper on efficient tessellation on trimmed
      NURBS at
<a class="moz-txt-link-freetext" href="http://cg.cs.uni-bonn.de/en/publications/paper-details/balazs-2004-efficient/">http://cg.cs.uni-bonn.de/en/publications/paper-details/balazs-2004-efficient/</a>.
      I have not read this.<br>
      <br>
      This video shows the result of real-time tessellation on the
      graphics card. I don't know if this is standard WebGL calls (I
      think not), but it could be done as vertex shaders.
      <a class="moz-txt-link-freetext" href="https://www.youtube.com/watch?v=F9oLyOwbFp0">https://www.youtube.com/watch?v=F9oLyOwbFp0</a><br>
      <br>
      This article claims 40,000 Bézier patches at 7-15 fps (almost
      real-time) on hardware almost 20 years old. I don't know how their
      equipment (SGI Onyx with three 200 MHz R4400 CPUs and a Reality
      Engine graphics accelerator) compares to web-browser technology
      today. <a class="moz-txt-link-freetext" href="http://gamma.cs.unc.edu/RENDER/render.html">http://gamma.cs.unc.edu/RENDER/render.html</a><br>
      <br>
      My quick review though these materials and others implies that
      constructing a general purpose algorithm is not easy; and perhaps
      to the level that the application needs to be tailored to a
      specific application (or perhaps input ranges) for things to work
      out real-time.<br>
      <br>
      Leonard Daly<br>
      <br>
      <br>
      <br>
    </div>
    <blockquote type="cite"
cite="mid:CAKdk67u-DQDoLy7DCNLoQecKEeXE865Ebw1Of-zQjWwF4rgB3Q@mail.gmail.com">
      <pre wrap="">Ayam is 3d modeler focused on Nurbs: <a class="moz-txt-link-freetext" href="http://ayam.sourceforge.net/">http://ayam.sourceforge.net/</a> . It
turns out that it comes with a functional implementation of Nurbs
surfaces for x3dom which may be possible to adopt for the main x3dom
distribution.

As a start, for testing, I transferred the ayam js nurbs code to a
x3dom Nurbs branch:

<a class="moz-txt-link-freetext" href="https://github.com/andreasplesch/x3dom/tree/Nurbs/src/nodes/NURBS">https://github.com/andreasplesch/x3dom/tree/Nurbs/src/nodes/NURBS</a>

It works pretty well. Here is the Four Ducks web3d Nurbs example:

<a class="moz-txt-link-freetext" href="https://rawgit.com/andreasplesch/x3dom/Nurbs/test/functional/nurbs/inline.html">https://rawgit.com/andreasplesch/x3dom/Nurbs/test/functional/nurbs/inline.html</a>

Many other examples work as well. Animation and lines do not work. The
ayam code uses web workers for tessellating. Using a pool of more than
1 worker seems to be fragile.

Here is another nice js Nurbs library:

<a class="moz-txt-link-freetext" href="https://github.com/pboyer/verb">https://github.com/pboyer/verb</a>

But it would be most realistic to make the existing ayam code more
robust and complete, at least first.

- Define all x3d nodes in the standard x3dom way.
- Investigate web worker crashes (perhaps in FreeWorkerThread).
- less aggressive default tessellation.
- try without web workers
- investigate x3d text example crash (too many triangles?).
- animation: skip when last tessellation not yet finished
- curves. interpolators

The common approach would be anyways to tessellate before exporting to
X3D, and then use a binary format (binary X3D, SRC, glTF).

Any feedback or contribution welcome, -Andreas

[There is a lot of work on GPU based tessellation/evaluation as well.
A common approach is to tessellate the non-trimmed patch and then use
a texture mask to hide the trimmed portions.]

</pre>
    </blockquote>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <font class="tahoma,arial,helvetica san serif" color="#333366">
        <font size="+1"><b>Leonard Daly</b></font><br>
        3D Systems & Cloud Consultant<br>
        LA ACM SIGGRAPH Past Chair<br>
        President, Daly Realism - <i>Creating the Future</i>
      </font></div>
  </body>
</html>