submitted version -confidential - Pascal Gautron

advantage of the geometry generation capabilities of graphics hard- ware. We delay the ..... surfacic objects in 3D are composed of elements of dimension 0. (vertices) ..... levels of detail leveraging GPU Shape Grammars, hence allowing.
2MB taille 1 téléchargements 342 vues
GPU Shape Grammars Cyprien Buron†

Pascal Gautron‡ Technicolor Research & Innovation

Patrice Hirtzlin§

Ga¨el Sourimant¶

TI A

L

Jean-Eudes Marvie∗

V

ER

IT T

ED

CR Categories: F.4.2 [Mathematical Logic and Formal Languages]: Grammars and Other Rewriting Systems— [I.3.5]: Computer Graphics—Computational Geometry and Object Modeling I.3.7 [Computer Graphics]: Three Dimensional Graphics and Realism— [J.6]: Computer Aided Engineering—Computer-Aided Design (CAD)

BM

Keywords: Procedural Modeling, Shape Grammars, L-Systems, Architectural Modeling, Vegetation Modeling, Interactive Modeling and Rendering

SU

∗ e-mail:[email protected] † e-mail:[email protected] ‡ e-mail:

[email protected] [email protected] ¶ e-mail: [email protected]

§ e-mail:

Modeling the massive, highly detailed environments used in current video games and cinema post-production requires intensive artistic input. The geometry of those environments can be handled in real-time by game engines, to the extent of the available graphics memory. In the context of production rendering, the creativity is often restrained by the lack of appropriate real-time feedback. The elements of complex scenes are often modeled independently, while the assembly is performed on very low-resolution models to preserve interactivity. Once assembled the memory footprint of the scene commonly exceeds the memory available on commodity hardware, hence requiring specific preprocessings and out-of-core schemes for visualization.

-C

N

SI

O

GPU Shape Grammars provide a solution for interactive procedural generation, tuning and visualization of massive environment elements for both video games and production rendering. While previous approaches are based on the generation of detailed models prior to rendering, we reformulate the grammar expansion to take advantage of the geometry generation capabilities of graphics hardware. We delay the generation of fully detailed model until the fragment shading stage, hence avoiding unnecessary storage of detailed models. GPU Shape Grammars integrates within a scalable framework by introducing automatic generation of multiple levels of detail at reduced cost. We apply our solution to the interactive generation and rendering of massive scenes containing thousands of buildings and trees.

Introduction

N

1

O

Abstract

FI

D

EN

Figure 1: We introduce a novel approach to interactive procedural generation of the constitutive elements of large-scale environments such as buildings and vegetation. The grammar representation of the objects is reformulated for fast expansion on graphics hardware. GPU Shape Grammars can store an inexpensive intermediate representation of partially expanded models in graphics memory. Our solution allows for interactive design, editing and navigation in massive environments. The geometry of this scene comprises 116573 buildings and 561280 trees, generated and rendered at 7.5, 11.8 and 8.3fps (from left to right).

The amount of user interaction can be drastically reduced by procedural modeling, which exploits the repetitive patterns typically present in buildings, cities and organic shapes. Instead of explicitly modeling the scene elements, the artist selects a procedure describing the construction rules for the object or family of objects. Using a collection of elementary (possibly high definition) shapes provided by the artist, the actual geometry of entire families of objects is then generated automatically, sparing the user from modeling the entire object structure. However, modifying a single parameter of the construction rules may require regenerating the entire object, resulting in a loss of interactivity. This issue scales with the size of the generated environments: large sceneries such as virtual cities comprise many objects generated from a small set of construction rules. Modifying a rule then involves a full generation and storage of all the related models (Figure 2a), resulting in delays in the design workflow. Furthermore, the memory occupancy of a large set of fully detailed objects quickly rises to prohibitive levels. We introduce a new method for real-time modeling and visualization of complex environment elements using procedural modeling. Our method expands construction rules on the fly using the geometry generation capabilities of modern graphics hardware. We propose a complete pipeline for the generation and rendering of procedural models, avoiding the explicit storage of the scene geometry (Figure 2b). Our solution is easily integrable within existing rendering workflows, bringing the advantages of procedural modeling within the reach of real-time rendering engines, for which computational and memory efficiencies are mandatory.

to the generation parameters. Those original approaches for procedural modeling of vegetation and buildings simplify the modeling task when generating a wide variety of objects following similar construction rules. However, the evaluation cost of the grammar rules might prevent interactive previewing and editing of complex models obtained by procedural generation. Also, the fully amplified geometry of the generated sceneries must be stored prior to rendering, leading to nonnegligible costs in terms of both main and graphics memories.

(a) Classical generation pipeline

D

EN

TI A

L

