CS 354Compression &Project 2
Mark KilgardUniversity of TexasMarch 27, 2012
CS 354 2
Today’s material
In-class quiz On shadows + scene graph lecture
Lecture topic Project 2 Compression for Computer Graphics
CS 354 3
My Office Hours
Tuesday, before class Painter (PAI) 5.35 8:45 a.m. to 9:15
Thursday, after class ACE 6.302 11:00 a.m. to 12
Randy’s office hours Monday & Wednesday 11 a.m. to 12:00 Painter (PAI) 5.33
CS 354 4
Last time, this time
Last lecture, we discussed Shadow generation algorithms Scene graph
Data structures to organize the rendering of 3D scenes
This lecture Project 2 on Programmable Shaders Compression for Computer Graphics
CS 354 5
Daily Quiz
1. Multiple choice: Which is not a form of culling used in scene graph implementations
a) network video culling
b) view frustum culling
c) occlusion culling
d) portal culling
2. True or False: Zpass shadow volume rendering has catastrophic artifacts when shadow volumes are clipped by the near clip plane.
3. Name the dark and less dark regions of a shadow generated by an area light source.
4. Multiple choice: When a scene graph implementation has profiling to visualize the depth complexity of a scene, that means:
a) Monitoring the maximum stack depth to avoid overflows
b) Counting and displaying how many times each pixel in the framebuffer is updated during a frame
c) Underwater rendering
On a sheet of paper• Write your EID, name, and date• Write #1, #2, #3, #4 followed by its answer
CS 354 6
Mid-term Feedback
Look for answer key on web site
0
2
4
6
8
10
12
14
16
40-49 50-59 60-69 70-79 80-89 90-100
Mid-term feedbackTotal questions: 43Maximum possible: 83
Percentage Grade Distribution
Top grade: 75
Median: 59.0Average: 58.0Standard deviation: 9.63
CS 354 7
Project 2
Look for assignment on the web site PDF + code to use
Requirements Mostly writing GLSL shaders Small amount of C/C++ code
Convert height map to normal map
Intermediate milestone April 2nd
Submit snapshots and GLSL code for first two shaders
Complete project Due April 6th
All 8 shaders Embellish for additional credit
CS 354 8
What project code renders
CS 354 9
Your job
Write torus shader Wrap a flat patch into a torus Compute lighting vectors
tangent, bi-normal, normal light vector, eye vector, half-angle vector
Write fragment shaders to implement various lighting effects ambient, diffuse, specular, reflection, decal
CS 354 10
Procedurally Generating aTorus from a 2D Grid
2D grid over (s,t)[0,1]
Tessellated torus
CS 354 11
Bumpy Diffuse
CS 354 12
Bumpy reflection combo
CS 354 13
Compression inComputer Graphics
Why? Lots of data Bandwidth intensive
Strategies to deal with data Compact representations Mesh compression Image compression Framebufffer compression
CS 354 14
Numerics
Poor Man’s Compression… Fixed-point
4-bit, 8-bit, 16-bit, etc. Floating-point
Single precision, 32-bit s23e8 Half-precision, 16-bit s10e5
CS 354 15
Image Compression
Lossless compression Entropy encoding Run-length encoding
Good when images are repetitive in X direction
Lossy compression Palette schemes
Vector quantization approaches Discrete Cosine Transform schemes
JPEG Wavelet schemes
CS 354 16
JPEG Compression
Compression and Decompression pipeline
CS 354 17
Color Space
YUV, YIQ Maintain chrominance data at lower precision
and frequency than luminance data Recall this from color space discussion TV and digital video standards rely on this
CS 354 18
Chroma Sampling
Store chrominance data at lower precision and frequency than luminance data
CS 354 19
Geometry Compression
Along with images, geometric models are also very data-intensive
Strategies Avoid vertex redundancies Scalar quantization Compact vertex attribute choices Mesh simplification
Whether automatic or manual Progressive representations Higher-level primitives
Saying a “sphere of radius 5 at (x,y,z)” is much more compact (and exact) than its tessellation
CS 354 20
Mesh Simplification
CS 354 21
Progressive Meshes
Incrementally transition between mesh Levels-of-Detail (LOD) Avoids “popping” artifacts
CS 354 22
Progressive Mesh Geomorph
Interpolate smoothly between modellevel-of-details
Edge collapse &vertex split
CS 354 23
Amplification of StandardTriangle Meshes
Original faceted mesh
Tessellationresults in triangleamplificationwith curvature
Results of Phongshading of curved
CS 354 24
Normal Compression
Floating-point for normalized normals is incredibly wasteful Half-precision values 10-10-10 signed fixed point Palette of normals
[Deering 1995]
CS 354 25
Texture Compression
Conventional image compression For storage and transmission
Texture mapping Requires random access For storage and reduced bandwidth So tends to use “block” schemes
Often 4:1 compression relying on 4x4 tiles
Assumes lossy compression
CS 354 26
DXT1 Compression 4:1 compression
DXT1 Compressed Uncompressed
blocking artifacts
CS 354 27
0
20
40
60
80
100
120
140
160
180
200
GeForce2GTS
GeForce3 GeForce4 Ti4600
GeForce FX GeForce6800 Ultra
GeForce7800 GTX
Rawbandwidth
Effective rawbandwidthwithcompression
Expon.(Effective rawbandwidthwithcompression)Expon. (Rawbandwidth)
GeForce PeakMemory Bandwidth Trends
128-bit interface 256-bit interface
Gig
abyt
es p
er s
econ
d
CS 354 28
Effective GPUMemory Bandwidth
Compression schemes Lossless depth and color (when multisampling)
compression Lossy texture compression (S3TC / DXTC) Typically assumes 4:1 compression
Avoidance useless work Early killing of fragments (Z cull) Avoiding useless blending and texture fetches
Very clever memory controller designs Combining memory accesses for improved coherency Caches for texture fetches
CS 354 29
Multi-sample Coverage Positions
4x jittered1x
(aliased)
8x jittered
4x orthogonal
CS 354 30
Depth Values Compress Well
Linear values Store plane equations instead of point samples
Smooth transitions, discrete edges
Rendered view Depth buffer view
CS 354 31
Next Class
Project 2 today (!?) On texturing, shading, & lighting Study GLSL Two weeks to complete
Next lecture Interaction How do users interact with 3D scenes?
Top Related