Normal Map Compression with ATI 3Dc™ Jonathan Zarge ATI Research Inc.

Slides:



Advertisements
Similar presentations
An Optimized Soft Shadow Volume Algorithm with Real-Time Performance Ulf Assarsson 1, Michael Dougherty 2, Michael Mounier 2, and Tomas Akenine-Möller.
Advertisements

Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Digital Color 24-bit Color Indexed Color Image file compression
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless)
Exploration of bump, parallax, relief and displacement mapping
Bump Mapping CSE 781 Roger Crawfis.
Cs123 INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Andries van Dam Texture Mapping Beautification of Surfaces 1/23.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
 Introduction  Illustration Techniques  Automatic Shading Model  Conclusion and Future work  Demo.
(conventional Cartesian reference system)
Skin Rendering GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from David Gosselin’s Power Point and article, Real-time skin rendering,
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
SET09115 Intro Graphics Programming
Digital Images The digital representation of visual information.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Modelling and Simulation Types of Texture Mapping.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Digital Images Chapter 8, Exploring the Digital Domain.
Definitions Spectral Elements – data structures that contain information about data at points within each geometric entity. Finite elements only hold information.
Environment Mapping. Examples Fall Motivation Silver candlestick No appropriate texture for it “ environment ” map Simulates the results of ray-tracing.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
A Non-Photorealistic Model for Automatic Technical Illustration Amy Gooch Bruce Gooch Peter Shirley Elaine Cohen SIGGRAPH 1998 Presented by Anteneh.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
Interactive Time-Dependent Tone Mapping Using Programmable Graphics Hardware Nolan GoodnightGreg HumphreysCliff WoolleyRui Wang University of Virginia.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
Lumo: Illumination for Cel Animation Scott F. Johnston.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Tone Mapping on GPUs Cliff Woolley University of Virginia Slides courtesy Nolan Goodnight.
Game Programming 06 The Rendering Engine
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
Xbox MB system memory IBM 3-way symmetric core processor ATI GPU with embedded EDRAM 12x DVD Optional Hard disk.
M. Jędrzejewski, K.Marasek, Warsaw ICCVG, Multimedia Chair Computation of room acoustics using programable video hardware Marcin Jędrzejewski.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Lab: Vertex Shading Chris Wynn Ken Hurley. Objective Hands-On vertex shader programming Start with simple programs … Part 1: Textured-Lit Teapot.
Single Pass Point Rendering and Transparent Shading Paper by Yanci Zhang and Renato Pajarola Presentation by Harmen de Weerd and Hedde Bosman.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Computing & Information Sciences Kansas State University Advanced CG 2 of 8: MappingsCIS 636/736: (Introduction to) Computer Graphics CIS 736 Computer.
CSCI 440.  So far we have learned how to  build shapes  create movement  change views  add simple lights  But, our objects still look very cartoonish.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Multimedia and weBLOGging Grade 7-9 | Cahaya Bangsa Classical School (C) 2010 Digital Media Production Facility 03 - Still Picture 01 – Basics.
Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
BITMAPPED IMAGES & VECTOR DRAWN GRAPHICS
Computer Graphics Overview
- Introduction - Graphics Pipeline
Deferred Lighting.
Normal Map Compression with ATI 3Dc™
Bump Mapping -1 Three scales of detail on an object
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
© University of Wisconsin, CS559 Fall 2004
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Normal Map Compression with ATI 3Dc™ Jonathan Zarge ATI Research Inc.

Normal Map Compression with ATI 3Dc™ Overview Normal mapping Normal map compression techniques DXT compression ATI 3Dc™ Swizzled DXT5 compression

Normal Map Compression with ATI 3Dc™ Normal Mapping Increase visual realism Reduce geometric size of models Create detail by simulating geometry More efficient than dense geometry Textures provide lighting (normal) information Used in Half-Life 2, Doom 3, and Far Cry

Normal Map Compression with ATI 3Dc™ Car Paint Demo

Normal Map Compression with ATI 3Dc™ Traditional Lighting Model n0 n1 n2 Lighting values calculated at vertices and then interpolated across triangle Normals interpolated across triangle and lighting values calculated at each pixel

