Programmable GPUS. Last Time? Reading for Today. Homework 4. Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

Similar documents
frame buffer depth buffer stencil buffer

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST

CS451 Texturing 4. Bump mapping continued. Jyh-Ming Lien Department of Computer SCience George Mason University. From Martin Mittring,

Texturing. Texture Mapping. Texture Mapping. Have seen: colour can be assigned to ver7ces But: don t want to represent all this detail with geometry

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Shaders. Slide credit to Prof. Zwicker

Texture-Mapping Tricks. How Bad Does it Look? We've Seen this Sort of Thing Before. Sampling Texture Maps

CS427 Multicore Architecture and Parallel Computing

CS 431/636 Advanced Rendering Techniques

CS 179: GPU Programming

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

3D Rasterization II COS 426

Graphics Hardware. Instructor Stephen J. Guy

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

CSE 167: Introduction to Computer Graphics Lecture #7: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015

CS195V Week 9. GPU Architecture and Other Shading Languages

Lecture 2. Shaders, GLSL and GPGPU

Those Delicious Texels or Dynamic Image-Space Per-Pixel

Surface Rendering. Surface Rendering

Cornell University CS 569: Interactive Computer Graphics. Introduction. Lecture 1. [John C. Stone, UIUC] NASA. University of Calgary

CSE 591: GPU Programming. Introduction. Entertainment Graphics: Virtual Realism for the Masses. Computer games need to have: Klaus Mueller

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Graphics and Imaging Architectures

Scanline Rendering 2 1/42

lecture 18 - ray tracing - environment mapping - refraction

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Chapter 7 - Light, Materials, Appearance

Advanced Shading and Texturing

Cg 2.0. Mark Kilgard

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Complex Shading Algorithms

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

Spring 2011 Prof. Hyesoon Kim

Pipeline Operations. CS 4620 Lecture 14

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

CS 354R: Computer Game Technology

CHAPTER 1 Graphics Systems and Models 3

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Computergrafik. Matthias Zwicker. Herbst 2010

Spring 2009 Prof. Hyesoon Kim

3D Computer Games Technology and History. Markus Hadwiger VRVis Research Center

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Texture mapping. Computer Graphics CSE 167 Lecture 9

Hardware Accelerated Volume Visualization. Leonid I. Dimitrov & Milos Sramek GMI Austrian Academy of Sciences

The Rasterization Pipeline

The Traditional Graphics Pipeline

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Homework 3: Programmable Shaders

Scalable multi-gpu cloud raytracing with OpenGL

The Rasterization Pipeline

Computer graphics 2: Graduate seminar in computational aesthetics

Interpolation using scanline algorithm

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

The Traditional Graphics Pipeline

Attention to Detail! Creating Next Generation Content For Radeon X1800 and beyond

Intro to Ray-Tracing & Ray-Surface Acceleration

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

Programming Graphics Hardware

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Multi-View Soft Shadows. Louis Bavoil

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

The Graphics Pipeline

Cg: A system for programming graphics hardware in a C-like language

Announcements. Written Assignment 2 is out see the web page. Computer Graphics

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

The Traditional Graphics Pipeline

Sung-Eui Yoon ( 윤성의 )

Programmable Graphics Hardware

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Hardware-Assisted Relief Texture Mapping

Cornell CS4620 Fall 2011!Lecture Kavita Bala (with previous instructors James/Marschner) Cornell CS4620 Fall 2011!Lecture 1.

CSE4030 Introduction to Computer Graphics

Introduction to Shaders.

Deferred Rendering Due: Wednesday November 15 at 10pm

Topics and things to know about them:

Texture Mapping. Reading. Implementing texture mapping. Texture mapping. Daniel Leventhal Adapted from Brian Curless CSE 457 Autumn 2011.

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Procedural Modeling. Last Time? Reading for Today. Reading for Today

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Introduction to Visualization and Computer Graphics

Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1

