Displacement Maps as a New Geometry Primitive - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Displacement Maps as a New Geometry Primitive

Description:

... nice and smooth, but no detail. Continuous LOD with nice silhouettes ... Nice silhouettes for rounded objects. Adjacent vertices must have identical normals! ... – PowerPoint PPT presentation

Number of Views:152
Avg rating:3.0/5.0
Slides: 28
Provided by: Mat96
Category:

less

Transcript and Presenter's Notes

Title: Displacement Maps as a New Geometry Primitive


1
Displacement Maps as a New Geometry Primitive
  • Juan Guardado
  • 3D Architecture Analysis Engineer
  • Meltdown 2001

2
Agenda
  • Motivation
  • Terminology
  • Algorithm
  • Tessellation
  • Displacement
  • Lighting
  • Results
  • API Considerations
  • Content Creation Tools
  • Conclusion

3
Motivation
  • Curved surfaces nice and smooth, but no detail
  • Continuous LOD with nice silhouettes
  • Bandwidth is crucial
  • 40MVtx (32 bytes, small!) 1.3GB/s
  • AGP4X at 1GB/s
  • System memory BW shared with CPU
  • Compression is enormous
  • Generate vertices on chip
  • Mesh-independent displacement maps

4
Motivation
?
5
Terminology
  • Displacement map
  • Medium resolution scalar height data in 2D
    texture
  • Normal map
  • High resolution map of tangent-space lighting
    normals
  • Base mesh
  • Low resolution mesh describing general shape of
    object
  • Tessellation
  • Amount of subdivision per base triangle, can vary
    by edge
  • Tangent space
  • Flatten geometry, interpolate incident vectors
    instead

6
Algorithm
  • Generate new vertex
  • Tessellate triangle
  • Interpolate across end points
  • Displace new vertex
  • Sample and filter displacement map
  • Displace along on interpolated normal

7
Algorithm
  • Tessellation
  • Interpolation
  • Tessellation Rate
  • Tessellation Type
  • Displacement
  • Pixel Lighting

8
Crack Prevention Notes
  • No cracks!
  • Ensure adjacent edges have identical
  • Vertex normals
  • Displacement direction
  • N patch interpolation
  • Vertex positions
  • Interpolation direction
  • Morphing direction
  • Z for distance-based LOD
  • Displacement data
  • Watch out for mip levels and borders
  • Only horizontal/vertical UV discontinuities

9
Interpolation
  • Linear or N Patch
  • Linear
  • No curvature, use on semi-flat surfaces (terrain)
  • Hard edges must have zero displacement
  • N Patch
  • Vertex positioned on cubic curve
  • Nice silhouettes for rounded objects
  • Adjacent vertices must have identical normals!
  • No hard edges, yet

10
Tessellation Rate
  • Each edge has distinct tessellation rate
  • Independent of each other
  • Adjacent edges tessellated identically
  • User defined or
  • Dependant on camera space
  • Identity rate at Z1
  • Displacement data should match tessellation
    resolution
  • Equilateral base triangles give best results

11
Discrete Tessellation
  • Allows for pre-computed displacements
  • Popping artifacts
  • Regeneration for dynamic displacement maps
  • Rate specified at integer levels
  • Usage scenario
  • Simple, small meshes
  • Popping doesnt matter

12
Adaptive Tessellation
  • Geomorphing, avoids popping
  • Floating point rates
  • Free LOD system
  • Dependent on camera space Z
  • Works on N patches
  • Can dynamically update maps
  • Usage scenario
  • Meshes benefiting from continuous LOD
  • Especially useful on abutted meshes

13
Tessellation Insights
  • Can control local tessellation through base mesh
  • Put more triangles in detailed areas
  • Also useful for N patch creases
  • Small displacement map size
  • Tessellation Rate Triangles spanned
  • Generate 1 vertex from 1 displacement value
  • Can offset tessellation rate and filtering per
    vertex