Normal Map Compression with ATI 3Dc™ Normal Map Lighting 3 component normal map texture Lighting values calculated at each pixel using normal read from normal map (nx,nx,nz) nx nx nz

Normal Map Compression with ATI 3Dc™ World Space vs. Tangent Space Triangle normal = (-0.6,-0.3,0.74) z y x Triangle normal can be any normalized vector x y z Triangle normal = (0,0,1) Coordinate space of normal defined by triangle orientation z component of normal map texel must be positive

Normal Map Compression with ATI 3Dc™ Example Tangent Space Normal Maps Tangent space normal maps can be efficiently compressed

Normal Map Compression with ATI 3Dc™ Generating Normal Maps

Normal Map Compression with ATI 3Dc™ Normal Mapping Drawbacks Low angle views distorted Silhouette edges do not have detail High texture bandwidth required Large amount of texture memory DXT compression not optimal for normal maps

Normal Map Compression with ATI 3Dc™ Benefits of Normal Map Compression More detailed normal maps More normal maps Memory and bandwidth can be diverted to other resources Smaller media size

Normal Map Compression with ATI 3Dc™ Normal Map Compression Techniques Lower precision texture formats Texture formats with fewer channels Denormalization Palletization Direct DXT compression ATI 3Dc™ Swizzled DXT5

Normal Map Compression with ATI 3Dc™ DXT Compression Designed to compress color data No suited for arbitrary data –One channel dependent on another Lossy format –Image divided into 4x4 pixel blocks –16 possible colors in block –Only 3 or 4 colors in compressed data Local similarity in small region enables high quality color compression

Normal Map Compression with ATI 3Dc™ DXT Compression Color Block Image divided into 4x4 blocks Two 16-bit colors stored representing endpoints of linear color-ramp One or two interpolated colors calculated 16 two-bit indices stored representing index into color ramp Effective bit-rate: – 64 (2*16 +16*2) / 16 = 4 bits per pixel

Normal Map Compression with ATI 3Dc™ DXTC Color Compression BLACK CYAN WHITE MAGENTA BLUE GREEN YELLOW RED Color0 Color1 Interpolated Colors

Normal Map Compression with ATI 3Dc™ DXTC Color Decompression For the four color case, given color[0], color[1], and index[1..15]: // calculating interpolated colors color[2] = (2*color[0] + color[1] + 1)/3 color[3] = (color[0] + 2*color[1] + 1)/3 // decompressed texel values for n = 0 to 15 texel[n] = color[index[n]]

Normal Map Compression with ATI 3Dc™ DXT5 Compression Alpha Block Like color, image divided into 4x4 blocks Two 8-bit scalars stored representing endpoints of linear alpha-ramp 4 or 6 intermediate alpha values calculated 16 three-bit indices stored representing index into alpha ramp Effective bit-rate: – 64 (2*8 +16*3) / 16 = 4 bits per pixel

Normal Map Compression with ATI 3Dc™ DXTC Alpha Decompression For the 8 alpha value case, given alpha[0], alpha[1], and index[1..15]: // calculating interpolated alpha values alpha[2] = (6*alpha[0] + 1*alpha[1] + 3)/7 alpha[3] = (5*alpha[0] + 2*alpha[1] + 3)/7.. alpha[7] = (1*alpha[0] + 6*alpha[1] + 3)/7 // decompressed texel values for n = 0 to 15 texel[n] = alpha[index[n]]

Normal Map Compression with ATI 3Dc™ Using DXT Compression for Normal Maps Not a good idea! Block artifacts –Normals describe curved surfaces, not lines –Especially visible in diagonal gradients Colors stored in format –Fine detail lost Errors are amplified for specular lighting Storage is inefficient because normalized vectors can be stored in two values

Normal Map Compression with ATI 3Dc™ ATI 3Dc™ Texture Format Two independent channel texture format Exposed in D3D via the FOURCC code “ATI2” Composed of 2 DXT5 alpha blocks Extremely useful for normal textures Compression: –4:1 for 32 bit textures –2:1 for 16 bit textures

