Re: CSG operations on textured meshes -- something better than CGAL?

James Robertson <[email protected]> Wed, 14 May 2014 07:07:42 +0200
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============4907763767275614883==
Content-Type: multipart/alternative;
	boundary="------------060504070706030305040209"

This is a multi-part message in MIME format.
--------------060504070706030305040209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

You are going to be distorting triangles in different ways depending on the overall shape of the mesh at any given point though.  If you just retain existing UV coordinates for the new vertices, the results will be...  strange.

Consider the case where a convex region meets a concave one.  One side of the triangle will be slightly expanded, while the other side will be contracted.  Of course you know your input data better than us, so maybe such distortions are acceptable or won't be noticeable, but they will be there.


On 14/05/2014 01:41, Jon Watte wrote:
>
>     I don't believe you will be able to use your existing uv values with the mesh that results from this csg operation
>
>
> The operations I want to do are rigid and well conditioned and do not stretch or generate new surfaces compared to the input meshes. They may invert the winding of triangles, though (so normal maps would have to be flipped) in the case of a cut-out.
> I also need to preserve vertex bone weighting, too... something that can preserve UV should be able to preserve that, too. Worst case, I put in a vertex ID value in the UV channel and loop up the other parameters based on that.
>
> So... no general purpose parameterized trimesh CSG library available?
>
> Sincerely,
>
> jw
>
>
>
>
>
> Sincerely,
>
> Jon Watte
>
>
> --
> "I find that the harder I work, the more luck I seem to have." -- Thomas Jefferson
>
>
> On Thu, May 8, 2014 at 12:28 PM, Chris Green <[email protected] <mailto:[email protected]>> wrote:
>
>     I don't believe you will be able to use your existing uv values with the mesh that results from this csg operation -- it has a different topology, and there will be changes in the ratios of the areas of different parts of the model, with really bumpy areas of the mesh being smoothed out, etc. You'll even have brand new areas emerge that don't have corresponding areas on the original model, as holes are filled in, etc.
>
>     What might work better is to just do the csg operation and generate a uv atlas for the resultant mesh. You can then generate a new texture map for this uv parametization by sampling from the original one, in a similar manner to the way in which people produce bumpmaps mapping the normals of highly tessellated models onto low-detail models.
>
>     *From:*Jon Watte [mailto:[email protected] <mailto:[email protected]>]
>     *Sent:* Thursday, May 08, 2014 11:08 AM
>     *To:* Game Development Algorithms
>     *Subject:* [Algorithms] CSG operations on textured meshes -- something better than CGAL?
>
>     I have a triangle mesh composed of many submeshes with different textures/materials. This mesh may not be a 2-manifold -- it may have open edges. Typical game art.
>
>     I now want to create a 3mm thick shell of this mesh. As an approximation, taking each triangle, and extrude it back along the normal of each vertex, and union all of those generated chopped pyramids would be an approximation of what I want. If I do literally that, and self-union the result, then that should resolve the self-intersection problems I'll run into along narrow sharp creases etc.
>
>     I can't find any library to do this, though. CGAL has some fairly robust functions on NEF polyhedra, but those polyhedra don't seem to allow parameterization (which is academic speak for texture coordinates that may have discontinuities across edges.)
>
>     So, what are some robust CSG libraries available that work on such game-style meshes, preserving texture coordinates?
>
>     (And actually, I don't have one such mesh; I have > 120 million such meshes, so a by-hand or even script-the-Max-shell-modifier solution is unlikely to work. I do have hundreds of Linux servers at my disposal, though.)
>
>
>
>     Sincerely,
>
>     Jon Watte
>
>
>     --
>     "I find that the harder I work, the more luck I seem to have." -- Thomas Jefferson
>
>
>     ------------------------------------------------------------------------------
>     Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
>     &#149; 3 signs your SCM is hindering your productivity
>     &#149; Requirements for releasing software faster
>     &#149; Expert tips and advice for migrating your SCM now
>     http://p.sf.net/sfu/perforce
>     _______________________________________________
>     GDAlgorithms-list mailing list
>     [email protected] <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     Archives:
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
>
>
> _______________________________________________
> GDAlgorithms-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

--------------060504070706030305040209
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    You are going to be distorting triangles in different ways depending
    on the overall shape of the mesh at any given point though.&nbsp; If you
    just retain existing UV coordinates for the new vertices, the
    results will be...&nbsp; strange.<br>
    <br>
    Consider the case where a convex region meets a concave one.&nbsp; One
    side of the triangle will be slightly expanded, while the other side
    will be contracted.&nbsp; Of course you know your input data better than
    us, so maybe such distortions are acceptable or won't be noticeable,
    but they will be there.<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 14/05/2014 01:41, Jon Watte wrote:<br>
    </div>
    <blockquote
cite="mid:CAJgyHGOJoRJdr6qgQNXvcYg=TsdcC=UMTo4qM9Hhxev9z=eJ7A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span
style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:14.399999618530273px">I
            don&#8217;t believe you will be able to use your existing uv
            values with the mesh that results from this csg operation</span></blockquote>
        <div><br>
        </div>
        <div>The operations I want to do are rigid and well conditioned
          and do not stretch or generate new surfaces compared to the
          input meshes. They may invert the winding of triangles, though
          (so normal maps would have to be flipped) in the case of a
          cut-out.</div>
        <div>I also need to preserve vertex bone weighting, too...
          something that can preserve UV should be able to preserve
          that, too. Worst case, I put in a vertex ID value in the UV
          channel and loop up the other parameters based on that.</div>
        <div><br>
        </div>
        <div>So... no general purpose parameterized trimesh CSG library
          available?&nbsp;</div>
        <div><br>
        </div>
        <div>Sincerely,</div>
        <div><br>
        </div>
        <div>jw</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div dir="ltr"><font face="courier new, monospace"><br>
              <br>
              <br>
              <font>Sincerely,</font><br>
              <br>
              <font>Jon Watte</font><br>
              <br>
              <br>
              --<br>
              "<span style="color:rgb(0,0,0)">I find that the harder I
                work, the more luck I seem to have." -- Thomas Jefferson</span></font></div>
        </div>
        <br>
        <br>
        <div class="gmail_quote">On Thu, May 8, 2014 at 12:28 PM, Chris
          Green <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div link="blue" vlink="purple" lang="EN-US">
              <div>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I
                    don&#8217;t believe you will be able to use your existing
                    uv values with the mesh that results from this csg
                    operation &#8211; it has a different topology, and there
                    will be changes in the ratios of the areas of
                    different parts of the model, with really bumpy
                    areas of the mesh being smoothed out, etc. You&#8217;ll
                    even have brand new areas emerge that don&#8217;t have
                    corresponding areas on the original model, as holes
                    are filled in, etc.</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">What
                    might work better is to just do the csg operation
                    and generate a uv atlas for the resultant mesh. You
                    can then generate a new texture map for this uv
                    parametization by sampling from the original one, in
                    a similar manner to the way in which people produce
                    bumpmaps mapping the normals of highly tessellated
                    models onto low-detail models.
                  </span></p>
                <div class="">
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></p>
                  <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">
                      Jon Watte [mailto:<a moz-do-not-send="true"
                        href="mailto:[email protected]" target="_blank">[email protected]</a>]
                      <br>
                      <b>Sent:</b> Thursday, May 08, 2014 11:08 AM<br>
                      <b>To:</b> Game Development Algorithms<br>
                      <b>Subject:</b> [Algorithms] CSG operations on
                      textured meshes -- something better than CGAL?</span></p>
                  <p class="MsoNormal">&nbsp;</p>
                </div>
                <div>
                  <p class="MsoNormal">I have a triangle mesh composed
                    of many submeshes with different textures/materials.
                    This mesh may not be a 2-manifold -- it may have
                    open edges. Typical game art.</p>
                  <div>
                    <div class="h5">
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">I now want to create a 3mm
                          thick shell of this mesh. As an approximation,
                          taking each triangle, and extrude it back
                          along the normal of each vertex, and union all
                          of those generated chopped pyramids would be
                          an approximation of what I want. If I do
                          literally that, and self-union the result,
                          then that should resolve the self-intersection
                          problems I'll run into along narrow sharp
                          creases etc.</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">I can't find any library to
                          do this, though. CGAL has some fairly robust
                          functions on NEF polyhedra, but those
                          polyhedra don't seem to allow parameterization
                          (which is academic speak for texture
                          coordinates that may have discontinuities
                          across edges.)</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">So, what are some robust
                          CSG libraries available that work on such
                          game-style meshes, preserving texture
                          coordinates?</p>
                      </div>
                      <div>
                        <p class="MsoNormal">&nbsp;</p>
                      </div>
                      <div>
                        <p class="MsoNormal">(And actually, I don't have
                          one such mesh; I have &gt; 120 million such
                          meshes, so a by-hand or even
                          script-the-Max-shell-modifier solution is
                          unlikely to work. I do have hundreds of Linux
                          servers at my disposal, though.)<br
                            clear="all">
                        </p>
                        <div>
                          <div>
                            <p class="MsoNormal"><span
                                style="font-family:&quot;Courier
                                New&quot;"><br>
                                <br>
                                Sincerely,<br>
                                <br>
                                Jon Watte<br>
                                <br>
                                <br>
                                --<br>
                                "<span style="color:black">I find that
                                  the harder I work, the more luck I
                                  seem to have." -- Thomas Jefferson</span></span></p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
------------------------------------------------------------------------------<br>
            Is your legacy SCM system holding you back? Join Perforce
            May 7 to find out:<br>
            &amp;#149; 3 signs your SCM is hindering your productivity<br>
            &amp;#149; Requirements for releasing software faster<br>
            &amp;#149; Expert tips and advice for migrating your SCM now<br>
            <a moz-do-not-send="true"
              href="http://p.sf.net/sfu/perforce" target="_blank">http://p.sf.net/sfu/perforce</a><br>
            _______________________________________________<br>
            GDAlgorithms-list mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:[email protected]">[email protected]</a><br>
            <a moz-do-not-send="true"
              href="https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list"
              target="_blank">https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list</a><br>
            Archives:<br>
            <a moz-do-not-send="true"
href="http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list"
              target="_blank">http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/SauceLabs">http://p.sf.net/sfu/SauceLabs</a></pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
GDAlgorithms-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list">https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list</a>
Archives:
<a class="moz-txt-link-freetext" href="http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list">http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list</a></pre>
    </blockquote>
    <br>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
	<tr>
		<td style='border:none;padding:0px 15px 0px 8px'>
			<a href="http://www.avast.com/">
				<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
			</a>
		</td>
		<td>
			<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
				This email is free from viruses and malware because <a href="http://www.avast.com/">avast! Antivirus</a> protection is active.
			</p>
		</td>
	</tr>
</table>
<br />
</body>
</html>

--------------060504070706030305040209--


--===============4907763767275614883==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
--===============4907763767275614883==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
--===============4907763767275614883==--