CS : Assignment 2 Real-Time / Image-Based Rendering

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

Shading. Flat shading Gouraud shading Phong shading

Soft Particles. Tristan Lorach

Levy: Constraint Texture Mapping, SIGGRAPH, CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon

Transcription:

Last Time? Programmable GPUS Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes frame buffer depth buffer stencil buffer Stencil Buffer Homework 4 Reading for Create some geometry "Rendering Fake Soft Shadows with Smoothies", Chan & Durand, EGSR 2003 Reflected object & floor Silhouette edges Shadow polygons Make sure your polygons aren t doubled up Make sure your polygons are oriented consistently Mess with the stencil buffer Don t just blindly copy code from the tutorial Use the web to read the man page for each instruction & its parameters Be creative with shaders Hopefully everyone can get the examples to compile & run

Reading for Modern Graphics Hardware Shader Programming Languages Gouraud Shading vs. Phong Normal Many Mapping techniques "Deep Opacity Maps", Yuksel and Keyser, Eurographics 2008 Modern Graphics Hardware Programmable Graphics Hardware High performance through Geometry and pixel (fragment) stage become programmable Parallelism Specialization No data dependency Efficient pre-fetching task parallelism data parallelism G G G G R R R R T T T T F F F F D D D D G P R T F P D Elaborate appearance More and more general-purpose computation (GPU hacking)

Misc. Stats on Graphics Hardware 2005 4-6 geometry units, 16 fragment units Deep pipeline (~800 stages) NVIDIA GeForce 9 (Feb 2008) ATI Radeon R700 (2008) Modern Graphics Hardware Shader Programming Languages 32/64 cores, 512 MB/1GB memory Cg design goals GLSL examples 480 stream processing units NVIDIA GeForce GTX 480 (2010) 480 cores, 1536 MB memory 2560x1600 resolution ATI Radeon HD 7900 (2012) NVIDIA GeForce GTX 680 (2012) NVIDIA GeForce GTX 980 (2014) AMD Radeon R9 275x2 (2014) 2048 processors, 3GB memory Gouraud Shading vs. Phong Normal Many Mapping techniques 1536 cores, 2040 MB memory 2048 core, 4 GB RAM water cooling, 1200 power supply 5,632 processors, 8 GB RAM, NVIDIA GeForce 10 (2016) Almost 4,000 (shaders, texture map, render output) Emerging & Evolving Languages Cg Design Goals Inspired by Shade Trees [Cook 1984] & Renderman Shading Language [1980 s]: RTSL [Stanford 2001] real-time shading language Cg [NVIDIA 2003] C for graphics HLSL [Microsoft 2003] Direct X GLSL [OpenGL ARB 2004] OpenGL 2.0 Optix [NVIDIA 2009] Real time ray tracing engine for CUDA General Purpose GPU computing CUDA [NVIDIA 2007] OpenCL (Open Computing Language) [Apple 2008] for heterogeneous platforms of CPUs & GPUs A system for programming graphics Ease of programming Cg:hardware in a C-like language Mark et al. SIGGRAPH 2003 Portability Complete support for hardware functionality Performance Minimal interference with application data Ease of adoption Extensibility for future hardware Support for non-shading uses of the GPU

Cg Design Cg compiler vs. GPU assembly Hardware is changing rapidly [2003] no single standard Specify profile for each hardware Can inspect the assembly language produced by Cg compiler and perform additional optimizations by hand May omit support of some language capabilities (e.g., texture lookup in vertex processor) Use hardware virtualization or emulation? Performance would be so poor it would be worthless for most applications Well, it might be ok for general purpose programming (not real-time graphics) Generally once development is complete (& output is correct) Using Cg is easier than writing GPU assembly from scratch (Typical) Language Design Issues Parameter binding Call by reference vs. call by value Data types: 32 bit float, 16 bit float, 12 bit fixed & type-promotion (aim for performance) Specialized arrays or general-purpose arrays Modern Graphics Hardware Shader Programming Languages float4 x vs. float x[4] Indirect addressing/pointers (not allowed ) Recursion (not allowed ) Cg design goals GLSL examples Gouraud Shading vs. Phong Normal Many Mapping techniques