Normal Map Compression with ATI 3Dc™ Ruby Demo

Normal Map Compression with ATI 3Dc™ ATI 3Dc™ Texture Format Decompression accomplished in hardware –Almost no impact on performance Can be used for two unrelated scalars –e.g. shininess, refractive index, transparency Library for compressing to 3Dc™ available from ati.com/developerati.com/developer Available in OpenGL using the GL_ATI_texture_compression_3dc extension

Normal Map Compression with ATI 3Dc™ ATI 3Dc™ Texture Format

Normal Map Compression with ATI 3Dc™ Using ATI 3Dc™ with Normal Maps x and y (of normal) stored in the texture z value calculated by x 2 + y 2 + z 2 = 1 – z = ±sqrt(1 – x 2 – y 2 ) –Only positive root used because normal is in tangent space –Calculation done in pixel shader –Can also be derived by a texture lookup Single channel z component texture

Normal Map Compression with ATI 3Dc™ Using ATI 3Dc™ Pixel shader 2.0 code: ; scale, bias, half, one def c0, 2.0f, -1.0f, 0.5f, 1.0f. texld r1, t1, s1 ;normal map mad r1, r1, c0.x, c0.y ; scale/bias to -1,1 ; Compute third component dp2add r1.z, r1, -r1, c0.w ; 1-x*x-y*y rsq r1.z, r1.z ; 1 / sqrt(1-x*x-y*y) rcp r1.z, r1.z ; sqrt(1-x*x-y*y)

Normal Map Compression with ATI 3Dc™ Using ATI 3Dc™ Pixel shader code (HLSL): sampler bump_map; float4 ps_main( PS_INPUT_STRUCT psInStruct ) :COLOR0 { // Unpack two component bump map float3 bump = tex2D( bump_map, psInStruct.bump_map ); // Put x and y in range and compute z bump = ( bump * 2.0f ) - 1.0f; bump.z = sqrt(1 - dot(bump.xy, bump.xy));.

Normal Map Compression with ATI 3Dc™ ATI 3Dc™ Compression Comparison

Normal Map Compression with ATI 3Dc™ ATI 3Dc™ Normal Compression Sample

Normal Map Compression with ATI 3Dc™ Drawbacks of ATI 3Dc™ Can only represent tangent space normal maps Cannot represent high precision normal maps –Large areas of low curvature (car hood) may require 16 bits per component More pixel shader instructions required Not available on all hardware

Normal Map Compression with ATI 3Dc™ Normal Map Compression Using Swizzled DXT5 For any hardware with at least ps 1.4 support Store x and y in alpha and green channels of the texture map Shader similar to 3Dc™ with one extra pixel shader instruction Results better than using DXTC directly but not as good as 3Dc™

Normal Map Compression with ATI 3Dc™ Using DXT5 Compression Pixel shader 2.0 code: ;scale, bias, half, one def c0, 2.0f, -1.0f, 0.5f, 1.0f. texld r1, t1, s1 ;normal map mov r1.x, r1.a ; restore x from alpha mad r1, r1, c0.x, c0.y ; scale/bias to -1,1 ; Compute third component dp2add r1.z, r1, -r1, c0.w ; 1-x*x-y*y rsq r1.z, r1.z ; 1 / sqrt(1-x*x-y*y) rcp r1.z, r1.z ; sqrt(1-x*x-y*y)

Normal Map Compression with ATI 3Dc™ DXT5 Normal Map Compression RenderMonkey Example

Normal Map Compression with ATI 3Dc™ Summary Normal Mapping great feature Directly using DXT compression not great for normal textures Compression with 3Dc™ lowers the cost normal mapping 3Dc™ available in D3D and OpenGL Swizzled DXT5 compression reasonable alternative for older hardware

Normal Map Compression with ATI 3Dc™ QUESTIONS? me or More information available at ati.com/developerati.com/developer Please go see Chris Oat’s talk on “Advanced Character Rendering” Saturday, 10:25am