SlideShare a Scribd company logo
1 of 35
Download to read offline
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
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
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
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
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.
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.
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
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
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},
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 } =
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)}
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
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
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
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.
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).
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
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
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
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
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.
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
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
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
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.
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
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.1
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.01
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
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
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.1
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.01
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
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
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.1
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
Examples

Parametric
surface vi-
sualization
in DirectX
11 (C++)



Introduction               u and v step are 0.01
Basis demo

Surface
visualization
process

Dynamically
generated
points

Examples

Bibliography
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.

More Related Content

Similar to Parametric surface visualization in Directx 11 and C++

CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingMark Kilgard
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesDouglas Lanman
 
Degree cad 6_th sem
Degree cad 6_th semDegree cad 6_th sem
Degree cad 6_th semPRADIPDARJI3
 
Design and minimization of reversible programmable logic arrays and its reali...
Design and minimization of reversible programmable logic arrays and its reali...Design and minimization of reversible programmable logic arrays and its reali...
Design and minimization of reversible programmable logic arrays and its reali...Sajib Mitra
 
On image intensities, eigenfaces and LDA
On image intensities, eigenfaces and LDAOn image intensities, eigenfaces and LDA
On image intensities, eigenfaces and LDARaghu Palakodety
 
Introducing AlloyUI DiagramBuilder
Introducing AlloyUI DiagramBuilderIntroducing AlloyUI DiagramBuilder
Introducing AlloyUI DiagramBuilderEduardo Lundgren
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...JinTaek Seo
 
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingBuild Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingDouglas Lanman
 
Module 2 logic gates
Module 2  logic gatesModule 2  logic gates
Module 2 logic gatesDeepak John
 
Lect8 viewing in3d&transformation
Lect8 viewing in3d&transformationLect8 viewing in3d&transformation
Lect8 viewing in3d&transformationBCET
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedis Labs
 
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Austin Benson
 
LAC2013 UNIT preTESTs!
LAC2013 UNIT preTESTs!LAC2013 UNIT preTESTs!
LAC2013 UNIT preTESTs!A Jorge Garcia
 
Digital logic design1
Digital logic design1Digital logic design1
Digital logic design1jntuworld
 
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSE
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSEAU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSE
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSEThiyagarajan G
 
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Spark Summit
 

Similar to Parametric surface visualization in Directx 11 and C++ (20)

CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
Degree cad 6_th sem
Degree cad 6_th semDegree cad 6_th sem
Degree cad 6_th sem
 
Design and minimization of reversible programmable logic arrays and its reali...
Design and minimization of reversible programmable logic arrays and its reali...Design and minimization of reversible programmable logic arrays and its reali...
Design and minimization of reversible programmable logic arrays and its reali...
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
On image intensities, eigenfaces and LDA
On image intensities, eigenfaces and LDAOn image intensities, eigenfaces and LDA
On image intensities, eigenfaces and LDA
 
Introducing AlloyUI DiagramBuilder
Introducing AlloyUI DiagramBuilderIntroducing AlloyUI DiagramBuilder
Introducing AlloyUI DiagramBuilder
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
 
Windows and viewport
Windows and viewportWindows and viewport
Windows and viewport
 
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingBuild Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
 
Module 2 logic gates
Module 2  logic gatesModule 2  logic gates
Module 2 logic gates
 
Lect8 viewing in3d&transformation
Lect8 viewing in3d&transformationLect8 viewing in3d&transformation
Lect8 viewing in3d&transformation
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
 
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
 
Aistats RTD
Aistats RTDAistats RTD
Aistats RTD
 
LAC2013 UNIT preTESTs!
LAC2013 UNIT preTESTs!LAC2013 UNIT preTESTs!
LAC2013 UNIT preTESTs!
 
Digital logic design1
Digital logic design1Digital logic design1
Digital logic design1
 
Basic R
Basic RBasic R
Basic R
 
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSE
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSEAU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSE
AU QP Answer key NOv/Dec 2015 Computer Graphics 5 sem CSE
 
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
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
  • 27. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.1 Basis demo Surface visualization process Dynamically generated points Examples Bibliography
  • 28. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.01 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
  • 30. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.1 Basis demo Surface visualization process Dynamically generated points Examples Bibliography
  • 31. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.01 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
  • 33. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.1 Basis demo Surface visualization process Dynamically generated points Examples Bibliography
  • 34. Examples Parametric surface vi- sualization in DirectX 11 (C++) Introduction u and v step are 0.01 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.