<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Soft objects</title>
<meta name="Microsoft Theme" content="zero 111">
</head>

<body background="_themes/zero/zertxtr.gif" bgcolor="#000000" text="#FFFFFF" link="#669966" vlink="#6699CC" alink="#999999"><!--mstheme--><font face="Arial, Arial, Helvetica">


<div align="center">
  
  <!--msthemeseparator--><p align="center"><img src="_themes/zero/zerrulea.gif" width="600" height="10"></p>
  
  <h1><!--mstheme--><font color="#6699CC"><i>Soft 
  objects</i><!--mstheme--></font></h1>
  <!--msthemeseparator--><p align="center"><img src="_themes/zero/zerrulea.gif" width="600" height="10"></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p style="line-height: 150%">
  <img border="0" src="images/SoftObjectsSmall.jpg" width="256" height="247"></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p align="justify" style="line-height: 150%">Using the <i>marching cubes algorithm</i> 
  allows us to generate the polygonal contour (called iso-surface) of a 3D 
  density field for a given density threshold. Refer to <a href="#Ref1">[1]</a> 
  for an algorithm description which also includes an implementation in C/C++. The density data can either come 
  from 3D volumetric data sets (e.g. taken from MRI scans) or it can be 
  expressed implicitly by a
  mathematical function. In our case we use a simple function to describe a 
  single
  <i>blob</i>&nbsp;in the scene. Other functions for modeling soft objects can 
  be found in <a href="#Ref2">[2]</a>.</p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p style="line-height: 150%">
  <img border="0" src="images/SoftObjectsFig1.gif" alt="Density function" width="164" height="105"></p>
  <p style="line-height: 150%">&nbsp;</p>
  <p align="justify" style="line-height: 150%"><i>F</i> returns the density 
  value at <i>p</i> for a <i>blob</i> with origin <i>o</i> which is simply the 
  inverse of the squared Euclidian distance between <i>p</i> and <i>o</i>. The advantage of having a&nbsp;formula is the ease at which surface normals can be calculated. There is no 
  need to approximate surface normals as described in <a href="#Ref1">[1]</a>. 
  By calculating the partial derivative of <i>F</i> we can express the normal <i>
  N</i> for a 
  given point <i>p</i> in space directly. Having correct normals is 
  crucial for shading the surface.</p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p style="line-height: 150%">
  <img border="0" src="images/SoftObjectsFig2.gif" alt="Normal of density function" width="318" height="240"></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p align="justify" style="line-height: 150%">For more complicated density 
  functions <i>N</i> can be approximated in the following way. </p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p style="line-height: 150%">
  <img border="0" src="images/SoftObjectsFig3.gif" alt="Approximated normal of density function" width="287" height="130"></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p align="justify" style="line-height: 150%">By taking several individual <i>
  blobs</i> and adding up their density functions it is possible to build complex 
  soft objects<i>.</i> The normal at a given point <i>p</i> in space is also just the 
  sum of <i>N</i> for each <i>blob.</i></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p style="line-height: 150%">
  <img border="0" src="images/SoftObjectsFig4.gif" alt="Density function and its normal of a blobby object" width="109" height="93"></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <p align="justify" style="line-height: 150%">We tessellate our soft objects using 
  a special version of the marching cubes algorithm. Instead of performing the 
  algorithm for each and every voxel of a 3D volume we trace a line from the 
  center of each <i>blob</i> out until it intersects the surface. If the voxel 
  belonging to the intersection point hasn't been tessellated yet we compute the 
  polygonal surface for it and then progress to its neighbors until all 
  interlinked voxels have been visited. Otherwise the <i>blob</i> penetrates 
  another one which has already been processed. An algorithm outline can be 
  found in <a href="#Ref3">[3]</a>.</p>
  <p align="justify" style="line-height: 150%">After tessellation the polygonal 
  contour is rendered using a shader taking reflected and refracted light into 
  account  to visualize translucent matter. 
  It's the vertex shaders responsibility to calculate the reflected view vector 
  and an approximation of the refracted view vector for each vertex. Also, a 
  coarsely approximated fresnel term is computed to allow the pixel shader to 
  blend between the corresponding color values for both the reflected and 
  refracted view vector taken from an environment map.</p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <!--mstheme--></font><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1">
    <tr>
      <td width="100%" colspan="2"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%; margin-bottom: 4">
    <font face="Courier New" size="2">for a given point P on a surface</font><!--mstheme--></font></td>
    </tr>
    <tr>
      <td width="7%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">V</font><!--mstheme--></font></td>
      <td width="93%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">viewer position</font><!--mstheme--></font></td>
    </tr>
    <tr>
      <td width="7%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">E</font><!--mstheme--></font></td>
      <td width="93%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">vector to viewer for P</font><!--mstheme--></font></td>
    </tr>
    <tr>
      <td width="7%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">N</font><!--mstheme--></font></td>
      <td width="93%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">surface normal for P</font><!--mstheme--></font></td>
    </tr>
    <tr>
      <td width="7%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">f</font><!--mstheme--></font></td>
      <td width="93%"><!--mstheme--><font face="Arial, Arial, Helvetica">
      <p style="line-height: 150%">
    <font face="Courier New" size="2">fresnel term for P</font><!--mstheme--></font></td>
    </tr>
  </table><!--mstheme--><font face="Arial, Arial, Helvetica">
  <p style="line-height: 150%">
  <a name="ReflectRefractFresnel">
  <img border="0" src="images/SoftObjectsFig5.gif" alt="vertex shader calculations" width="228" height="150"></a></p>
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <h3 style="line-height: 150%"><!--mstheme--><font color="#6699CC">References<!--mstheme--></font></h3>
  <!--mstheme--></font><!--msthemelist--><table border="0" cellpadding="0" cellspacing="0" width="100%">
    <!--msthemelist--><tr><td valign="baseline" width="42"><img src="_themes/zero/zerbul1a.gif" width="15" height="15" hspace="13" alt="bullet"></td><td valign="top" width="100%"><!--mstheme--><font face="Arial, Arial, Helvetica">
  <p align="justify" style="line-height: 150%; margin-bottom:4"><a name="Ref1">[1]</a> 
  Paul Bourke. <a href="http://astronomy.swin.edu.au/pbourke/modelling/polygonise/">
  &quot;Polygonising a scalar field&quot;</a></p>
    <!--mstheme--></font><!--msthemelist--></td></tr>
    <!--msthemelist--><tr><td valign="baseline" width="42"><img src="_themes/zero/zerbul1a.gif" width="15" height="15" hspace="13" alt="bullet"></td><td valign="top" width="100%"><!--mstheme--><font face="Arial, Arial, Helvetica">
  <p align="justify" style="line-height: 150%; margin-bottom:4"><a name="Ref2">[2]</a> 
  Paul Bourke. <a href="http://astronomy.swin.edu.au/pbourke/modelling/implicitsurf/">
  &quot;Implicit Surfaces&quot;</a></p>
    <!--mstheme--></font><!--msthemelist--></td></tr>
    <!--msthemelist--><tr><td valign="baseline" width="42"><img src="_themes/zero/zerbul1a.gif" width="15" height="15" hspace="13" alt="bullet"></td><td valign="top" width="100%"><!--mstheme--><font face="Arial, Arial, Helvetica">
  <p align="justify" style="line-height: 150%; margin-bottom:4"><a name="Ref3">[3]</a> Andreas Jönsson.
  <a href="http://www.angelcode.com/texts/metaballs/metaballs.asp">&quot;Fast 
  metaballs&quot;</a></p>
    <!--mstheme--></font><!--msthemelist--></td></tr>
  <!--msthemelist--></table><!--mstheme--><font face="Arial, Arial, Helvetica">
  <p align="justify" style="line-height: 150%">&nbsp;</p>
  <!--webbot bot="Include" U-Include="footer.htm" TAG="BODY" startspan --><!--msthemeseparator--><p align="center"><img src="_themes/zero/zerrulea.gif" width="600" height="10"></p>
<p></p>
<p></p>
  <dl>
    <div align="center">
      <center>
      <dt>Last update on
      2002-03-17</dt>
      </center>
    </div>
    <div align="center">
      <center>
      <dd>
      <p align="center">&nbsp;</dd>
      </center>
    </div>
    <div align="center">
      <center>
      <dt>Meshuggah Demo and Effect browser.</dt>
      </center>
    </div>
    <div align="center">
      <center>
      <dt>Copyright © 2001, 2002
      <a href="mailto:carsten.wenzel@gmx.net?subject=Meshuggah Demo and Effect browser">Carsten Wenzel</a>.</dt>
      </center>
    </div>
    <div align="center">
      <center>
      <dt>All rights reserved.</dt>
      </center>
    </div>
  </dl>

<!--webbot bot="Include" i-checksum="22998" endspan --></div>


<!--mstheme--></font></body>

</html>
