Karljohan Lundin Palmerius - weber.itn.liu.se
Transcript of Karljohan Lundin Palmerius - weber.itn.liu.se
![Page 1: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/1.jpg)
Realtime Rendering
Karljohan Lundin Palmerius
![Page 2: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/2.jpg)
About Me● Karljohan Lundin Palmerius● Ph.D. in Scientific Visualization● Research on multimodal visualization
![Page 3: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/3.jpg)
Course Contents● Realtime Rendering
– goals, conditions, concepts, algorithms● Parallel Processing
– architectures and programming● Graphics Hardware
– mobile graphics, shading languages● Self study course
![Page 4: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/4.jpg)
Course ContentsRealtime Rendering KJ
RtR cont. KJ
Parallel Architectures MC
Parallel Programming MC
GPU Shaders JJ
Mobile Graphics AH
GPU Shaders cont. JJ
Summary or Buffert KJ
![Page 5: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/5.jpg)
Course Contents● Laborations – deadline 071019
– Parallel processing graphics– GLSL shader programming– Hand in report, code and executable– Individual or in pair
● Essay or Project – deadline 071019– Project/essay suggestion/topic by 070921– Individual or in pair
![Page 6: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/6.jpg)
Lecture Contents● What is Realtime rendering● Achieve speed and flexibility
– concepts, theories and algorithms– shadows, culling– basic cheating, advanced cheating
![Page 7: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/7.jpg)
Realtime Rendering● Computer graphics with a timeconstraint
– “Realtime” is relative– Computer games, interactive visualization– Limited resources, time limits and other demands
● Concepts:– do as much as you can!– don't do more than you can!
![Page 8: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/8.jpg)
Realtime Rendering
Data
VisualizationProcesses
Interaction
![Page 9: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/9.jpg)
Issue 1● Do as much as you can!
![Page 10: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/10.jpg)
Do as much as you can!● Acceleration
– software acceleration● code optimization● parallelization
– hardware acceleration● dedicated hardware● hardware optimized graphics approach
![Page 11: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/11.jpg)
Software Acceleration● Code optimization
– algorithm complexity– inner loop optimization– caching / cache optimization
![Page 12: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/12.jpg)
Code Optimization● Algorithm complexity
– Simple operation many times● Keep down the number of times – ordo notation● c.f. radiosity vs gouraud shading
– Algorithm optimization
O N2O N
![Page 13: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/13.jpg)
Code Optimization● Inner loop optimization
– Simple operation many times● Keep the cost low
– Lowlevel optimization● LUT or replace cost intensive functions
– pow, arctan, sincos – Taylor Polynomials● CPU specific routines● Stall minimization● Manual assembly coding
![Page 14: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/14.jpg)
Code Optimization● caching / cache optimization
– Fit as much as possibleas close as possible to CPU
● memory coherency / block data● L1 ~ 16 kB L2 ~ 1 MB
RAM ~ 1 GB HD ~ 1 TB– advanced HPC
CPU
L1 Cache
L2 Cache
RAM
L3 Cache
Hard Drive
![Page 15: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/15.jpg)
Parallelization● Independent operation in parallel
– trivial● unsychronized read● screen space multiplex
– nontrivial● synchronized write● object space multiplex
● Workload balancing
![Page 16: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/16.jpg)
Hardware Acceleration● Hardware optimized algorithms
– simple operations in parallel pipelines– polygon rasterization approach
● Specialized hardware– GPU, PPU– Hardware interface
● Driver● API: OpenGL, Direct3D, PhysX
![Page 17: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/17.jpg)
Graphics HardwareVertex Positions Vertex Connections
Vertex Operations
Rasterization
Textures
Primitives
Fragment Operations
Buffer
Primitives
Blending
Image Data
![Page 18: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/18.jpg)
Hardware Acceleration● General Purpose Hardware
– Multicore x86● 2 x Quad core = 8 virtual CPUs● TILE64 = 64 virtual CPUs
– FieldProgrammable Gate Array(FPGA)
– Cell Broadband Engine● 1 st Power Processing Element● 8 st Synergistic Processing Elements
![Page 19: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/19.jpg)
Hardware Acceleration● General Purpose Hardware
– Hardware Interface● Compiler / compiler extensions● Optimization tools
![Page 20: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/20.jpg)
Hardware Acceleration● Caveats
– Software distribution● unknown hardware support● resulting in disabled functions● driver may simulate features
– Hard to realize● design algorithms● implement in program
![Page 21: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/21.jpg)
Fast Algorithms● Fast lighting and shadows
![Page 22: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/22.jpg)
Shadowing Algorithms● Global illumination (radiosity)
– really, really slow● Raytracing
– very slow● Hardware accelerated
– Shadow Volume, Shadow MappingShadow Texture, Etc...
![Page 23: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/23.jpg)
Global Illumination
Scene
Connectivity Radiosity Light Maps
O N2 O N2 logN
Lighting
Rendering
ON
![Page 24: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/24.jpg)
Global Illumination● Hierarchical radiosity
– group patches far away– group patches in early iterations
● (Quasi) MonteCarlo radiosity● Transillumination planes
– intermediate transspatial radiosity map– can be hardware accelerated
![Page 25: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/25.jpg)
Raytracing● for each buffer row
for each row pixelfor each object
check for intersection
.=O W⋅H⋅N
![Page 26: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/26.jpg)
Raytracing● Speedup
– imagespace (trivial) parallelization– collision search speedup– frametoframe coherency
● Close to interactive with current hardware
![Page 27: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/27.jpg)
Projected Planar Shadows● Only planar surfaces
● Project object and colour black
x⋅n=d
p'=xL−dn⋅xL
n⋅p−xLp−xL
![Page 28: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/28.jpg)
Shadow Volumes● For each light source
– polygon shadow volume● Multipass render
1) render all in shadow2) render shadow polygons
– to mask buffer3) render lighting masked
.=O N!
![Page 29: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/29.jpg)
Shadow Volumesgenerate shadow polygons
render scene with ambient and emission lighting
for each front face shadow polygon
if Zbuffer test passesthen increment stencil buffer value
for each shadow polygon back face
if Zbuffer test passesthen decrement stencil buffer value
render lit scene with stencil buffer mask
![Page 30: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/30.jpg)
Shadow Volumes● Shadow volume estimation
– computationally expensive– dependent on scene complexity
![Page 31: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/31.jpg)
Shadow Mapping● Completely imagespace algorithm!
1) Render scene from light source > depth map2) Render scene from viewpoint (use map)– check each fragment against depth buffer from light
.=ON
![Page 32: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/32.jpg)
Shadow Mappingfor each light
render scene to light's depth buffer
for each fragment
transform fragment into each light's buffer space
if fragment depth < light buffer depththen render fragment lit by lightelse render fragment shadowed
![Page 33: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/33.jpg)
Shadow Mapping● Precision limit artifacts
– depth buffer precision is limited=> self shadowing
– solution● substract bias from Zvalue● glPolygonOffset
![Page 34: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/34.jpg)
Shadow Mapping● Resolution mismatch artefacts
– depth fragment size in image space
– solutions● percentage closer filtering● perspective shadow maps
d=d s
r sr i
coscos
r s
r i
![Page 35: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/35.jpg)
Shadow Mapping
![Page 36: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/36.jpg)
Shadow Texture● Hack!
– texture shadow onto object
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
![Page 37: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/37.jpg)
Issue 2● Don't do more than you can!
![Page 38: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/38.jpg)
Don't do more than you can!● Framerate maintenance
– Remove unnecessary work– Flexibility
● adjust rendering to fit conditions● graphics hardware, memory, CPU
– Degrading● use graceful degradation● adaptive or predetermined degradation
![Page 39: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/39.jpg)
Prepare Your Data● Pre processing
– prepare and organize● hierarchical scenes● data structures
– when?● compiletime● initializationtime● runtime
Design
Compilation
Initialization
Runtime
![Page 40: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/40.jpg)
Culling● Remove objects that will not affect the scene
– behind the viewer (near/far plane)– outside view frustum– behind another object
![Page 41: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/41.jpg)
Culling● Bounding volumes
– cull groups with bounding spaces outside the view– bounding
● sphere● axisaligned bounding box (AABB)● oriented bounding box (OBB)
– should be easy to work with– should have small void space
![Page 42: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/42.jpg)
Bounding Volumes
![Page 43: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/43.jpg)
Bounding Volume Culling
![Page 44: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/44.jpg)
Scenegraph● Hierarchical rendering● Groups● Local transformation
– wheel relative car– car relative earth– earth relative sun
Earth transform
Car transform
Wheel transforms
Wheel
![Page 45: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/45.jpg)
Hierarchical Bounding Volumes
![Page 46: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/46.jpg)
Scene Partitioning● Rooms are very nice
– limited contents– occluding walls– static relation to other rooms
● Intelligent door placement– automatic closing– cellsandportals
![Page 47: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/47.jpg)
Scene Partitioning
![Page 48: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/48.jpg)
Scene Partitioning● Scene splitting benefits
– intelligent culling● visibility lists● realtime visibility tests
– scene preloading● objects and textures
– detail adjustments● physics simulation● artificial intelligence
![Page 49: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/49.jpg)
Automatic Partitioning● Binary Space Partitioning (BSP)
– recursive space division– results in hierarchy with convex leaves– results in “BSP tree”
● Breaking the Walls (BW)– two pass partitioning– supports outdoor and dynamic scenes
![Page 50: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/50.jpg)
BSP Algorithm
![Page 51: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/51.jpg)
BW Algorithm● First pass
– traverse edges (walls)● e.g. counter clockwise
– local greedy algorithm● choose shortest path● adjacent wall or portal
![Page 52: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/52.jpg)
BW Algorithm● Second pass
– merge cells with long portals– split over estimated cells
● cells that can be split● split at concave corners
![Page 53: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/53.jpg)
Partitioning Algorithms
![Page 54: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/54.jpg)
Scene Partitioning● Alternative partitioning
– merge BSP cells by visibility lists– regular grid blocks– quadtree
![Page 55: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/55.jpg)
Cheating
![Page 56: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/56.jpg)
Cheating● Don't use more effort than necessary
– psychophysical aspects (perception)● speed, contrast, (eccentricity)● fog, (depthoffield)
– projected size
![Page 57: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/57.jpg)
Cheating
![Page 58: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/58.jpg)
Cheating● Object impact
– speed, contrast, projected size– use bounding volume projected size– analyze prerendered image of object
● Simplifications– polygonal resolution– texturing– shaders
![Page 59: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/59.jpg)
Object Resolution● Levelofdetail (LoD)
– use as low resolution as possible– select resolution at rendertime
![Page 60: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/60.jpg)
Textures● Replace geometrical details with texture
– clothes, faces and ground
![Page 61: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/61.jpg)
Textures● Imagebased rendering
– Use photographs of things● Lighting● Material and colours● Textures (microstructure)
![Page 62: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/62.jpg)
Fragment Shaders● Hardware accelerated details
– each fragment individually estimated– realtime updated texturing– bumpiness, details, etc.– relief texturing
![Page 63: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/63.jpg)
Sprites and Impostors● Sprite
– often billboard – polygon facing the camera– image/photograph/video instead of object– commonly plants, grass, people
● Impostors– replace geometry with image
● prerendered / dynamically generated
![Page 64: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/64.jpg)
Adaptive Degradation● Adjust degradation at runtime
– Predetermine degradation● time buffer● priority queue
– depending on distance, size, velocity● buy quality for each object
– Dynamic degradation● adjust quality if framerate is high or low● hysteresis
![Page 65: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/65.jpg)
LevelofDetails
![Page 66: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/66.jpg)
LevelofDetails● Adaptive cheating
– select model resolution at runtime– usually distance specific
● Issues– generating detail levels– error estimation / level selection– pop / popup artifacts– resolution mismatch
![Page 67: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/67.jpg)
Pop Artifacts● Too large of a change
– object morphing – change in shape– creeping texture– popping attracts eye
● Remidy– gradual change is invisible– change at sub visible size (resolution)
![Page 68: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/68.jpg)
Resolution Mismatch● Part of different resolution don't match
– Texture resolution change
– Polygon patches
![Page 69: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/69.jpg)
MIPmap● Texture resolution issues
– Aliasing at distance – moiré patterns– Unnecessarily high resolution– Too low resolution
● Solution– Multum In Parvo (MIP map)– Multiple texture resolutions– Hardware support in OpenGL
![Page 70: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/70.jpg)
MIPmap
![Page 71: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/71.jpg)
MIPmap
![Page 72: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/72.jpg)
Clipmap● Clipped MIPmap (SGI)
– Full texture at low resolution– Only partial texture at high resolution
![Page 73: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/73.jpg)
LoD Polygonal Objects● Multiple resolution versions
– Generate multiple resolutions– Select right resolution
Decimation
Decimation
Decimation
Switch
![Page 74: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/74.jpg)
Decimation
![Page 75: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/75.jpg)
Decimation● Vertex clustering
– Cluster vertices using regular grid● Replace cluster with single vertex● Update faces accordingly
– Poor result● low quality● no triangle count specification● no error measure
![Page 76: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/76.jpg)
75 ~28%
Decimation● Remove vertices to simplify model
– Vertex removal, edge contraction
– Remove vertex/edge until● exceeding error threshold● reaching triangle count
108 ~20%
![Page 77: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/77.jpg)
Quadric Error Metric● “Quadric Decimation”
– Edge / nonedge contraction– Associate vertex with error quadric Q
– Use heap with vertices and costs
v =vTQv
Q1,2=Q1Q2
cost=v 'T Q1Q2 v '
v '=Q1,2−1 0,0,0,1
T
![Page 78: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/78.jpg)
Quadric Error Metric● Initial Quadric Error
– approximate plane distance square error
v = ∑p∈planes v
pT v 2
= ∑p∈planes v
vT p pT v
= ∑p∈planes v
vT p pT v
=vT
∑p∈planes v
p pT
v
⇒Q= ∑p∈planes v
p pT
![Page 79: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/79.jpg)
Adaptive Decimation● What if different parts are at different distance?
– Parts of same object requires different resolution– MIPmapping for textures– Adaptive decimation for polygonal data
● e.g. ground meshes
![Page 80: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/80.jpg)
Adaptive Decimation● Alternatives
– Patches– Adaptive decimation
● ROAM● SOAR
● Criteria– distance, frustum culling,
decimation error, lineofsight
![Page 81: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/81.jpg)
ROAM● Realtime Optimally Adapting Meshes
– Triangle bintree– Timedependent priority– Priority queues
● Incremental changes● Split● Merge
![Page 82: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/82.jpg)
ROAM● Forced split
![Page 83: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/83.jpg)
ROAM
![Page 84: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/84.jpg)
ROAM● Error Metrics
– Nested wedges – hierarchical error bound– Screen distortions – project wedge on screen– Check lineofsight
● intersection with wedge – modify triangle priority– View frustum, backface detail reduction,
specular highlights, silhouette edges,atmospheric obscurance, object positioning
![Page 85: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/85.jpg)
SOAR● Stateless, Onepass Adaptive Refinement
– Longest edge intersection, 4k mesh, ...– Multiresolution mesh forms DAG of vertices
● children belong to higher resolution level● nested error terms ensure active parent of active vertex
![Page 86: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/86.jpg)
SOAR● Pros
– Simple to implement– No forced split– High memory coherency
● Cons– No frametoframe coherency
![Page 87: Karljohan Lundin Palmerius - weber.itn.liu.se](https://reader030.fdocuments.in/reader030/viewer/2022012620/61a1045de4861576237f2ceb/html5/thumbnails/87.jpg)
The end