GLSL example: checkerboard.vs (GLUT) GLSL example: hw4_shader.vs (GLFW) GLSL example: checkerboard.fs (GLUT) GLSL example: hw4_shader.fs (GLFW)

Remember Gouraud Shading? Phong Normal (Not Phong Shading) Instead of shading with the normal of the triangle, we ll shade the vertices with the average normal and interpolate the shaded color across each face Interpolate the average vertex normals across the face and compute per-pixel shading Normals should be re-normalized (ensure length=1) This gives the illusion of a smooth surface with smoothly varying normals Before shaders, per-pixel shading was not possible in hardware (Gouraud shading is actually a decent substitute!) Bump Mapping Modern Graphics Hardware Shader Programming Languages Gouraud Shading vs. Phong Normal Many Mapping techniques Use textures to alter the surface normal Bump Mapping Environment Mapping Light Mapping Does not change the actual shape of the surface Just shaded as if it were a different shape Normal Mapping Parallax Mapping Parallax Occlusion Mapping Sphere w/diffuse Texture Swirly Bump Map Sphere w/diffuse Texture & Bump Map

Another GLSL example: orange.vs Another GLSL example: orange.fs Bump Mapping Another Bump Map Example Treat a greyscale texture as a single-valued height function Compute the normal from the partial derivatives in the texture Bump Map Cylinder w/diffuse Texture Map Cylinder w/texture Map & Bump Map

Normal Mapping What's Missing? Variation on Bump Mapping: Use an RGB texture to directly encode the normal There are no bumps on the silhouette of a bump-mapped or normal-mapped object Bump/Normal maps don t allow self-occlusion or self-shadowing http://en.wikipedia.org/wiki/file:normal_map_example.png Modern Graphics Hardware Shader Programming Languages Gouraud Shading vs. Phong Normal Many Mapping techniques Use the texture map to actually move the surface point The geometry must be displaced before visibility is determined Bump Mapping Environment Mapping Light Mapping Normal Mapping Parallax Mapping Parallax Occlusion Mapping

Image from: Geometry Caching for Ray-Tracing Displacement Maps EGRW 1996 Matt Pharr and Pat Hanrahan note the detailed shadows cast by the stones Ken Musgrave Parallax Mapping a.k.a. Offset Mapping or Virtual Displace the texture coordinates for each pixel based on view angle and value of the height map at that point At steeper view-angles, texture coordinates are displaced more, giving illusion of depth due to parallax effects Detailed shape representation with parallax mapping, Kaneko et al. ICAT 2001 Parallax Occlusion Mapping Brawley & Tatarchuk 2004 Per pixel ray tracing of the heightfield geometry Occlusions & soft shadows http://developer.amd.com/media/gpu_assets/ Tatarchuk-ParallaxOcclusionMapping-Sketch-print.pdf

Environment Maps Modern Graphics Hardware Shader Programming Languages Gouraud Shading vs. Phong Normal Many Mapping techniques We can simulate reflections by using the direction of the reflected ray to index a spherical texture map at "infinity". Assumes that all reflected rays begin from the same point. Bump Mapping Environment Mapping Light Mapping Normal Mapping Parallax Mapping Parallax Occlusion Mapping What's the Best Chart? Environment Mapping Example Terminator II

Texture Maps for Illumination Questions? Also called "Light Maps" Quake Image by Henrik Wann Jensen Environment map by Paul Debevec Reading for Friday Reading for Friday An Image Synthesizer, Perlin, SIGGRAPH 1985 & Improving Noise, Perlin, SIGGRAPH 2002 Chris Wyman, "An Approximate Image-Space Approach for Interactive Refraction, SIGGRAPH 2005