To overcome this problem, several techniques leverage the computational power of graphics hardware to improve the modeling workflow through increased interactivity. Among them, [Haegler et al. 2010] introduces a grammar representation suitable for fast GPU generation. The overall facade textures are generated on the GPU by assembling 2D textures representing the facade elements. While this technique proves effective for reducing the generation time, the result of grammar expansion is explicitly stored in a texture atlas, resulting in high memory consumption even using the proposed compression scheme.

FI

The generation of geometry variations is addressed in [Marvie et al. 2011], in which the grammar is expanded directly within graphics hardware. For each pixel this technique lazily determines which facade element is visible. The geometry of the elements, stored within geometry images [Gu et al. 2002], is then ray-traced and shaded to obtain the final pixel appearance. This technique solves the problem of memory consumption by avoiding any explicit geometry generation. A side effect is also an increased interactivity: the grammar being evaluated for each pixel, the generation parameters can be modified on the fly at no additional cost. While providing interactive performance even with massive models, the costs of per-pixel grammar expansion and ray tracing becomes prohibitive when rendering high definition terminal shapes.

N

(b) GPU Shape Grammars

O

N

-C

O

Figure 2: Our procedural pipeline maps the expression power of procedural modeling to the requirements of graphics hardware. We compile the grammars into an efficient structure for fast expansion of the rules. This latter generates a lightweight intermediate representation of the components arrangement within the modeled objects. The actual geometry is then generated on the fly to avoid explicit storage.

Technical Background

ED

2

V

ER

SI

Section 2 considers some of the most relevant previous work. In Section 3 we introduce the foundations of GPU Shape Grammars, and discuss a generic pipelined architecture for the generation of highly detailed procedural models (Sections 4 to 6 ). We apply our approach to the generation of buildings and vegetation on graphics hardware (Section 7), and introduce batched generation and detail management for massive environments (Sections 8 and 9).

IT T

Procedural modeling has been a highly active research area in the last decades [Wonka et al. 2007]. This section presents the previous work we feel most related to the contributions of this paper.

SU

BM

An approach towards procedural modeling is based on the following observation: the growth of a plant can be modeled by the expansion of a grammar. Prusinkiewicz and Lindenmayer [1990] describe the use of L-Systems [Lindenmayer 1968] for the modeling of vegetation using grammars. Based on the behavior of real plants, a grammar describing growth rules can be associated to each species. A fully detailed plant model can then be obtained by expanding the grammar using a small set of parameters describing the individual properties of the plant. Using this principle, a high level of diversity can typically be achieved using a single grammar and random sets of parameters. Besides vegetation, the repetitive patterns of buildings make procedural modeling a method of choice for automatic architectural generation. In most approaches [Wonka et al. 2003; Marvie et al. 2005; Muller et al. 2006] the high-level structure of the buildings is modeled using a set of rules, while artists provide the shapes of the constitutive elements of the facades. The result is a set of assembled elements representing the facades of the buildings according

In this paper we propose a solution combining the avoidance of explicit geometry storage of [Marvie et al. 2011] with the efficiency of the geometry rasterization on graphics hardware allowed by classical approaches [Muller et al. 2006]. We harness the tessellation power of graphics processors for on the fly production of highly detailed geometric models suitable for closeup views. As the rendering of massive scenes would be heavily geometry-bound, we introduce seamless transitions towards per-pixel grammar expansion according to the screen coverage of the objects.

3

Procedural Pipeline

Procedural generation techniques are usually based on the refinement of a data structure at each step of the grammar expansion. However, the efficiency of the graphics pipeline comes from a highly parallel, stage-based structure in which only specific information is transferred across the stages. We build upon this structure to introduce an efficient workflow for procedural generation on graphics hardware. Based on Chomsky grammars [Chomsky 1965], our solution supports both growth and reduction operations and is usable for most purposes of procedural modeling. As shown in Figure 2 our approach is divided into three main components: the rule compiler, the rule expander and the terminal evaluator. The need for a CPU-based rule compiler comes from the following observations: grammars represent high level mechanisms while GPU shaders support relatively low level operations. The rule compiler then converts a set of rules into shader programs. The compiler extracts a generic expansion graph from the rules and convert this graph into an interpretable form stored within the rule map. Each node of the graph is associated to a set of expressions representing the run-time behavior of the rule with respect to the parameters of

W A B C D E

the grammar. Those expressions are extracted by the compiler and assembled with a generic GPU-based rule map interpreter to generate an expression-instantiated interpreter dedicated to the grammar. Finally, the grammar parameters are packed into a parameter map for fast access. The rule expander then runs our interpreter on graphics hardware to traverse the rule map according to the generation parameters. For each node, the expression-instantiated interpreter evaluates the corresponding expression and performs a depth-first traversal. The output of the traversal is a lightweight set of terminal symbols only describing the structure of the generated object: the actual geometry is not generated at this stage for high speed processing and low memory usage.

Extrude(10){A,B} Shape(shapeId) Cond(recLevel