building blocks
DESCRIPTION
Building Blocks. Artist Driven Procedural Buildings James Golding - Epic Games. Who Am I. Started as Field Engineer at MathEngine Oxford, UK 1999-2003 Senior Programmer at Epic Games Raleigh, NC, USA Worked here for nearly 8 years Physics, animation, tools, gameplay… Shipped some games - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/1.jpg)
Building BlocksArtist Driven Procedural Buildings
James Golding - Epic Games
![Page 2: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/2.jpg)
Who Am I
• Started as Field Engineer at MathEngine– Oxford, UK– 1999-2003
• Senior Programmer at Epic Games– Raleigh, NC, USA– Worked here for nearly 8 years– Physics, animation, tools, gameplay…– Shipped some games
• Unreal Tournament 2003, 2004, UT3,
• Gears of War 1 & 2
![Page 3: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/3.jpg)
Who Is This Talk For
• Programmers
• Level Designers
• Technical Artists
• There is no code, I promise!
• Anyone who thinks about building big cities for games
![Page 4: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/4.jpg)
Our Goals
• Good looking buildings with high visual density
• Easily change shape and size for gameplay
• Automatically generate LODs
![Page 5: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/5.jpg)
Not Our Goals
• We are not interested in generating entire city with one button, or even an entire building, but decorating a building defined by designer.
![Page 6: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/6.jpg)
Existing Approaches• Use level geometry tools, cover with meshes
– Lots of work placing meshes– Painful to change meshing
• Build custom building meshes– Hard to adjust for gameplay – Each one needs LOD custom made
• Simple shapes with tiling material– Did not meet our visual bar
![Page 7: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/7.jpg)
New Approach
• Designer creates 'high level' description of building
• Artists build a library of rectangular, modular, facade meshes
• Artist creates 'ruleset' which describes how facade pieces are used
Initial idea from "Procedural Modeling of Buildings" by Müller et al. (2006, ETH Zurich)
![Page 8: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/8.jpg)
Additional Benefits
• Can easily change the look of each building
• Can totally change meshing approach
![Page 9: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/9.jpg)
Defining Building Shape
• Collection of simple shapes
![Page 10: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/10.jpg)
Defining Building Shape
• Apply ‘Ruleset’ to group
![Page 11: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/11.jpg)
Defining Building Shape
• Can easily modify building at any time
![Page 12: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/12.jpg)
Breaking It Down• Starting with a reference photo
![Page 13: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/13.jpg)
Breaking It Down• Artist breaks it into modular meshes
![Page 14: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/14.jpg)
Breaking It Down• Procedural system places meshes
![Page 15: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/15.jpg)
‘Scopes’
• A ‘scope’ is a 2D rectangle– Location– Orientation– Dimensions
• Tool takes 3D building shape and extracts set of scopes
![Page 16: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/16.jpg)
Extracting Rectangles
• Certain areas are not rectangular– Walls - if roof is not flat– Roof - if building plan is non-rectangular
• We make simple polygons to fill holes
• Don’t extract scope from roof– always just big polygon
![Page 17: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/17.jpg)
Extracting Rectangles
![Page 18: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/18.jpg)
Rules?
• Each rule can do one of two things:– Split a scope into smaller scopes– Place mesh that fills the scope area on the
building facade
• Forms a graph
![Page 19: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/19.jpg)
Rules?
• A grammar for describing facades– ‘Context Free’
• Graph of nodes good for a graphical tool– More visual = happy artists
![Page 20: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/20.jpg)
The Rules
![Page 21: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/21.jpg)
Mesh Rule
• Artist specifies – What mesh – X and Z extent that it fills
• Easy to scale and place instance – scale = desired size/defined size
![Page 22: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/22.jpg)
Mesh Rule
• Initial concerns over scaling of artist built meshes– System lets you specify which meshes are
scaled and which are not– Generally not visually noticeable with building-
type meshes– Needs to avoid tiny doors etc
![Page 23: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/23.jpg)
Repeat Rule
• Choose an axis (X or Z)• Break up scope along that axis into equal size pieces• Ensure no piece along axis is larger than defined
maximum size• Generates varying number of new scopes, depending on
building size
![Page 24: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/24.jpg)
Repeat Rule
![Page 25: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/25.jpg)
Split Rule
• Designer specifies axis and number of scopes to break into.
• Each split can be fixed size or variable.• Always require one of the splits to be variable.• If scope is too small to fit in fixed size areas, must
discard them.• Similar to windowing toolkits (wxSizer etc)
![Page 26: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/26.jpg)
Split Rule
![Page 27: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/27.jpg)
Alternate Rule
• Hard to achieve ABABA 'fence post' layout with just repeat and split.
• A is fixed, B is stretchy.
![Page 28: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/28.jpg)
Alternate Rule
![Page 29: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/29.jpg)
Occlusion Rule• Quickly find that meshes are being placed where not seen• Needed for intersections between buildings to look good
![Page 30: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/30.jpg)
Occlusion Rule
• Output is 'clear', 'blocked' or 'partial'– Don't place mesh if 'blocked'– Can choose different mesh depending on
'clear' and 'partial'
• Initially this was a separate rule node– Used so frequently, we included this into the
Mesh rule
![Page 31: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/31.jpg)
Occlusion Rule
![Page 32: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/32.jpg)
Top/Bottom Rule
• Don't want shop fronts at the bottom of every scope in building
• Performs different actions if bottom of scope is at bottom of entire building
• Does same thing for top (e.g. large trim at very top)
![Page 33: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/33.jpg)
Top/Bottom Rule
![Page 34: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/34.jpg)
Random Rule
• Does not resize scope
• Executes to N out of the M possible child Rules
• Allows meshes on top of each other– E.g. a Window mesh with random AC unit
and/or awning.
![Page 35: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/35.jpg)
Random Rule• Composite regions like random shopfronts
![Page 36: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/36.jpg)
Random Rule
![Page 37: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/37.jpg)
Random Rule
![Page 38: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/38.jpg)
Quad Rule
• Sometimes you DO want a tiling material
• Simple variation of Mesh Rule
• Adjusts UVs to tile base on scope size– Same logic as Repeat Rule
• Second non-tiling UV channel
![Page 39: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/39.jpg)
Quad Node
![Page 40: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/40.jpg)
Sub Ruleset
• Allow a Ruleset to refer to other Rulesets
• Complicated Rulesets can be reused.
• Terrifying prospect of recursive architecture!
![Page 41: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/41.jpg)
Size Rule
• Simple choice based on dimension– Useful for fixing ‘squeezing’
![Page 42: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/42.jpg)
Size Rule
Without Size Rule With Size Rule
![Page 43: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/43.jpg)
Variations
![Page 44: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/44.jpg)
Variations• Each side of a building may need to look
different
![Page 45: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/45.jpg)
Variations
• Initially allowed Level Designers to assign rulesets per-face– Corners usually looked bad– Artists had no control over ruleset
combinations
![Page 46: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/46.jpg)
Variations
• Each face of a building volume can have a variation ‘name’ set on it– Special rule node uses that to decide which
output to fire– Level designer can choose ‘front’, ‘side’ etc.– Ruleset designer can ensure they all match
nicely
![Page 47: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/47.jpg)
Variations
Context menu on each face offers variations created by artist
![Page 48: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/48.jpg)
Variations
![Page 49: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/49.jpg)
Corners
![Page 50: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/50.jpg)
Trim And Corners
• Making trim work around corners is one of the hardest parts
• We came up with three approaches to decorating corners
![Page 51: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/51.jpg)
Trim And Corners• Build Rulesets with flat edges
– Only really possible with modern architecture
![Page 52: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/52.jpg)
Trim And Corners• Cover corner with mesh, at average angle
between faces– LDs did this manually on previous games
![Page 53: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/53.jpg)
Trim And Corners• Building custom corner pieces
– use custom Rule to pick correct piece based on angle– lots of custom meshes need making– limit LD to certain angles
![Page 54: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/54.jpg)
Corner Rule• Each scope ‘owns’ its left edge• Use angle to scope on left to pick mesh• Asks scope to right how much ‘space’ to leave
there
![Page 55: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/55.jpg)
Corner Rule
• Allows mixing rule sets with different corner sizes
![Page 56: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/56.jpg)
Corner Rule
• This requires edge<->scope map– Array of ‘top level scopes’– Array of ‘edges’
• I am scope 3’s left edge and scope 12’s right edge• This is my start and end location• This is my angle
• Build this map as part of scope extraction
![Page 57: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/57.jpg)
Corner Rule
• Requires each edge to only have 2 scopes
![Page 58: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/58.jpg)
Corner Rule
• Split entire building at each roof level
![Page 59: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/59.jpg)
Corner Rule
• Also produces pleasing architecture
![Page 60: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/60.jpg)
Corner Rule
![Page 61: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/61.jpg)
Other Features
![Page 62: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/62.jpg)
Roof• Curved Corners
– From each vertex of roof poly, can find its Corner Rule– Add options to Corner Rule to describe corner shape– Use that to reshape the corner
![Page 63: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/63.jpg)
Roof
![Page 64: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/64.jpg)
Floor• Option to run rules ‘on top’ of big floor poly
![Page 65: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/65.jpg)
Player Collision
• Can use the simple 'building volume’– Fast– Smooth
• Certain meshes can be flagged as having collision in addition to this
![Page 66: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/66.jpg)
Parameters• Expose parameters in shaders applied to
building pieces– Wall Diffuse and Specular Color– Window Diffuse and Specular Color
• Gives more variation for no memory cost
![Page 67: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/67.jpg)
Rendering Approach
• Buildings tend to be made of many copies of a few meshes – trim, window frame, columns…
• Lots of draw calls
• Initially tried merging meshes to reduce sections– Huge vertex/index buffers!
![Page 68: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/68.jpg)
Rendering Approach
• Instanced rendering!
• Different on all 3 platforms– Need to duplicate index buffer etc.
• Trade-off index buffer memory for speed
![Page 69: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/69.jpg)
Window Interiors
![Page 70: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/70.jpg)
Window Interiors• Three textures - one for each depth
![Page 71: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/71.jpg)
Window Interiors• Use mask to offset texture UV based on cam
vector
![Page 72: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/72.jpg)
Window Interiors• Pack all masks into one texture
![Page 73: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/73.jpg)
LOD
![Page 74: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/74.jpg)
Building LOD
• Low LOD mesh is automatically created– Mesh the same shape as the volume used to
construct building
• Renders high detail meshes into texture– All faces atlassed into one texture
• Low LOD mesh is always loaded– Textures can stream in different mip levels
![Page 75: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/75.jpg)
Building LOD
![Page 76: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/76.jpg)
Windows
• Buildings all have glass windows – reflective with cubemaps – LOD needs a mask for reflective windows – losing reflection creates very noticeable pop
![Page 77: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/77.jpg)
Windows
Diffuse Window Mask Lighting
We render 3 passes:
![Page 78: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/78.jpg)
Windows
Diffuse + Window Mask Mask stored as 1 bit alpha in DXT1
Lighting Lower resolution
![Page 79: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/79.jpg)
Windows
• Advantages to 2 texture approach:– Lighting texture can be lower resolution– Lets us light cubemap ‘glass’ areas– Allows building instances
• Share Diffuse but unique Lighting• Reduces variety of buildings, but uses less LOD
texture memory
![Page 80: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/80.jpg)
Building LOD
![Page 81: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/81.jpg)
Transitions
• Using dither approach to transition
• Objects attached to building change when building does– A/C units, pipes, signs etc– Captured by render-to-texture process
![Page 82: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/82.jpg)
Transitions
![Page 83: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/83.jpg)
Transitions
![Page 84: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/84.jpg)
LOD Quad
• Idea for automatic intermediate LOD• All meshes after rule collapse to single quad• Quad uses LOD texture
![Page 85: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/85.jpg)
LOD Quad
![Page 86: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/86.jpg)
What’s Next
![Page 87: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/87.jpg)
What’s Next
• More orthogonal variation ‘channels’
• Decal support within ruleset
• Apply rules to triangular regions
• Interiors– Transition (doors)– Collision
![Page 88: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/88.jpg)
Conclusion
![Page 89: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/89.jpg)
Conclusion
• Good looking buildings with high visual density
• Easily change shape and size for gameplay
• Automatically generate LODs
![Page 90: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/90.jpg)
Conclusion
• Keeps artist and level designer workflows from colliding
• One change to a ruleset, the whole city changes
• Artists willing to learn a crazy new system and push it are invaluable and awesome
• Thanks Pete
![Page 91: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/91.jpg)
Conclusion• Rulesets everywhere!
![Page 92: Building Blocks](https://reader035.vdocuments.us/reader035/viewer/2022062422/56813a08550346895da1d826/html5/thumbnails/92.jpg)