Recent posts
https://software.intel.com/en-us/recent/404704
enSmoke - Game Technology Demo Download - Retired
https://software.intel.com/en-us/articles/smoke-game-technology-demo-download
<table border="0" class="table-blue-themed"><tbody><tr><td>
<h4 style="text-align:center">This demo has been retired as it was developed for earlier generation hardware.</h4>
<h4 style="text-align:center"> </h4>
<h4 style="text-align:center">The demo is still available for download if desired.</h4>
</td>
</tr></tbody></table><p>ACCEPT the End User License Agreement pop up and provide your email so that we can provide you with news on updates, when you download the following files:</p>
<ul><li>DOWNLOAD the <a href="/protected-download/267266/148989" rel="nofollow">Smoke Rev 1.2 Installer</a> - Smoke+install+R1.2.zip (117.5 MB) - installs all prerequisites, including DirectX and Havok runtimes</li>
<li>DOWNLOAD the <a href="/protected-download/267266/148989" rel="nofollow">Smoke Rev 1.2 Source Code</a> - Smoke+source+R1.2.zip (179.2 MB) - requires DirectX SDK and Havok 5.5</li>
</ul><p> </p>
<p><strong>DOWNLOAD <a href="/sites/havok/" rel="nofollow">Havok Physics and Havok Animation SDKs, version 5.5</a></strong></p>
<p>The Intel-sponsored Havok PC download is a binary-only bundle that includes all of the standard features and functionality of both the Havok™ Physics and Havok™ Animation products. The download includes Havok SDK libraries, samples, and technical documentation for software developers; as well as Havok's Content Tools for preparation and export of physical assets and characters directly from recent versions of popular 3D modeling and animation tools.</p>
<h3>Previous Version of Smoke:</h3>
<p><br />
</p>
<ul><li>DOWNLOAD the <a href="/sites/default/files/m/d/4/1/d/8/SmokeSetup.exe" title="download_3" rel="nofollow">Full Smoke Rev 1.0 Package</a> (408MB includes .NET and DirectX)</li>
<li>DOWNLOAD the <a href="/protected-download/267266/148989" rel="nofollow">Lite Smoke Rev 1.0 Package</a> (130MB user install the latest .NET and DirectX themselves)</li>
<li>DOWNLOAD the <a href="/protected-download/267266/148989" rel="nofollow">Source Code for Smoke Rev 1.0</a> (192MB)</li>
</ul><p> </p>
<p>Please take a moment to <a href="https://login-software.intel.com/isn/registration/isnRegpage.aspx?TARGET=http://softwarecommunity.intel.com/isn/home/default.aspx?xclear=1">r</a><a href="https://secure-software.intel.com/partner/app/registration/intro?destination=node/6348&locale=en-us">register with Intel® Developer Zone</a><a href="https://login-software.intel.com/isn/registration/isnRegpage.aspx?TARGET=http://softwarecommunity.intel.com/isn/home/default.aspx?xclear=1"> </a>to participate in forum discussions.</p>
<p>Back to the <a href="/en-us/articles/smoke-game-technology-demo" rel="nofollow">Smoke Product Overview</a> page.</p>
Thu, 09 Feb 12 14:58:24 -0800admin148989Autodesk Perspectives on the Intel(R) Xeon 5500 Series
https://software.intel.com/en-us/videos/autodesk-perspectives-on-the-intelr-xeon-5500-series
Tue, 18 Oct 11 21:44:46 -0700Sharon Greenfield (Intel)264360Gareth Edwards, Film director - discussing CGI and film production with Intel technology
https://software.intel.com/en-us/videos/gareth-edwards-film-director-discussing-cgi-and-film-production-with-intel-technology
Tue, 18 Oct 11 21:43:15 -0700Sharon Greenfield (Intel)264374Using NURBS Surfaces in Real-time Applications
https://software.intel.com/en-us/articles/using-nurbs-surfaces-in-real-time-applications
<h3>Alternatives to Polygonal Models</h3>
<p><a target="_blank" href="/sites/default/files/m/d/4/1/d/8/40951_real_time_nurbs.pdf" rel="nofollow"><img src="/sites/default/files/m/d/4/1/d/8/18046_print_button_3d.gif" alt="Printable PDF" border="0" height="40" width="115" /></a><br /><br />Despite the widespread use of polygonal models for representing 3D geometry, the quest goes on to find suitable alternatives, particularly since the limitations of polygonal data have become glaringly obvious to current-generation developers. Because PC developers need to create content that scales across many levels of processor performance (including both host processor and 3D graphics accelerator), they're forced to either create multiple models or to use mesh reduction algorithms for dynamically producing the lower detail models. Creating multiple models clearly taxes the efforts of 3D artists, who must spend even more time modeling, manipulating, and animating models composed of large numbers of polygons. As games become more content intensive (not just in terms of the levels of detail, but more actual game content), the time required to produce the content grows considerably. Alternatives to polygonal models offer artists an acceptable means to streamline the creation process and save time along the way.<br /><br />This article deals with one of the more promising alternatives to polygonal modeling: NURBS (Non-Uniform Rational B-Spline) surfaces. First, I'll introduce you to the concepts and terminology associated with parametric curves and surfaces. Next, I'll describe in detail how to render NURBS surfaces and discuss some of the difficulties encountered when using NURBS surfaces in place of polygonal models. Finally, if I've done my job well, this article will whet your appetite for the exciting types of 3D content that can be created using parametric surfaces and inspire you to investigate developing this type of content.</p>
<h3>Parametric Curve Basics</h3>
<p>Let's start with the basics. Normal "functions" we've seen presented in algebra or calculus (or whatever mathematics course we've taken recently or not so recently) are defined as the dependent variable (often <em>y</em>) given as a function of the independent variable (usually <em>x</em>) so that we have an equation such as: <em>y = 2x</em><sup>2</sup><em> – 2x + 1</em>. By plugging in various values for <em>x</em> we can calculate corresponding values for <em>y</em>. We can create a graph of the function by plotting the corresponding <em>x</em> and <em>y</em> values on a two-dimensional grid, as shown in <strong>Figure 1</strong>.</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18028_image18.gif" alt="Figure 1" border="0" height="218" width="367" /></div>
<div><strong>Figure 1</strong></div>
<p>Parametric functions also match values of <em>x</em> with values of <em>y</em> but the difference is that both <em>x</em> and <em>y</em> are given as functions of a third variable (often represented by u) called the parameter. So we could have a set of equations expressed as follows:</p>
<blockquote><em>y = 2u</em><sup>2</sup><em> – 2u +1</em><br /><em>x = u</em></blockquote>
<p> </p>
<p>These equations produce the same curve that the "implicit" function given above produces. An additional restriction often added to parametric functions is that the functions are only defined for a given set of values of the parameter. In our simple example, <em>u</em> could be any real number but for many sets of equations, the equations will only be considered valid on a range such as <em>0</em>£ <em>u</em> £<em>1</em>.</p>
<hr /><h3>B-Spline Basis Functions</h3>
<p>Now we're going to define a powerful set of parametric functions called the b-spline basis functions (the b in b-spline stands for "basis" so this term is kind of redundant). These equations are defined for a given knot vector <strong><em>U</em></strong> = {<em>u</em><sub>0</sub><em>, u</em><sub>1</sub><em>, …, u</em><sub>n</sub>} as:</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18029_image21.gif" alt="Equation 1" border="0" height="87" width="365" /></div>
<p> </p>
<h3>Equation 1</h3>
<p>Whoa, that's scary! Let's take a close look at it to see what makes it useful. The <em>p</em> subscript in the second equation is the degree of the function (points are zero'th degree, lines are first degree, and so on). The first equation expresses that for zero'th degree curves, the function is either constant zero or constant one depending on the parameter, <em>u</em>, and where it falls in the knot vector. Looking at this pictorially for the knot vector <strong><em>U</em></strong> = {0,1,2} and <em>B</em><sub>0,0</sub>, <em>B</em><sub>1,0</sub>, and <em>B</em><sub>2,0</sub> we get the plots shown in <strong>Figure 4</strong>.</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18030_image22.gif" alt="Equation 4" border="0" height="203" width="364" /><p> </p>
<img src="/sites/default/files/m/d/4/1/d/8/18031_image23.gif" alt="Equation 4" border="0" height="206" width="384" /></div>
<p> </p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18032_image24.gif" alt="Equation 4" border="0" height="203" width="381" /></div>
<p><br /><br />For degrees other than zero, we must recursively calculate the value of the function using a linear combination of the functions that are one degree less than the degree for which we're calculating. For first degree functions, we use a linear combination of the zero'th degree functions. For second degree functions, we use a linear combination of the first degree functions (which are also defined as a linear combination of the zero'th degree functions), and so on. As an example, for the knot vector <strong><em>U</em></strong> = {0,1,2, 3} we produce the plots shown in <strong>Figure 5</strong> for B<sub>0,1</sub>, B<sub>1,1</sub>, B<sub>2,1</sub>, and B<sub>3,1</sub>.</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18033_image25.gif" alt="Equation 4" border="0" height="203" width="381" /></div>
<p> </p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18034_image26.gif" alt="Equation 4" border="0" height="203" width="381" /></div>
<p> </p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18035_image27.gif" alt="Equation 4" border="0" height="203" width="381" /></div>
<p> </p>
<div><strong>Figure 5</strong></div>
<p>Interestingly enough, with the four control points, <strong>P</strong><sub>0</sub>, <strong>P</strong><sub>1</sub>, <strong>P</strong><sub>2</sub>, and <strong>P</strong><sub>3</sub> defined in our previous example, we can now represent the curve, <strong>C</strong> from <strong>Figure 3</strong>, as a parametric curve by the equation:<br /><br /><strong>C</strong>(u) = B<sub>0,1</sub>(u) * <strong>P</strong><sub>0</sub> + B<sub>1,1</sub>(u) * <strong>P</strong><sub>1</sub> + B<sub>2,1</sub>(u) * <strong>P</strong><sub>2</sub> + B<sub>3,1</sub>(u) * <strong>P</strong><sub>3</sub> with knot vector <strong><em>U</em></strong><strong> =</strong> {0,1,2,3}.<br /><br />This can be expressed more compactly as:</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18036_image28.gif" alt="Equation 2" border="0" height="45" width="124" /></div>
<p> </p>
<hr /><h3>Parametric Surfaces</h3>
<p>Now that we know how to describe parametric curves using a set of control points (which is what <strong>P</strong><sub>0</sub>, <strong>P</strong><sub>1</sub>, <strong>P</strong><sub>2</sub>, and <strong>P</strong><sub>3</sub> were in the previous example), we can begin to understand parametric surfaces. The control points that we're going to use for parametric surfaces will be 3-dimensional points. Let's construct an example using the points shown in <strong>Figure 6</strong>.</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18026_fig6.gif" border="0" height="149" width="280" /></div>
<div><strong>Figure 6</strong></div>
<p><br /><br />Starting with16 points labeled <strong>P</strong><sub>0,0</sub> through <strong>P</strong><sub>3,3,</sub> we want to "blend" these points together to form a surface. This process is actually quite easy. To generate a surface point that we'll call <strong>S</strong>, start with two knot vectors, <strong><em>U</em></strong> and <strong><em>V</em></strong>, to create two sets of b-spline basis functions, <em>B</em><sub>i,p</sub>(u) and <em>B</em><sub>j,q</sub>(v). Here <em>p</em> and <em>q</em> tell us the degrees of the surface (for example: linear, quadratic, cubic) in each direction. Now, we can define the function for the surface that corresponds to the function for a curve shown in <strong>Equation 2</strong></p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18037_image29.gif" border="0" height="46" width="206" /></div>
<p> </p>
<h3>Equation 3</h3>
<p>Simple enough? Let's look at it in greater depth just to be sure that the process is clear. To calculate a surface point, <strong><em>S</em></strong>(u,v), we loop over all the control points (with the two summation signs in the equation) and scale each control point, <strong><em>P</em></strong><strong><em>i,j</em></strong>, by the appropriate blending functions evaluated at <em>u</em> and <em>v</em>. Keep in mind that for a surface with many control points, some of the blending functions will be equal to zero over large regions of the surface. In particular, for a surface of degree <em>n x m</em>, at most (<em>n</em>+1)*(<em>m</em>+1) blending functions will be non-zero at a given (<em>u,v</em>) parameter value.<br /><br />We can generate different surfaces by using different knot vectors and changing the degrees of the blending functions (<em>p</em> and <em>q</em>). For example, if you generate a surface that is 3<sup>rd</sup> degree in both dimensions with knot vectors <strong><em>U</em></strong> = {0,0,0,0,1,1,1,1} and <strong><em>V</em></strong> = {0,0,0,0,1,1,1,1], the result would look like the image in <strong>Figure 7</strong> if we use the control point mesh from <strong>Figure 6</strong>.</p>
<div><img src="http://software.intel.com/file/m/3709" border="0" height="268" width="358" /></div>
<div><strong>Figure 7</strong></div>
<p>If you're wondering why we chose these particular knot vectors, the reason is simple. By having the repeated knot values at the beginning and end of the vectors, the resulting surface interpolates (in other words it passes through) the corner and edge control points. In contrast, the surface drawn does <em>not</em> pass through the middle control points, although it does approach them.<br /><br />Before getting to the sample code, let's cover one more thing. The basis functions that we've described have an interesting property (actually it's by design). If you expand them for a given degree, <em>n</em>, and a fixed knot vector, you end up with a polynomial equation of the form: A<sub>0</sub> + A<sub>1</sub>u + A<sub>2</sub>u<sup>2</sup> + A<sub>3</sub>u<sup>3</sup> + … + A<sub>n</sub>u<sup>n</sup> where A<sub>I</sub> are coefficients that are determined exclusively by the knot vector and degree. Polynomials are good functions used for approximating (or, in some cases, representing exactly) other functions. However, there are some three dimensional surfaces that can't easily be approximated using polynomials as bases; specifically, the conics: spheres, cylinders, cones, and so on. To more easily and accurately represent these surfaces, you can use a ratio of polynomials. For two polynomial equations, <strong><em>F</em></strong> and <strong><em>G</em></strong>, a rational polynomial <strong><em>R</em></strong> would be defined by:</p>
<div><img src="http://software.intel.com/file/m/3710" border="0" height="41" width="48" /></div>
<p>Using the b-spline functions from <strong>Equation 1</strong>, we can define a "rational" parametric surface by adding to the control points a fourth component (the first three are <em>x</em>, <em>y</em>, and <em>z</em>) that "weights" each control point. We'll call the fourth component <em>w</em>. In this manner, the equation for the surface becomes:</p>
<div><img src="http://software.intel.com/file/m/3711" border="0" height="93" width="232" /></div>
<h3>Equation 4</h3>
<p>In case you were wondering, this is the equation for a rational b-spline surface. If the knot vector used for the basis functions is a non-uniform knot vector, then this is the equation for a non-uniform rational b-spline surface: a NURBS surface! <strong>Equation 4</strong> is the equation for a generalized parametric surface. Other common parametric surfaces are just subsets of these surfaces. Specifically, a non-rational, uniform or non-uniform, b-spline surface is one where the weights, <em>w</em><sub>i,j,</sub> are all equal to 1. This causes the division to accomplish nothing (and hence we don't have to evaluate the denominator at all). Also, you may have heard of a Bézier surface which is a non-r ational b-spline surface with a uniform knot vector that is all zeros followed by all ones. So, for a 3<sup>rd</sup> degree Bézier surface, the knot vector would be <strong><em>U</em></strong> = {0,0,0,0,1,1,1,1}.<br /><br />Rational parametric surfaces offer one more nicety that isn't available for non-rational surfaces. Any affine transformation (translation, rotation, scale, shear, <em>and</em> perspective projection) can be applied to the control points of a rational parametric surface and then the surface points generated in the transformed space will be correct. This means that if you have a small number of control points then you can transform the control points and generate a large number of surface points without having to transform all the generated surface points. Using non-rational surfaces, you would at least have to perform the projection transformation of the generated surface points.</p>
<p> </p>
<h3>Equation 2</h3>
<p>In our example, <em>n</em> = 3 and <em>p</em> = 1.<br /><br />To verify that this approach works, pick a value for <em>u</em>, say 1.5. Looking at the plots in <strong>Figure 5</strong> we can see that:</p>
<blockquote><em>B</em><sub>0,1</sub>(1.5) = 0<br /><em>B</em><sub>1,1</sub>(1.5) = 0.5<br /><em>B</em><sub>2,1</sub>(1.5) = 0.5<br /><em>B</em><sub>3,1</sub>(1.5) = 0</blockquote>
<p><br /><br />Looking at just the <em>x</em> values of the points, we get:<br /><br /></p>
<blockquote>C<sub>X</sub>(1.5) = <em>B</em><sub>0,1</sub>(1.5) * P<sub>0,X</sub> + <em>B</em><sub>1,1</sub>(1.5) * P<sub>1,X</sub> + <em>B</em><sub>2,1</sub>(1.5) * P<sub>2,X</sub> + <em>B</em><sub>3,1</sub>(1.5) * P<sub>3,X</sub><br />= 0 * 0 + 0.5*1 + 0.5*2 + 0*0<br />= 1.5</blockquote>
<p><br /><br />Looking at the <em>y</em> values of the points, we get :<br /><br /></p>
<blockquote>C<sub>Y</sub>(1.5) = <em>B</em><sub>0,1</sub>(1.5) * P<sub>0,Y</sub> + <em>B</em><sub>1,1</sub>(1.5) * P<sub>1,Y</sub> + <em>B</em><sub>2,1</sub>(1.5) * P<sub>2,Y</sub> + <em>B</em><sub>3,1</sub>(1.5) * P<sub>3,Y</sub><br />= 0 * 0 + 0.5*2 + 0.5*2 + 0*0<br />= 2</blockquote>
<p><br /><br />Therefore, <strong>C</strong>(1.5) = (1.5, 2) which is just what we expect it to be!<br /><br />We've covered a lot of ground and still haven't even looked at parametric surfaces yet. That's okay because by now you should have a decent understanding of the nature of parametric surfaces. We know that a parametric function is a set of equations that produce one or more values for a given parameter. In our examples, we produced <em>x</em> and <em>y</em> values and could easily have produce <em>z</em> values to generate points in 2-space or 3-space. I've also shown how several parametric functions can be used to "blend" points in 2-space (again, blending in 3-space would be a trivial extension of this process). We also learned what a knot vector is and how knot vectors can be used together with the b-spline basis functions to create some interesting "blending" functions.</p>
<p> </p>
<hr /><h3>Implementing a NURBS surface renderer</h3>
<p>At this point, we can take <strong>Equation 4</strong> and write some code to do a straight forward implementation of this. This would not be too difficult, but there are some optimizations that we can make first so that our implementation will perform better and after all, it's real-time performance that we want. First, let's discuss "tessellation". Tessellation is the process of taking the continuous, mathematical equation of a surface and approximating it with polygons (we'll use triangles). This process can be accomplished in a number of ways with the potentia l for vastly different visual results.<br /><br />For simplicity, we're going to use what's called uniform tessellation. Uniform tessellation means we step equally between the minimum and maximum values for the parameters over which the surface is valid. For example, assume that the surface is valid for the ranges <em>u</em>Î[0,3] and v Î[2,3]. What we can do is divide these into some number of subdivisions and then just loop over these values calculating surface points that will be used as vertices of triangles. If we decide to use 20 subdivisions, we would calculate <strong><em>S</em></strong>(u,v) at <em>u</em>=0, <em>u</em>=0.15, <em>u</em>=0.30, …, <em>u</em>=3 for each <em>v</em>=2<em>, v</em>=2.05<em>, v</em>=2.10, <em>v</em>=2.15, …, <em>v</em>=3.<br /><br />So, we'd end up generating 441 points (21 times 21 because we include the end points) that we could then connect into triangles and render using a 3D API, such as OpenGL* or Direct3D*. To speed up the calculation of <strong><em>S</em></strong>(u,v), we can calculate <em>B</em><sub>i,p</sub>(u) and <em>B</em><sub>j,q</sub>(v) at the subdivision points and store these in an array. This calculation can be performed once, so that it will not have to be performed in the inner loop of calculating surface points. Instead, a lookup of the pre-computed values and a multiplication is the only task that would be required. If at some point we change the number of subdivisions we want, we can just recalculate the stored arrays of basis functions evaluated at the new subdivisions.</p>
<h3>What About Surface Normals?</h3>
<p>So now that we have a general idea of a way to tessellate a NURBS surface (or any other parametric surface, for that matter), what else do we need? For one, we need a way to generate surface normals so that we can let the 3D API (Direct3D* in the sample code) do lighting calculations for us. How do we generate these? Well, remember those Calculus classes that we all loved? One of the things we learned is that the derivative of a function is the instantaneous slope of the line tangent to the function at the point where the derivative and function are evaluated. By creating two tangent lines (one in the <em>u</em> and one in the <em>v</em> parameter) we can take a cross product and wind up with a surface normal. Simple enough, you say, but what's the derivative of the function <strong><em>S</em></strong>(u,v)?<br /><br />Well, there are two partial derivatives: one with respect to <em>u</em> and one with respect to <em>v,</em> and they're ugly! Using the chain-rule:</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18041_image33.gif" border="0" height="158" width="532" /><br /><br /><br /><br /><img src="/sites/default/files/m/d/4/1/d/8/18042_image34.gif" border="0" height="157" width="518" /></div>
<div><br /><br /><h3>Equation 5</h3>
<p>And, not only is that ugly, we don't really know how to take the derivatives of <em>B</em><sub>i,p</sub><em>(u)</em> and <em>B</em><sub>j,q</sub><em>(v)</em>. It's possible to take a derivative of <em>B</em><sub>i,p</sub><em>(u)</em> (and <em>B</em><sub>j,q</sub><em>(v) )</em> from it's definition, but there's an easier way. It's possible to come up with a set of equations for calculating the coefficients of the polynomial equation that <em>B</em><sub>i,p</sub><em>(u)</em> is equivalent to. Then, taking the derivative of <em>B</em><sub>I,p</sub><em>(u)</em> is as simple as multiplying powers by coefficients and reducing the powers by one (if you recall d(Ax<sup>n</sup> + Bx<sup>m</sup>)/dx = nAx<sup>n-1</sup>+mBx<sup>m-1</sup>). You still have to use <strong>Equation 5</strong> to compute the derivatives of <strong><em>S</em></strong>(u,v) but it's really not that bad – you're going to be performing the computation of some of the terms any way, and the ones with the derivatives are calculated the same way as the non-derivative terms. We need to be able to calculate the coefficients of the b-spline basis functions when they're represented as follows:</p>
</div>
<div><img src="/sites/default/files/m/d/4/1/d/8/18043_image35.gif" border="0" height="26" width="406" /></div>
<p>Using a lot of paper and a bit of head scratching, I derived the following formulas to compute the coefficients, <em>C</em><sub>i,p,k</sub><em>(u)</em>.</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18044_image36.gif" border="0" height="178" width="548" /></div>
<p> </p>
<h3>Equation 6</h3>
<p>This seems complex, but unless the knot vector changes, you don't have to re-compute these coefficients after the first time. Also note that Ci,p,k is only dependent on u for the knot span that u is in not on u itself, so we can just evaluate the Ci,p,k for each knot span and store those values. Now we can write the derivative of Bi,p(u) as:</p>
<div><img src="/sites/default/files/m/d/4/1/d/8/18045_image37.gif" border="0" /></div>
<p> </p>
<hr /><h3>Sample Code</h3>
<p>At this point we know what we need to know to talk about the sample code you can download and how to implement this fun stuff. First, everything in the sample code is written in C++ and spread across many files of which mainly two are specific to this article: <strong>DRGNURBSSurface.h</strong> and <strong>DRGNURBSSurface.cpp</strong>. Actually, you'll also dive into <strong>NURBSSample.cpp</strong> if you want to play with the surface control points and knot vectors. <strong>DRGNURBSSurface.h</strong> contains a class definition for a class called <em>CDRGNURBSSurface</em> (for the curious, C is for "class", DRG is for "Developer Relations Group" which is what the group I'm in at Intel used to be called). The methods of this class of interest to us are <em>Init(), ComputeBasisCoefficients(),</em><em>ComputeCoefficient(), SetTessellations(), EvaluateBasisFunctions(), TessellateSurface(),</em> and <em>TessellateSurfaceSSE().</em><br /><br />The sample requires the Microsoft DirectX 7 SDK to build or run. If your system meets this requirement, <a href="/protected-download/267266/142397" rel="nofollow">download the sample code</a> (ZIP, 122KB).<br /><br />Going through these in order, <em>Init()</em> is called to initialize a newly created <em>CDRGNURBSSurface</em> object. The function takes a pointer to a <em>CDRGWrapper</em> class that is part of the framework we wrote for getting at the Direct3D* API. <em>Init()</em> also takes two surface degrees, <em>u</em> and <em>v</em>, and the number of control points in the <em>u</em> and <em>v</em> directions. It takes an array of <em>Point4D</em> structures that contain the weighted control points (<em>x</em>, <em>y</em>, <em>z</em>, and <em>w</em>) stored in <em>u</em>-major order (this means that <em>v</em> values are consecutive in the array). It takes two float arrays that contain the <em>u</em> knots and the <em>v</em> knots. Finally, it takes two optional values that specify the number of tessellations in the <em>u</em> and <em>v</em> directions of the surface. <em>Init()</em> does some calculations to determine how many knots are in the knot vectors and then allocates memory to store some of the information needed to render the surface. Finally, <em>Init()</em> makes a local copy of the incoming data (control points and knots) and then calls C<em>omputeBasisCoefficients()</em>.<br /><br /><em>ComputeBasisCoefficients()</em> calls <em>ComputeBasisCoefficient()</em> which uses the formulas from <strong>Equation 6</strong> to compute the coefficients of the polynomials formed from the knot vectors and the degrees of the surface. <em>ComputeBasisCoefficient()</em> calls itself recursively due to the definitions in <strong>Equation 6</strong>. The coefficients are stored in arrays to be used by <em>EvaluateBasisFunctions()</em>. Because the <em>C</em><sub>i,p,k</sub><em>(u)</em> are only dependent on the knot span that <em>u</em> belongs in, <em>ComputeBasisCoefficient()</em> takes as an argument this knot span (referred to as an "interval" in the code) rather than the actual value of <em>u</em>.<br /><br />After <em>Init()</em> has called <em>ComputeBasisCoefficients()</em> to do the one-time calculation of the polynomial coefficients, <em>SetTessellations()</em> is called to set the number of <em>u</em> and <em>v</em> tessellations that will be used for rendering the surface. <em>SetTessellations()</em> can be called at any time after initialization to change the fineness of tessellation of the surface. The sample application calls <em>SetTessellations()</em> whenever the plus key (+) or minus key (-) is pressed to increase or decrease the tessellation of the surface. <em>SetTessellations()</em> allocates memory that's dependent on the number of tessellations used for rendering the surface, sets up some triangle indices for rendering the surface, and then calls <em>EvaluateBasisFunctions()</em>.<br /><br /><em>EvaluateBasisFunctions()</em> uses the coefficients computed in <em>ComputeBasisCoefficients()</em> and a technique called "Horner's method" to evaluate the polynomials that are the expanded form of the basis functions. Horner's method says that f = a<sub>n</sub>x<sup>n</sup>+a<sub>n-1</sub>x<sup>n-1</sup>+…+a<sub> 1</sub>x + a<sub>0</sub> can be evaluated using <em>n</em> multiplications and <em>n</em> additions by rewriting as f = a<sub>0</sub>+x*(a<sub>1</sub>+x*(a<sub>2</sub>+…x*(a<sub> n-1</sub>+x*a<sub>n</sub>)…)) . If you think you'll be calling <em>EvaluateBasisFunctions()</em> often because your tessellations will be changing, then other optimizations could be made here (e.g. using a technique called "forward differences" to eliminate the multiplications in the inner loop). Additionally, this method could be optimized using the Streaming SIMD Extensions of the Intel® Pentium® III processor.<br /><br />At this point, everything is initialized for tessellating a NURBS surface. Now, at each frame that the sample application renders, the <em>Render()</em> method of the CDRGNURBSSurface object is called and in turns calls <em>TessellateSurface()</em> or <em>TessellateSurfaceSSE()</em> depending on whether or not we've told the object to use the Streaming SIMD Extensions of an Intel® Pentium® III processor.<br /><br /><em>TessellateSurface()</em> (or <em>TessellateSurfaceSSE()</em>) uses <strong>Equation 4</strong> and <strong>Equation 5</strong> to compute the surface points and derivatives at the tessellation steps. A cross-product of the derivatives is used to compute the normal to the surface. We don't check for degenerate normals (see the pitfalls section below) so you'll need to modify these routines if degenerate normals become an issue. During the tessellation, a row of triangle vertices is generated. We alternate between putting the vertices in the odd or the even indices of the vertices buffer. Starting with the second row of generated vertices, we call Direct3D* to render a triangle strip using the strip indices generated in <em>SetTessellations()</em>. We alternate between the sets of indices as well due to the winding order of the triangle strip.</p>
<hr /><h3>Real-Time Optimizations</h3>
<p>We already talked about some optimizations that can be done to evaluate NURBS surfaces more quickly. The first, which is used by the sample code, is to use uniform tessellation and pre-evaluate the basis functions and their derivatives at the tessellation points. We also mentioned the possibility of transforming surface control points into projected space and doing our surface tessellation in that space. While this works, lighting can be difficult (or impossible) if you use anything other than directional lights because distance is not preserved in perspective projected space. If you're using light maps in your engine I would highly recommend transforming control points and generating vertices in projected space. You can modify <em>TessellateSurface()</em> to do the divide by homogeneous <em>w</em> and viewport scaling to generate vertices in screen space.<br /><br />To keep memory requirements minimal, we render the surface by generating two rows of surface points and then passing a triangle strip to the API (Direct3D* in our case). If a surface didn't need to be re-tessellated at every frame, then we could generate all the surface points and store these in an array. Depending on the application, it may still be quicker to tessellate the surface at every frame rather than having to fetch the generated vertices from memory (with corresponding cache misses). You'll need to experiment with your particular application to see what works best.<br /><br />Aside from the algorithmic optimizations just discussed, we can achieve better performance by using the new Streaming SIMD Extensions supported by the Intel® Pentium® III processor. These extensions allow us to do mathematical operations on four floating point values at one time (for more information on the Streaming SIMD Extensions of the Intel® Pentium® III processor, visit <a target="_blank" href="http://developer.intel.com/design/archives/processors/pentiumiii/index.htm">http://developer.intel.com/design/archives/processors/pentiumiii/index.htm</a>). Since for NURBS surfaces we're dealing with four coordinates (<em>x</em>, <em>y</em>, <em>z</em>, and <em>w</em>) we can do the same operations to all four at once. <em>TessellateSurfaceSSE()</em> uses intrinsic functions provided by the Intel C/C++ Compiler version 4.0 to evaluate all four coordinates of a NURBS surface point at once.<br /><br />Other optimizations are possible depending on the quality vs. speed tradeoffs acceptable by a particular application. For example, one could choose to generate normals only every other surface point (or less frequently) and then linearly interpolate normals in between.</p>
<hr /><h3>More notes on the sample code</h3>
<p>I should mention a few last things about the sample code contained in the download. The sample requires the Microsoft DirectX 7 SDK to build or run and was written using C++ and built using Microsoft Visual C++ 6.0. If your system meets these requirements, and if you have the Intel C/C++ compiler version 4.0 included with version 4 of the Intel VTune product, <a href="/protected-download/267266/142397" rel="nofollow">download the sample code</a> (ZIP, 122KB).<br /><br />If you don't have the Intel C/C++ compiler version 4.0 included with version 4 of the Intel VTune product, you'll need to change a line in DRGNURBSSurface.h. The line reads "#define SUPPORT_PENTIUM_III 1" and should be changed to "#define SUPPORT_PENTIUM_III 0". You can then rebuild everything using the Microsoft compiler (or other C++ compiler) and get to see the code working. You won't be able to enable the tessellation routine that uses the Streaming SIMD Extensions of the Intel® Pentium® III processor, though.<br /><br />While running the application, pressing 'H' will bring up a help screen of available keys. Most are self explanatory. One worth mentioning is the 'M' key that causes the display to switch between two different "Objects". The objects are either:</p>
<ul><li>A single NURBS surface with 100 control points</li>
<li>Nine NURBS surfaces with 16 control points each</li>
</ul><p> </p>
<p>You'll notice when viewing the nine surfaces that there are hard creases between the surfaces. This doesn't happen with the single surface. When changing the tessellation level, for the single NURBS surface, there are actually 9 times as many points generated as what the number indicates. This is done to keep a somewhat consistent look between the shapes of the two different "Objects".</p>
<h3>Additional Details and Potential Pitfalls</h3>
<p>I've discussed the math behind parametric surfaces and the basics of rendering them and hopefully made them seem appealing as an alternative to polygonal models. What I haven't addressed are some of the problems that are unique to parametric surfaces and some of the trickier aspects of using parametric surfaces in place of polygonal models.<br /><br />Some of the more common issues with parametric surfaces are:</p>
<ul><li><strong>Texture Mapping</strong> – A simple approach to texture mapping a parametric surface is to use the <em>u</em> and <em>v</em> parameter values as texture coordinates (scaled appropriately to the 0 to 1 range). This works fine in some cases (and is what the sample code does), but there may be cases that this won't work for (if the knot vector is very non-uniform, then the texture will be stretched and squashed). To fix this problem, a second parametric surface can be used to generate texture coordinates. This increases overhead substantially, but may be the only solution (and it provides the most flexibility). Many rendering packages allow artists to apply textures to a parametric surface by using a second surface to map the texture coordinates. Keep this in mind as you use parametric surfaces for your applications.</li>
<li><strong>Cracking</strong> – When two parametric surfaces meet at an edge (or one parametric surface meets a polygonal surface) it's possible for a crack to appear between the surfaces if their degrees of tessellation differ (or it they're just different sizes). This problem can be solved on a per application basis by adding connectivity information to the surfaces. It's not trivial to fix, but it's not impossible.</li>
<li><strong>Collision Detection</strong>– If you're doing collision detection in your application, you have several choices with parametric surfaces:
<ul><li>Do collision detection on the mesh of control points by treating the mesh as a polygonal mesh – this is approximate and may be too course in some instances.</li>
<li>Store all the generated triangles and do collision detection on these – while more accurate, it's more memory intensive as well as computationally intensive</li>
<li>Depending on what types of objects may be colliding, you can solve the parametric surface equations with equations representing the other objects (even lines are difficult, though) and then just plug-and-chug to find collision points</li>
<li>Use a combination of (a) and (b) by starting with (a) and then refining the surface to triangles to determine an exact hit.</li>
</ul></li>
<li><strong>Clipping</strong> – For surfaces that are partially within the viewing frustum, it can be difficult to clip prior to generating triangles. The problem is that you can't just clip control points because doing so would make the tessellation of the surface difficult to impossible. The ea siest solution is to just generate triangles and then clip the triangles – the downside to this is the possibility of generating many more triangles than needed.</li>
<li><strong>Back-surface Culling</strong> – Aside from clipping, it is also difficult to easily cull back-facing surfaces or portions of surfaces for similar reasons to the clipping problem. For example, a sphere can be defined with one surface but only half of the sphere is ever visible at one time. It would be nice to be able to cull the back-facing portion of the sphere before tessellation, but this is difficult to do.</li>
<li><strong>Tessellation</strong> – Although a uniform tessellation algorithm is easy to implement and can run fast, in some instances other algorithms may provide better performance/quality. Surfaces that have very curvy areas as well as very flat areas may be better tessellated with a non-uniform tessellation algorithm.</li>
<li><strong>Non-local refinement not supported</strong> – When refining a surface (i.e. adding detail), you must add control points in complete rows and columns so the control mesh remains a regular grid of points. This causes excessive control points to be added just to add detail in a small, localized region of a surface. Note that this is not an implementation issue, but rather an issue with NURBS surfaces (and other parametric surfaces).</li>
<li><strong>Degenerate Normals</strong> – Because it's possible to have control points that are at the same location, it's possible for the derivatives of the surface to vanish (i.e. go to zero). This causes the calculation of surface normals to fail. To solve this, it is necessary to look at surrounding points and derivatives if one of the tangents gets too close to zero.</li>
</ul><p> </p>
<hr /><h3>Conclusion</h3>
<p><a target="_blank" href="/sites/default/files/m/d/4/1/d/8/40951_real_time_nurbs.pdf" rel="nofollow"><img src="/sites/default/files/m/d/4/1/d/8/18046_print_button_3d.gif" alt="Printable PDF" border="0" height="40" width="115" /></a><br /><br />We've covered a lot of information in this article. We've been introduced to parametric curves and surfaces and should have a decent understanding of the concepts behind them. We learned what's involved in rendering parametric surfaces and can see how the data requirements are smaller than the polygonal models that can be generated. And we should now have an idea how to implement some of the creative types of 3D content we talked about in the introduction.<br /><br />Given that the field of study of parametric surfaces is enormous we've only lightly touched the surface (no pun intended) of what's possible. Experimenting with parametric surfaces is exciting. I encourage you to check out the sample code and get a feel for how you can incorporate NURBS surface rendering into your 3D engine today.</p>
<h3>References and Further Reading</h3>
<p>Piegl, Les and Tiller, Wayne. <em>The NURBS Book, 2nd Edition</em>, Berlin, Germany: Springer-Verlag, 1996.<br />Foley, j., van Dam, A., Feiner, S., and Hughes, J. <em>Computer Graphics: Principles and Practice,</em> Reading, MA: Addison-Wesley, 1990.</p>
<h3>About the Author</h3>
<p>Dean Macri is a Senior Technical Marketing Engineer w ith Intel's Developer Relations Division. He is currently researching real-time physics with an emphasis on cloth simulation. He welcomes e-mail regarding NURBS and other parametric surfaces, or anything mathematical and related to real-time 3D graphics. He can be reached at <a href="mailto:dean.p.macri@intel.com" rel="nofollow">dean.p.macri@intel.com</a>.</p>
<hr />Fri, 09 Sep 11 14:28:51 -0700Dean Macri (Intel)142397Eurographics 2009
https://software.intel.com/en-us/videos/eurographics-2009
Wed, 24 Aug 11 18:05:30 -0700Sharon Greenfield (Intel)264728Diagnostic 10001: could not find directory in which xxxx resides
https://software.intel.com/en-us/articles/cdiag10001
<p>Diagnostic 10001: could not find directory in which xxxx resides
</p><p><b>Thank you for your interest in this diagnostic message. We are still in the process of documenting this specific diagnostic.</b></p>
<p><b>Please let us know of your experience with this diagnostic message by posting a comment below. Your interest in this diagnostic will help us prioritize the order we document diagnostics.</b></p>
Wed, 16 Sep 09 17:20:25 -0700admin153098