1 / 10

Procedural Geometry Synthesis on the GPU

Procedural Geometry Synthesis on the GPU Patrick Lacz and John C. Hart University of Illinois, Urbana-Champaign

niveditha
Download Presentation

Procedural Geometry Synthesis on the GPU

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Procedural Geometry Synthesison the GPU Patrick Lacz and John C. HartUniversity of Illinois, Urbana-Champaign We present a technique for creating and rendering procedurally generated geometry, such as that created by an L-system, completely on the GPU using the recent render-to-vertex-array functionality. Highlights:  Symbols, graphics state stored in texture.  Productions coded as fragment programs  Iteration via render-to-texture  Rendering via render-to-vertex-array TextureMemory VertexShader FragmentShader

  2. Transformation of an L-System L→aLf[+L]Lf[-L]L Goal: Generate geometry resulting from iteration of a single production that grows each cylindrical segment into a branching pattern of five segments Trick: Decompose the production into set of productions each yielding a single segment L→{aL,af+L,afL,aff−L,affL} Note: Each production modifies state, then instances itself (L) a: scale f: move forward +: rotate CCW –: rotate CW [: push state ]: pop state

  3. Scene-Graph Transformation Productions in this form (left) can be transformed into a scene graph (right). Non-terminal symbol on production’s LHS corresponds to a union node. State-changing terminal symbols on production right-hand side are combined into single affine transformation node. Two iterations of these productions results in 25 instances of a cylindrical segment. 2 iters. L L→aLL→af+LL→afLL→aff−LL→affL a af+ af aff- aff L L L L L Union node Transformation node

  4. Encoding Into Fragments & Texture In this form, productions take the form of a scene graph: each node is expanded into a collection of child nodes, each with an aggregate transformation encoded here as x,y position, rotation angle and scale L→{aL,af+L,afL,aff−L,affL} Each node consists of a symbol and its accumulated state, and is stored as a single pixel in a deep 1-D texture, called the symbol-state texture. Each column above is a symbol-state texture. A single application of the productions on a symbol-state texture generates a new symbol-state texture.

  5. Representation Each buffer can contain only a limited amount of data. To store all the required data, we use a deep buffer. We maintain several buffers for which there is a pixel-level correspondence; the data is distributed across this set of buffers. For our algorithm, this means we must apply our programs once per buffer. The 2-D buffer is processed in 1-D using modular arithmetic. Context sensitive productions can also be supported by examining the 1-D neighbors. 6 7 8 3 4 5 6 7 8 7 0 1 2 3 4 5 6 8 0 1 2 3 4 5 context-sensitive lookups can be made data for one symbol 0 1 2 texture 0 texture 1

  6. GPU Production Iteration All productions are applied to all symbol-state elements.Productions that don’t match the input symbol output an Ø-symbol. A<x=0,y=0,q=0> B<0,0,+90> Ø<0,0,+180> B<0,0,-90> Ø<0,0,0> A→+B A→-B B→fA Ø<1,0,0> Ø<0,1,+90> Productions:(coded as frag. progs) Ø<0,0,0> Ø<0,0,-180> Ø<0,-1,-90> A<0,1,+90> p = # of productions Input symbol-state texture = n deep pixels Output symbol-state texture = p*n deep pixels For each production i = 0 … p-1 Execute frag. prog. i on pixels i*n + (0 … n-1) A<0,-1,-90> Ø<2,0,0> This is a lot ofwork and spacefor two results!

  7. Remove Ø entries from symbol-state texture Use occlusion query to determine # of non-Ø symbols Maintain original order otherwise to preserve context sensitivity Ø<0,0,+180> A<0,1,+90> Sort Cull Ø<0,0,0> A<0,-1,-90> Ø<0,1,+90> Ø<0,0,+180> Ø<0,0,0> Ø<0,0,0> A<0,1,+90> Ø<0,0,-180> Ø<0,1,+90> A<0,-1,-90> Ø<0,-1,-90> Ø<0,0,0> A<0,1,+90> Ø<0,0,-180> A<0,-1,-90> Ø<0,-1,-90> Ø<2,0,0> Ø<2,0,0> Symbol-State Processing via Sorting

  8. Multistage Bitonic Sort A bitonic sort creates a sorting network requiring no flow-control decisions which makes it ideal for SIMD processing. We implement multiple stages of the bitonic sort in a single fragment program to reduce context-switch overhead. On an NV30, this optimization accelerates the sorting of up to 2048 elements. 0 1 2 3 4 5 Stage fragment program fragment program

  9. Convert terminal symbols to geometry directly on the graphics card to avoid costly readback Use bitonic sort to collect terminal symbols and their associated state (e.g. create one collection of branches and another of leaves) Vertex shader accesses state stored in texture memory and instances pre-stored indexed-face-set at the proper position, scale and orientation Rendering

  10. References Buck I., Purcell T.: A toolkit for computation on GPUs. In GPUGems : Programming Techniques, Tips, and Tricks for Real-Time Graphics, Fernando R., (Ed.), 1st ed. Addison-Wesley, 2004. Hart J. C.: The object instancing paradigm for linear fractal modeling. In Proc. of Graphics Interface (1992), Morgan Kaufmann, pp. 224–231. Karwowski R., Prusinkiewicz P.: Design and Implementation of the L+C Modeling Language. PhD thesis, University of Calgary, 2003. Luis F. Ortiz R. Y. P., Pinter S. S.: An array language for data parallelism: Definition, compilation, and applications. Journal of Supercomputing 5, 1 (1991), 7–29. Mĕch R., Prusinkiewicz P.: Generating subdivision curves with l-systems on a GPU. In Proc. of the SIGGRAPH 2003 conference on Sketches & applications (2003), ACM Press, pp. 1–1. Purcell T. J., Donner C., Cammarano M., Jensen H. W., Hanrahan P.: Photon mapping on programmable graphics hardware. In Proc. of the ACM SIGGRAPH/EUROGRAPHICS conference on Graphics hardware (2003), Eurographics Association, pp. 41–50.

More Related