Parametric surface visualization in Directx 11 and C++

  • 1,018 views
Uploaded on

This presentation shows how to visualize parametric surfaces in DirectX 11. It has been programmed in C++, and performs standard per-pixel lighting.

This presentation shows how to visualize parametric surfaces in DirectX 11. It has been programmed in C++, and performs standard per-pixel lighting.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,018
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Parametricsurface vi-sualizationin DirectX11 (C++) Parametric surface visualization in DirectX 11 (C++)IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography Alejandro Cosin Ayerbe August 2012
  • 2. IntroductionParametricsurface vi-sualizationin DirectX11 (C++) DescriptionIntroductionBasis demo Based on my final project in bachelor’s degree in Mathematics (aSurface slideshare presentation can be seen here), which was programmed invisualizationprocess Matlab.DynamicallygeneratedpointsExamplesBibliography
  • 3. IntroductionParametricsurface vi-sualizationin DirectX11 (C++) DescriptionIntroductionBasis demo Based on my final project in bachelor’s degree in Mathematics (aSurface slideshare presentation can be seen here), which was programmed invisualizationprocess Matlab.Dynamically A translation was made from Matlab to C++.generatedpointsExamplesBibliography
  • 4. IntroductionParametricsurface vi-sualizationin DirectX11 (C++) DescriptionIntroductionBasis demo Based on my final project in bachelor’s degree in Mathematics (aSurface slideshare presentation can be seen here), which was programmed invisualizationprocess Matlab.Dynamically A translation was made from Matlab to C++.generatedpoints The goal is to represent interpolating and approximating parametricExamples surfaces (like NURBS surfaces) in DirectX 11 with an arc ball camera.Bibliography
  • 5. IntroductionParametricsurface vi-sualizationin DirectX11 (C++) DescriptionIntroductionBasis demo Based on my final project in bachelor’s degree in Mathematics (aSurface slideshare presentation can be seen here), which was programmed invisualizationprocess Matlab.Dynamically A translation was made from Matlab to C++.generatedpoints The goal is to represent interpolating and approximating parametricExamples 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. IntroductionParametricsurface vi-sualizationin DirectX11 (C++) DescriptionIntroductionBasis demo Based on my final project in bachelor’s degree in Mathematics (aSurface slideshare presentation can be seen here), which was programmed invisualizationprocess Matlab.Dynamically A translation was made from Matlab to C++.generatedpoints The goal is to represent interpolating and approximating parametricExamples 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. IntroductionParametricsurface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in thesualizationin DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control11 (C++) points Pi,j .IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 8. IntroductionParametricsurface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in thesualizationin DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control11 (C++) points Pi,j .Introduction For example, given the set of pointsBasis demoSurfacevisualization 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)}DynamicallygeneratedpointsExamplesBibliography
  • 9. IntroductionParametricsurface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in thesualizationin DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control11 (C++) points Pi,j .Introduction For example, given the set of pointsBasis demoSurfacevisualization 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)}Dynamicallygeneratedpoints a surface of degree (2, 2) interpolating this points is given by the followingExamples data: knot vectorsBibliography 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. IntroductionParametricsurface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in thesualizationin DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control11 (C++) points Pi,j .Introduction For example, given the set of pointsBasis demoSurfacevisualization 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)}Dynamicallygeneratedpoints a surface of degree (2, 2) interpolating this points is given by the followingExamples data: knot vectorsBibliography 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. IntroductionParametricsurface vi- Parametric surfaces like NURBS are defined by a set of data, consisting in thesualizationin DirectX degree (p, q) of the surface, two knot vectors U and V , and a grid of control11 (C++) points Pi,j .Introduction For example, given the set of pointsBasis demoSurfacevisualization 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)}Dynamicallygeneratedpoints a surface of degree (2, 2) interpolating this points is given by the followingExamples data: knot vectorsBibliography 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. IntroductionParametricsurface vi-sualization An example in Matlab of the previous grid of points (in green), and anin DirectX11 (C++) interpolant surface generated (control points in blue, interpolated points in red) can be seen below:IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 13. Basis demoParametricsurface vi-sualizationin DirectX11 (C++) In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and canIntroduction be modified to be controlled with pc keyboard and mouse.Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 14. Basis demoParametricsurface vi-sualizationin DirectX11 (C++) In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and canIntroduction be modified to be controlled with pc keyboard and mouse.Basis demoSurface Reading from a text file the degree, knot vectors and control points of avisualizationprocess parametric surface, a grid of surface points can be generated dynamically.DynamicallygeneratedpointsExamplesBibliography
  • 15. Basis demoParametricsurface vi-sualizationin DirectX11 (C++) In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and canIntroduction be modified to be controlled with pc keyboard and mouse.Basis demoSurface Reading from a text file the degree, knot vectors and control points of avisualizationprocess parametric surface, a grid of surface points can be generated dynamically.Dynamicallygeneratedpoints This requires programming some functions that allow to evaluate the value ofExamples a surface S at desired parameter values u and v , i.e., to obtain the value ofBibliography S(u, v ), which will be a three dimensional point.
  • 16. Basis demoParametricsurface vi-sualizationin DirectX11 (C++) In the chapter eight of [4], an arc-ball camera for Xbox 360 is made, and canIntroduction be modified to be controlled with pc keyboard and mouse.Basis demoSurface Reading from a text file the degree, knot vectors and control points of avisualizationprocess parametric surface, a grid of surface points can be generated dynamically.Dynamicallygeneratedpoints This requires programming some functions that allow to evaluate the value ofExamples a surface S at desired parameter values u and v , i.e., to obtain the value ofBibliography 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 PointsParametricsurface vi- The next image shows a grid of surface points generated for the same surfacesualization as seen in the previous slide. Each point is represented with a quad, generatedin DirectX11 (C++) through the Geometry Shader:IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 18. Surface PointsParametricsurface vi-sualizationin DirectX11 (C++) This set of points can be used to form triangles and render these trianglesIntroduction through an index buffer, in order to obtain a representation of the surface:Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 19. Adding per-pixel lightingParametricsurface vi-sualizationin DirectX11 (C++) It is possible to add lighting effects to the surface such as standard per-pixelIntroduction lighting. Normal vectors will be needed, so they must be estimated in someBasis demo way.SurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 20. Adding per-pixel lightingParametricsurface vi-sualizationin DirectX11 (C++) It is possible to add lighting effects to the surface such as standard per-pixelIntroduction lighting. Normal vectors will be needed, so they must be estimated in someBasis demo way.Surfacevisualizationprocess Given the points A, B and C that form each triangle in the surface, anDynamicallygenerated acceptable estimation of the normal vector at the point A can be obtainedpoints −→ −→ performing the cross product of the vectors AB and AC .ExamplesBibliography
  • 21. Adding per-pixel lightingParametricsurface vi-sualizationin DirectX11 (C++) It is possible to add lighting effects to the surface such as standard per-pixelIntroduction lighting. Normal vectors will be needed, so they must be estimated in someBasis demo way.Surfacevisualizationprocess Given the points A, B and C that form each triangle in the surface, anDynamicallygenerated acceptable estimation of the normal vector at the point A can be obtainedpoints −→ −→ performing the cross product of the vectors AB and AC .ExamplesBibliography 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 lightingParametricsurface vi-sualization The image below shows a surface rendering in the left, and the same surfacein DirectX11 (C++) rendered whith per-pixel lighting:IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 23. Dynamically generated pointsParametricsurface vi-sualizationin DirectX11 (C++)Introduction The amount of points used to render a surface can be controlled with the uBasis demo and v parameters step. The smaller the step, the more points obtained. ForSurface example, if the step is 0.1 for both parameters, then there will bevisualization 11 ∗ 11 = 121 surface points.processDynamicallygeneratedpointsExamplesBibliography
  • 24. Dynamically generated pointsParametricsurface vi-sualizationin DirectX11 (C++)Introduction The amount of points used to render a surface can be controlled with the uBasis demo and v parameters step. The smaller the step, the more points obtained. ForSurface example, if the step is 0.1 for both parameters, then there will bevisualization 11 ∗ 11 = 121 surface points.processDynamicallygenerated If the step is 0.01, then there will be 101 ∗ 101 = 10201 surface points, withpoints subsequent increase in the detail of the rendering (and decrease in theExamples performance).Bibliography
  • 25. Dynamically generated pointsParametricsurface vi-sualizationin DirectX11 (C++)Introduction The amount of points used to render a surface can be controlled with the uBasis demo and v parameters step. The smaller the step, the more points obtained. ForSurface example, if the step is 0.1 for both parameters, then there will bevisualization 11 ∗ 11 = 121 surface points.processDynamicallygenerated If the step is 0.01, then there will be 101 ∗ 101 = 10201 surface points, withpoints subsequent increase in the detail of the rendering (and decrease in theExamples 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. ExamplesParametricsurface vi-sualizationin DirectX11 (C++) Point grid and interpolated surface in Matlab (surface points in red, control points in blue)IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 27. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.1Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 28. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.01Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 29. ExamplesParametricsurface vi-sualizationin DirectX11 (C++) Point grid and interpolated surface in Matlab (surface points in red, control points in blue)IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 30. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.1Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 31. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.01Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 32. ExamplesParametricsurface vi-sualizationin DirectX11 (C++) Point grid and interpolated surface in Matlab (surface points in red, control points in blue)IntroductionBasis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 33. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.1Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 34. ExamplesParametricsurface vi-sualizationin DirectX11 (C++)Introduction u and v step are 0.01Basis demoSurfacevisualizationprocessDynamicallygeneratedpointsExamplesBibliography
  • 35. Parametricsurface vi-sualizationin DirectX11 (C++) BibliographyIntroductionBasis demo G. Farin, J. Hoschek, and M. S. Kim.Surface Handbook of Computer Aided Geometric Design.visualizationprocess Elsevier, first edition, 2002.Dynamicallygenerated Microsoft.points Direct3d 11 sdk documentation, October 2009.ExamplesBibliography 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.