This document describes parametric surface visualization using DirectX 11. It discusses representing surfaces defined by degree, knot vectors, and control points by generating a grid of surface points. The surface is rendered by forming triangles between the points. Normal vectors can be estimated to add per-pixel lighting effects. The number of points used can be controlled dynamically by varying the parameter step size. Examples of surfaces rendered with and without lighting are shown.
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Parametric surface visualization in Directx 11 and C++
1. Parametric
surface vi-
sualization
in DirectX
11 (C++) Parametric surface visualization in DirectX 11 (C++)
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
Alejandro Cosin Ayerbe
August 2012
2. Introduction
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Description
Introduction
Basis demo Based on my final project in bachelor’s degree in Mathematics (a
Surface slideshare presentation can be seen here), which was programmed in
visualization
process
Matlab.
Dynamically
generated
points
Examples
Bibliography
3. Introduction
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Description
Introduction
Basis demo Based on my final project in bachelor’s degree in Mathematics (a
Surface slideshare presentation can be seen here), which was programmed in
visualization
process
Matlab.
Dynamically A translation was made from Matlab to C++.
generated
points
Examples
Bibliography
4. Introduction
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Description
Introduction
Basis demo Based on my final project in bachelor’s degree in Mathematics (a
Surface slideshare presentation can be seen here), which was programmed in
visualization
process
Matlab.
Dynamically A translation was made from Matlab to C++.
generated
points The goal is to represent interpolating and approximating parametric
Examples surfaces (like NURBS surfaces) in DirectX 11 with an arc ball camera.
Bibliography
5. Introduction
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Description
Introduction
Basis demo Based on my final project in bachelor’s degree in Mathematics (a
Surface slideshare presentation can be seen here), which was programmed in
visualization
process
Matlab.
Dynamically A translation was made from Matlab to C++.
generated
points The goal is to represent interpolating and approximating parametric
Examples surfaces (like NURBS surfaces) in DirectX 11 with an arc ball camera.
Bibliography
The data describing the surface being represented (degree of the surface,
knot vectors and control points) is loaded through a text file. Then, a
grid of surface points is generated based on the information loaded.
6. Introduction
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Description
Introduction
Basis demo Based on my final project in bachelor’s degree in Mathematics (a
Surface slideshare presentation can be seen here), which was programmed in
visualization
process
Matlab.
Dynamically A translation was made from Matlab to C++.
generated
points The goal is to represent interpolating and approximating parametric
Examples surfaces (like NURBS surfaces) in DirectX 11 with an arc ball camera.
Bibliography
The data describing the surface being represented (degree of the surface,
knot vectors and control points) is loaded through a text file. Then, a
grid of surface points is generated based on the information loaded.
The surface is generated with this grid, making triangles in an
appropriate way.
7. Introduction
Parametric
surface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in the
sualization
in DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control
11 (C++)
points Pi,j .
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
8. Introduction
Parametric
surface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in the
sualization
in DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control
11 (C++)
points Pi,j .
Introduction
For example, given the set of points
Basis demo
Surface
visualization Q = {(2, 0, 2), (1, 0, 2), (0, 0, 3), (2, 1, 2), (1, 1, 2), (0, 1, 3), (2, 2, 1), (1, 2, 1),
process
(0, 2, 2), (2, 3, 1), (1, 3, 1), (0, 3, 2)}
Dynamically
generated
points
Examples
Bibliography
9. Introduction
Parametric
surface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in the
sualization
in DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control
11 (C++)
points Pi,j .
Introduction
For example, given the set of points
Basis demo
Surface
visualization Q = {(2, 0, 2), (1, 0, 2), (0, 0, 3), (2, 1, 2), (1, 1, 2), (0, 1, 3), (2, 2, 1), (1, 2, 1),
process
(0, 2, 2), (2, 3, 1), (1, 3, 1), (0, 3, 2)}
Dynamically
generated
points a surface of degree (2, 2) interpolating this points is given by the following
Examples data: knot vectors
Bibliography
U = {0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0} and V = {0.0, 0.0, 0.0, 1.0, 1.0, 1.0},
10. Introduction
Parametric
surface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in the
sualization
in DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control
11 (C++)
points Pi,j .
Introduction
For example, given the set of points
Basis demo
Surface
visualization Q = {(2, 0, 2), (1, 0, 2), (0, 0, 3), (2, 1, 2), (1, 1, 2), (0, 1, 3), (2, 2, 1), (1, 2, 1),
process
(0, 2, 2), (2, 3, 1), (1, 3, 1), (0, 3, 2)}
Dynamically
generated
points a surface of degree (2, 2) interpolating this points is given by the following
Examples data: knot vectors
Bibliography
U = {0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0} and V = {0.0, 0.0, 0.0, 1.0, 1.0, 1.0},
and control points
P = {P0,0 , P0,1 , P0,2 , P1,0 , P1,1 , P1,2 , P2,0 , P2,1 , P2,2 , P3,0 , P3,1 , P3,2 } =
11. Introduction
Parametric
surface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in the
sualization
in DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control
11 (C++)
points Pi,j .
Introduction
For example, given the set of points
Basis demo
Surface
visualization Q = {(2, 0, 2), (1, 0, 2), (0, 0, 3), (2, 1, 2), (1, 1, 2), (0, 1, 3), (2, 2, 1), (1, 2, 1),
process
(0, 2, 2), (2, 3, 1), (1, 3, 1), (0, 3, 2)}
Dynamically
generated
points a surface of degree (2, 2) interpolating this points is given by the following
Examples data: knot vectors
Bibliography
U = {0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0} and V = {0.0, 0.0, 0.0, 1.0, 1.0, 1.0},
and control points
P = {P0,0 , P0,1 , P0,2 , P1,0 , P1,1 , P1,2 , P2,0 , P2,1 , P2,2 , P3,0 , P3,1 , P3,2 } =
{(2, 0, 2), (0.6464, 0, 1.6464), (0, 0, 3), (2, 1, 2.3536), (0.6464, 1, 2),
(0, 1, 3.3536), (2, 2, 0.6464), (0.6464, 2, 0.2929), (0, 2, 1.6464),
(2, 3, 1), (0.6464, 3, 0.6464), (0, 3, 2)}
12. Introduction
Parametric
surface vi-
sualization
An example in Matlab of the previous grid of points (in green), and an
in DirectX
11 (C++)
interpolant surface generated (control points in blue, interpolated points in
red) can be seen below:
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
13. Basis demo
Parametric
surface vi-
sualization
in DirectX
11 (C++)
In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and can
Introduction be modified to be controlled with pc keyboard and mouse.
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
14. Basis demo
Parametric
surface vi-
sualization
in DirectX
11 (C++)
In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and can
Introduction be modified to be controlled with pc keyboard and mouse.
Basis demo
Surface Reading from a text file the degree, knot vectors and control points of a
visualization
process
parametric surface, a grid of surface points can be generated dynamically.
Dynamically
generated
points
Examples
Bibliography
15. Basis demo
Parametric
surface vi-
sualization
in DirectX
11 (C++)
In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and can
Introduction be modified to be controlled with pc keyboard and mouse.
Basis demo
Surface Reading from a text file the degree, knot vectors and control points of a
visualization
process
parametric surface, a grid of surface points can be generated dynamically.
Dynamically
generated
points
This requires programming some functions that allow to evaluate the value of
Examples
a surface S at desired parameter values u and v , i.e., to obtain the value of
Bibliography
S(u, v ), which will be a three dimensional point.
16. Basis demo
Parametric
surface vi-
sualization
in DirectX
11 (C++)
In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and can
Introduction be modified to be controlled with pc keyboard and mouse.
Basis demo
Surface Reading from a text file the degree, knot vectors and control points of a
visualization
process
parametric surface, a grid of surface points can be generated dynamically.
Dynamically
generated
points
This requires programming some functions that allow to evaluate the value of
Examples
a surface S at desired parameter values u and v , i.e., to obtain the value of
Bibliography
S(u, v ), which will be a three dimensional point.
The parameter values u and v go from 0.0 to 1.0, so if a step is considered for
each parameter, for example uStep = 0.1 and vStep = 0.1, a grid of
11 ∗ 11 = 121 surface points will be generated, by evaluating
S(0.0, 0.0), S(0.0, 0.1), S(0.0, 0.2), ..., S(0.0, 1.0), S(0.1, 0.0), ..., S(1.0, 1.0).
17. Surface Points
Parametric
surface vi-
The next image shows a grid of surface points generated for the same surface
sualization as seen in the previous slide. Each point is represented with a quad, generated
in DirectX
11 (C++) through the Geometry Shader:
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
18. Surface Points
Parametric
surface vi-
sualization
in DirectX
11 (C++)
This set of points can be used to form triangles and render these triangles
Introduction through an index buffer, in order to obtain a representation of the surface:
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
19. Adding per-pixel lighting
Parametric
surface vi-
sualization
in DirectX
11 (C++)
It is possible to add lighting effects to the surface such as standard per-pixel
Introduction
lighting. Normal vectors will be needed, so they must be estimated in some
Basis demo
way.
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
20. Adding per-pixel lighting
Parametric
surface vi-
sualization
in DirectX
11 (C++)
It is possible to add lighting effects to the surface such as standard per-pixel
Introduction
lighting. Normal vectors will be needed, so they must be estimated in some
Basis demo
way.
Surface
visualization
process
Given the points A, B and C that form each triangle in the surface, an
Dynamically
generated acceptable estimation of the normal vector at the point A can be obtained
points −→ −→
performing the cross product of the vectors AB and AC .
Examples
Bibliography
21. Adding per-pixel lighting
Parametric
surface vi-
sualization
in DirectX
11 (C++)
It is possible to add lighting effects to the surface such as standard per-pixel
Introduction
lighting. Normal vectors will be needed, so they must be estimated in some
Basis demo
way.
Surface
visualization
process
Given the points A, B and C that form each triangle in the surface, an
Dynamically
generated acceptable estimation of the normal vector at the point A can be obtained
points −→ −→
performing the cross product of the vectors AB and AC .
Examples
Bibliography
Due that the surface is one-sided, to render with per-pixel lighting in both
sides of the surface, a ”copy” of the surface slightly moved down in the y axis
(the demo uses a left handed coordinate system) is also rendered, with the
normal vectors at each point negated.
22. Adding per-pixel lighting
Parametric
surface vi-
sualization
The image below shows a surface rendering in the left, and the same surface
in DirectX
11 (C++)
rendered whith per-pixel lighting:
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
23. Dynamically generated points
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Introduction
The amount of points used to render a surface can be controlled with the u
Basis demo
and v parameters step. The smaller the step, the more points obtained. For
Surface
example, if the step is 0.1 for both parameters, then there will be
visualization 11 ∗ 11 = 121 surface points.
process
Dynamically
generated
points
Examples
Bibliography
24. Dynamically generated points
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Introduction
The amount of points used to render a surface can be controlled with the u
Basis demo
and v parameters step. The smaller the step, the more points obtained. For
Surface
example, if the step is 0.1 for both parameters, then there will be
visualization 11 ∗ 11 = 121 surface points.
process
Dynamically
generated If the step is 0.01, then there will be 101 ∗ 101 = 10201 surface points, with
points
subsequent increase in the detail of the rendering (and decrease in the
Examples
performance).
Bibliography
25. Dynamically generated points
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Introduction
The amount of points used to render a surface can be controlled with the u
Basis demo
and v parameters step. The smaller the step, the more points obtained. For
Surface
example, if the step is 0.1 for both parameters, then there will be
visualization 11 ∗ 11 = 121 surface points.
process
Dynamically
generated If the step is 0.01, then there will be 101 ∗ 101 = 10201 surface points, with
points
subsequent increase in the detail of the rendering (and decrease in the
Examples
performance).
Bibliography
Next there are some examples of grids of points interpolated in Matlab. The
generated surfaces are loaded in the application programmed in DirectX 11
and rendered with different steps for the parameters.
26. Examples
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Point grid and interpolated surface in Matlab (surface points in red, control
points in blue)
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
29. Examples
Parametric
surface vi-
sualization
in DirectX
11 (C++) Point grid and interpolated surface in Matlab (surface points in red, control
points in blue)
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
32. Examples
Parametric
surface vi-
sualization
in DirectX
11 (C++)
Point grid and interpolated surface in Matlab (surface points in red, control
points in blue)
Introduction
Basis demo
Surface
visualization
process
Dynamically
generated
points
Examples
Bibliography
35. Parametric
surface vi-
sualization
in DirectX
11 (C++)
Bibliography
Introduction
Basis demo G. Farin, J. Hoschek, and M. S. Kim.
Surface Handbook of Computer Aided Geometric Design.
visualization
process Elsevier, first edition, 2002.
Dynamically
generated Microsoft.
points
Direct3d 11 sdk documentation, October 2009.
Examples
Bibliography L. Piegl and W. Tiller.
The NURBS Book.
Springer, second edition, 1997.
A. Sherrod and W. Jones.
Beginning DirectX 11 Game Programming.
Course Technology, Cengage Learning, first edition, 2012.