14
Sampling Displacements
  • Pre-computed samples
  • 8- or 16-bit integer data and 32-bit floating
    point
  • Dynamic sampling
  • 16-bit integer data preferred for memory
    footprint
  • UV coordinates
  • Linearly interpolated from base triangle
  • Best if continuous across mesh
  • Or ensure identical samples at different
    coordinates
  • Also across mip levels
  • Discontinuities must occur on horizontals/vertical
    s
  • Trilinear filtering
  • Mip mapping is inherently broken for borders
  • Can fix with addressing modes and border texels

15
Displacement Addressing Modes
  • Wrapping/UV wrapping avoids texel discontinuities
  • Mirroring fine except for vector data
  • Normal maps do not mirror
  • Clamping
  • Incorporate texture border along mip pyramid
  • Border color
  • Careful, may introduce ridges or valleys
  • Border texture
  • Can clamp to 100

16
Displacement
  • Vertex shader receives displacement value
  • Displace a new vertex along interpolated normal
  • Scale along direction as well

17
Displacement Insights
  • Works on a general mesh
  • Base mesh should preserve general shape
  • No cubes into starships, except for Borg
  • Displacements applied like textures
  • Follows texture addressing conventions
  • Mip level generation
  • Preserve volume (e.g. avoid greying peaks)
  • Multi-displacement maps by render texture
  • At vertex level in future

18
Lighting
  • Interpolated normal ? displaced normal
  • Cant really displace a normal anyway
  • Displaced lighting
  • Pixel lighting with high-resolution normal map
  • Detail normal maps
  • Receive tangent space normal
  • Pre-computed or procedurally generated
  • Perturb tangent space basis

19
Lighting Insights
  • Keep your normal map rotated properly
  • Vertex lighting produces color irregularities on
    CLOD
  • Normal maps generated from displacements
  • Beware of stretching/squishing
  • Apply displacement scale factor
  • Requires high resolution displacement map
  • Generate normal mip map from displacement mip map
  • Tangent space discontinuities will produce
    lighting artifacts
  • Smooth basis and normal differently

20
Crack Prevention Summary
  • Tessellation and interpolation guarantee no
    cracks
  • Work with us
  • Ensure adjacent edges have identical
  • Vertex positions to dictate interpolation
    direction
  • Vertex normals for N patch interpolation and
    displacement direction
  • UV discontinuities
  • Inner border texels
  • Horizontal/vertical discontinuities

21
Results Compression
  • Varies with
  • Vertex size
  • Stripification
  • Tessellation/displacement/normal map resolution
  • Bytes per triangle, stripified mesh
  • 44 bytes per vertex
  • Displacement value 1 byte
  • Displacement value Tessellated vertex
  • Recall displacement-map-to-tessellation relation
  • 1 byte ? 44 bytes

22
Results Demo
23
API Considerations
  • Texture stage state to control sampling and
    filtering
  • Programmable pipeline
  • Tessellator samples and filters
  • Displacement and normal available in vertex
    shader
  • Displace tessellated vertices at will!

24
Content Creation Tools
  • 3DStudio MAX 4 and Maya
  • Preview plug-in using this algorithm
  • Tessellation linkable library
  • Plug-in source available
  • Crack checker and corrector
  • D3DX has d-map generator
  • P-meshes to base mesh
  • Ray casts to resolve displacements
  • Others?

25
Conclusion
  • Very general algorithm
  • Analogous to texture mapping
  • No special vertex data required
  • Mesh independent
  • Works on N patches
  • Minimizes impact on content creation
  • Reuse bump map data (height, normal maps)
  • Compression rate 441

26
Call to Action
  • Get ready for displacement maps
  • Must educate artists
  • Low detail base mesh
  • Preserve general shape
  • Medium detail displacement map
  • No bigger than tessellationtriangles
  • High detail normal map
  • Generated from high detail displacement map

27
Questions
  • ?
  • Juan Guardado
  • jguardad_at_matrox.com
Write a Comment
User Comments (0)
About PowerShow.com