aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2018-09-12 14:12:47 +0200
committerMarijn Tamis <[email protected]>2018-09-12 14:12:47 +0200
commit7bceea80d4a04649f495f4f4331d7e3bdcdb05ca (patch)
tree824767cccf7b516a8c0b32467c6314eaa802f58d /NvCloth/docs/documentation/CollisionDetection/SelfCollision.html
parentAdded missing GenerateProjectsIOS.sh file (diff)
downloadnvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.tar.xz
nvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.zip
1.1.5 Release (24934621)
Diffstat (limited to 'NvCloth/docs/documentation/CollisionDetection/SelfCollision.html')
-rw-r--r--NvCloth/docs/documentation/CollisionDetection/SelfCollision.html316
1 files changed, 316 insertions, 0 deletions
diff --git a/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html b/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html
new file mode 100644
index 0000000..05f5d1b
--- /dev/null
+++ b/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html
@@ -0,0 +1,316 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="x-ua-compatible" content="IE=Edge"/>
+
+ <title>Self Collision &mdash; NvCloth 1.1.3 documentation</title>
+
+ <link rel="stylesheet" href="../_static/default.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/application.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/styleguide.css" type="text/css" />
+
+ <script type="text/javascript">
+ var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: '../',
+ VERSION: '1.1.3',
+ COLLAPSE_INDEX: false,
+ FILE_SUFFIX: '.html',
+ HAS_SOURCE: true
+ };
+ </script>
+ <script type="text/javascript" src="../_static/jquery.js"></script>
+ <script type="text/javascript" src="../_static/underscore.js"></script>
+ <script type="text/javascript" src="../_static/doctools.js"></script>
+ <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+ <script type="text/javascript" src="../_static/bootstrap.js"></script>
+ <script type="text/javascript" src="../_static/jquery.cookie.js"></script>
+ <script type="text/javascript" src="../_static/jquery.storageapi.js"></script>
+ <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" />
+ </head>
+ <body>
+<nav class="navbar navbar-inverse navbar-default">
+ <div class="row">
+ <div class="navbar-brand">
+ <img class="logo" src="../_static/developerzone_gameworks_logo.png" alt="Logo"/>
+ </div>
+<div id="searchbox" style="display: none; float:right; padding-top:4px; padding-right:4px">
+ <form class="search form-inline" action="../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" class="form-control" />
+ <input type="submit" value="Search" class="btn btn-primary" />
+ </div>
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+ </form>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+ </div>
+</nav>
+<div class="masthead">
+ <div class="row">
+ <ul class="breadcrumb">
+ <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li>
+ </ul>
+ </div>
+</div>
+<div class="row">
+ <div class="col-md-3 bs-sidenav" style="white-space: nowrap; overflow: auto;">
+<div class="bs-sidebar">
+ <div id="sidebar_toc">
+ <h4>Table Of Contents</h4>
+ <ul>
+<li class="toctree-l1"><a class="reference internal" href="../ReleaseNotes/index.html">Release Notes</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id1">1.1.5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id2">1.1.4</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id3">1.1.3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id4">1.1.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id5">1.1.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id6">1.1.0</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../ReleaseNotes/index.html#id7">1.0.0</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../Compiling/index.html">Compiling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="../Compiling/index.html#windows">Windows</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../Compiling/index.html#linux">Linux</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../Compiling/index.html#mac">Mac</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../Compiling/index.html#android">Android</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../Modules/Index.html">Modules</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="../Modules/Index.html#nvcloth">NvCloth</a></li>
+<li class="toctree-l2"><a class="reference internal" href="../Modules/Index.html#nvcloth-extensions">NvCloth extensions</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../UserGuide/Index.html">User Guide</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="../UserGuide/Index.html#setup">Setup</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#initializing-the-library">Initializing the Library</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#factory">Factory</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#fabric-cloth">Fabric &amp; Cloth</a><ul>
+<li class="toctree-l4"><a class="reference internal" href="../UserGuide/Index.html#fabric">Fabric</a></li>
+<li class="toctree-l4"><a class="reference internal" href="../UserGuide/Index.html#cloth">Cloth</a></li>
+</ul>
+</li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#solver">Solver</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#retrieving-simulation-data">Retrieving simulation data</a></li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="../UserGuide/Index.html#usage">Usage</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#common-cloth-properties">Common cloth properties</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#tethers">Tethers</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#collision-detection">Collision detection</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#local-space-simulation">Local space simulation</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#drag-lift-and-wind">Drag lift and wind</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#distance-motion-constraints">Distance/Motion constraints</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#attaching-cloth-to-animated-characters">Attaching cloth to animated characters</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#unit-scaling">Unit scaling</a></li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="../UserGuide/Index.html#troubleshooting">Troubleshooting</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../UserGuide/Index.html#parts-of-cloth-disappearing-for-single-frame">Parts of cloth disappearing (for single frame)</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../CopyRight/Index.html">NVIDIA Copyright Notice</a></li>
+</ul>
+
+ </div>
+<div id="searchbox" style="display: none">
+ <h4>Quick search</h4>
+ <form class="search form-inline" action="../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" class="form-control" />
+ <input type="submit" value="Search" class="btn btn-primary" />
+ </div>
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+ </form>
+ <p class="searchtip" style="font-size: 90%">
+ Enter search terms or a module, class or function name.
+ </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+</div>
+ </div>
+ <div class="document col-md-8">
+ <div class="body">
+
+ <div class="section" id="self-collision">
+<h1>Self Collision<a class="headerlink" href="#self-collision" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="overview">
+<h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
+<p>Self collision tries to keep the cloth from self intersecting.
+It does this by keeping the particles a minimum distance away from each other.
+This distance can be set using Cloth::setSelfCollisionDistance().</p>
+</div>
+<div class="section" id="acceleration-structure">
+<h2>Acceleration structure<a class="headerlink" href="#acceleration-structure" title="Permalink to this headline">¶</a></h2>
+<p>Testing every particle against all other particle is too slow.
+Instead an acceleration structure is used to only test nearby particles.</p>
+<p>The acceleration structure is a combination of a regular grid and a sweep.
+The longest axes of the AABB around all particles is used for the sweep.
+The other two axes are divided in a regular grid of 253x253.
+For each particle we test against the current and neighboring cells of the grid in which we sweep along the remaining axis.
+The whole process will be described in more detail below.</p>
+<div class="section" id="grid-setup">
+<h3>Grid setup<a class="headerlink" href="#grid-setup" title="Permalink to this headline">¶</a></h3>
+<p>The AABB is obtained from ClothData (calculated by SwCollision&lt;T4f&gt;::computeBounds()).
+The edge lengths are calculated by subtracting the lower bounds from the upper bounds.
+The sweep axis index (0 to 2 for x to z so we can use the array operators) is picked by the largest edge length.
+The two hash axes are the remaining axes in arbitrary order.</p>
+<img src="../_images/SelfCollisionGrid.svg" /><p>The cell size for the hash axes is picked so that it is not smaller than the collision distance set by the user, and large enough that 253 cells cover the whole edge length.
+The sweep axis is divided in 65533 cells.
+The first and last cells of each axis are reserved as a sentinel.
+The amount of sweep cells that need to be checked to cover the collision distance is given by:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">numSweepCells</span> <span class="o">=</span> <span class="mi">2</span> <span class="o">+</span> <span class="n">gridScale</span> <span class="o">*</span> <span class="n">collisionDistance</span>
+</pre></div>
+</div>
+<p>We calculate the grid scale and grid bias to quickly convert particle coordinates to cell coordinates using \(coordinate \cdot gridScale + gridBias\).
+The gridScale is \((cellCount + 1)^{-1}\) and the gridBias is \(-lowerBound \cdot gridScale + 1 \), where \(lowerBound\) is taken from the AABB.</p>
+</div>
+<div class="section" id="particle-sorting">
+<h3>Particle sorting<a class="headerlink" href="#particle-sorting" title="Permalink to this headline">¶</a></h3>
+<p>Particles are sorted based on a key which is constructed from the cell coordinates.
+The 16 least significant bits are used to store the sweep axis cell coordinate.
+The two other bytes are used to store the hash axis cell coordinates (this is the reason for the specific cell count per axis in the grid).</p>
+<p>A radix sort with a radix (bin) size of 256 is used, requiring 4 bins to sort the 32-bit keys.</p>
+</div>
+<div class="section" id="key-range-sweep">
+<h3>Key range sweep<a class="headerlink" href="#key-range-sweep" title="Permalink to this headline">¶</a></h3>
+<p>Individual particles can be processed now that the acceleration structure is setup.
+Only 5 cells are processed for each particle, as we don&#8217;t want to detect duplicate pairs.</p>
+<img src="../_images/SelfCollisionHashAxisKernel.svg" /><p>Particles can be quickly identified in the acceleration structure by looping though the sorted keys.
+Cells cannot be directly accessed as they are variable in size (depending on how many particles a cell contains) and stored in a continuous buffer.</p>
+<p>The range of keys that need to be tested against the current particles can be calculated using key offsets.
+Key offsets are relative key coordinates for the cells marked in yellow in the above diagram.</p>
+<p>The first and last keys in the starting cell is calculated using:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">firstKey</span> <span class="o">=</span> <span class="n">currentParticleKey</span> <span class="o">-</span> <span class="nb">min</span><span class="p">(</span><span class="n">numSweepCells</span><span class="p">,</span> <span class="n">currentParticleKey</span> <span class="o">&amp;</span> <span class="n">bucketMask</span><span class="p">)</span>
+<span class="n">lastKey</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">currentParticleKey</span> <span class="o">+</span> <span class="n">numSweepCells</span><span class="p">,</span> <span class="n">currentParticleKey</span> <span class="o">|</span> <span class="n">bucketMask</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The key offsets can be added to these values to obtain the range for the other cells.
+Note that numSweepCells is not subtracted for firstKey to ensure no duplicate collisions are detected.
+Note that bit operations can be used as the different axes are contained in their own bytes within the key.</p>
+<p>Collision detection/response can begin once the first/last keys are known.</p>
+<p>Note that the first/last keys from the previous processed particle are reused for optimizations that can be done because the keys are sorted.</p>
+</div>
+<div class="section" id="collision-detection-and-response">
+<h3>Collision detection and response<a class="headerlink" href="#collision-detection-and-response" title="Permalink to this headline">¶</a></h3>
+<p>Near phase collision detection can start once two possibly colliding keys are identified.
+The pointers to the keys are converted to the particles and the rest particles.</p>
+<p>A basic distance check between the particles and the user specified collision distance is done, culling non-colliding particles.</p>
+<p>When available the distance is also checked against the rest distance to cull particles that are supposed to be close in the mesh.
+This makes it possible to set the collision distance larger than the shortest constraint in the fabric without providing manual collision indices.</p>
+<p>Next a position delta is calculated if the particle collision is not culled:</p>
+<div class="highlight-python"><pre>diff = p1-p0
+ratio = collisionDistance / |diff|
+scale = stiffness / (epsilon + w0 + w1)
+delta = scale * (diff - diff * ratio
+p0 += delta * w0
+p1 -= delta * w1</pre>
+</div>
+<p>TODO: format nicer</p>
+</div>
+</div>
+</div>
+
+
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="col-md-1"></div>
+</div>
+<div class="masthead">
+ <div class="row">
+ <ul class="breadcrumb">
+ <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li>
+ </ul>
+ </div>
+</div>
+
+<footer>
+ <div class="footer-boilerplate">
+ <div class="row">
+ <div class="boilerplate">
+ Copyright &copy; 2014, NVIDIA Corporation &nbsp; | &nbsp; <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID=&quot;http://www.nvidia.com/object/about-nvidia.html_1&quot;;return this.s_oc?this.s_oc(e):true">About NVIDIA </a>&nbsp; | &nbsp; <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID=&quot;http://www.nvidia.com/object/legal_info.html_1&quot;;return this.s_oc?this.s_oc(e):true">Legal Information </a>&nbsp; | &nbsp; <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID=&quot;http://www.nvidia.com/object/privacy_policy.html_1&quot;;return this.s_oc?this.s_oc(e):true">Privacy Policy </a>
+ </div>
+ </div>
+ </div>
+</div>
+</footer>
+
+
+<script type="text/x-mathjax-config">
+ MathJax.Hub.Config({
+ extensions: ["tex2jax.js"],
+ jax: ["input/TeX", "output/HTML-CSS"],
+ tex2jax: {
+ processEscapes: true,
+ skipTags: ["script","noscript","style","textarea"]
+ },
+ "HTML-CSS": { availableFonts: ["TeX"] },
+ TeX: {
+ Macros: {
+ Lrg: ['\\displaystyle{#1}', 1, ""]
+ }
+ }
+ });
+</script>
+
+
+<script type="text/javascript" async
+ src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
+</script>
+
+<script>
+var treestatename = 'GWDocsTreeState';
+var protocol = location.href.split('/')[0].toLowerCase();
+var storage;
+if (protocol.substring(0,4) == 'http') {
+ storage = $.cookieStorage;
+ storage.setPath('/');
+} else {
+ storage = $.localStorage;
+}
+
+if (storage.isEmpty(treestatename)) {
+ storage.set(treestatename, {});
+}
+
+var treestate = storage.get(treestatename);
+
+$.each($("#sidebar_toc ul li"), toc_walker);
+
+function toc_walker(key, value) {
+ var handleSpan = $("<span></span>")
+ .addClass("toc_handle").prependTo(value);
+ handleSpan.attr("id", $(value).closest("div").attr("id") + "." + key);
+
+ if($(value).has("ul li").size() > 0) {
+ var id = handleSpan.attr("id");
+ if (!(id in treestate)) {
+ treestate[id] = false;
+ }
+ handleSpan.addClass("toc_expanded").click(function() {
+ $(this).toggleClass("toc_expanded toc_collapsed").siblings("ul").toggle();
+ treestate[$(this).attr('id')] = $(this).hasClass('toc_expanded');
+ storage.set(treestatename, treestate);
+ });
+ if(!($(this).hasClass('current') || treestate[id])) {
+ handleSpan.click();
+ }
+ if($(this).hasClass('current')) {
+ treestate[handleSpan.attr('id')] = handleSpan.hasClass('toc_expanded');
+ storage.set(treestatename, treestate);
+ }
+ }
+}
+</script>
+ </body>
+</html> \ No newline at end of file