Shading CMSC 435/634. RenderMan Light Displacement Surface Volume Imager.

Slides:



Advertisements
Similar presentations
GPGPU Programming Dominik G ö ddeke. 2Overview Choices in GPGPU programming Illustrated CPU vs. GPU step by step example GPU kernels in detail.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
Perspective aperture ygyg yryr n zgzg y s = y g (n/z g ) ysys y s = y r (n/z r ) zrzr.
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Graphics Pipeline.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Status – Week 277 Victor Moya.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
Shading Languages By Markus Kummerer. Markus Kummerer 2 / 19 State of the Art Shading.
Computer Science – Game DesignUC Santa Cruz Adapted from Jim Whitehead’s slides Shaders Feb 18, 2011 Creative Commons Attribution 3.0 (Except copyrighted.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
David Runyon Lauren Stana Kelsey Vaughn Molly Shelestak.
Procedural Textures.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Real-time Graphical Shader Programming with Cg (HLSL)
Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation.
Geometric Objects and Transformations. Coordinate systems rial.html.
GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Texture Mapping.
Shading. What is Shading? Assigning of a color to a pixel in the final image. So, everything in shading is about how to select and combine colors to get.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
A Crash Course in HLSL Matt Christian.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
Shading CMSC 435/634. RenderMan Light Displacement Surface Volume Imager.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 CS4610/7610: Introduction to Computer Graphics.
Shading CMSC 435/634.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Kansas State University Department of Computing and Information Sciences CIS 736: Advanced Computer Graphics Monday, 24 April 2006 Shaun Budhram (Slides.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
GPU Shading and Rendering: OpenGL Shading Language Marc Olano UMBC.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
CS418 Computer Graphics John C. Hart
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University.
Ray Tracing using Programmable Graphics Hardware
Efficient Partitioning of Fragment Shaders for Multiple-Output Hardware Tim Foley Mike Houston Pat Hanrahan Computer Graphics Lab Stanford University.
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Computer Science – Game DesignUC Santa Cruz Tile Engine.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
Programmable Pipelines
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Shading CMSC 435/634.
UMBC Graphics for Games
UMBC Graphics for Games
Graphics Processing Unit
Introduction to Computer Graphics
Programming with OpenGL Part 3: Shaders
Debugging Tools Tim Purcell NVIDIA.
RADEON™ 9700 Architecture and 3D Performance
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
OpenGL-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

Shading CMSC 435/634

RenderMan Light Displacement Surface Volume Imager

Displacement Given – Position – Normal Compute – Position – Normal Displacement LightSurface Volume Imager

Surface color Given – Position Compute – Color – Opacity Surface Light Displacement Volume Imager

Lighting Given – Surface Position Compute – Light Direction – Light Color Light Surface Displacement Volume Imager

Volume Effects Given – Position – Color Compute – New Color Volume LightSurface Displacement Imager

Image Effects Given – Pixel Color Compute – Pixel Color Imager LightSurface Displacement Volume

Non-real time vs. Real-time RenderMan GPU Texture/ Buffer Texture/ Buffer Vertex Geometry Fragment Application Displayed Pixels Displayed Pixels Light Displayed Pixels Displayed Pixels Application Displacement Surface Volume Imager

RenderMan vs. GPU RenderMan – Developed from General CPU code – Seconds to hours per frame – 1000s of lines – “Unlimited” computation, texture, memory, … GPU – Developed from fixed- function hardware – Tens of frames per second – 1000s of instructions – Limited computation, texture, memory, …

History (not real-time) Testbed [Whitted and Weimer 1981] Shade Trees [Cook 1984] Image Synthesizer [Perlin 1985] RenderMan [Hanrahan and Lawson 1990] Multi-pass RenderMan [Peercy et al. 2000] GPU acceleration [Wexler et al. 2005]

History (real-time) Custom HW [Olano and Lastra 1998] Multi-pass standard HW [Peercy, Olano, Airey and Ungar 2000] Register combiners [NVIDIA 2000] Vertex programs [Lindholm et al. 2001] Compiling to mixed HW [Proudfoot et al. 2001] Fragment programs Standardized languages Compute

width gap height gap brick mortar RenderMan Brick

surface brick( uniform float width =.2, uniform float height =.1, uniform float gap =.05, color brick = color(1,0,0), color mortar = color(.5,.5,.5) ) { varying color bc; /* compute brick color */ normal Nf = faceforward(normalize(N),I) Oi = Os; Ci = Oi*bc*(ambient()+diffuse(Nf)); } Brick Shader

Brick Color Where am I in my brick? –“ brick coordinates ” bsbt varying float bs, bt; /* compute brick coordinates */ if (bs < width && bt < height) bc = brick; else bc = mortar;

Brick Coordinates bt = mod(t, height+gap); bs = s; if (mod((t-bt)/(height+gap), 2) == 1) bs += (width+gap)/2; bs = mod(bs, width+gap);

16 RenderMan Shader Variables Cs, Os u, v, du, dv, s, t time, dtime P, dPdu, dPdv, dPdtime, N, Ng E, I L, Cl, Ol (In illuminance) Ci, Oi

RenderMan Outputs Displacement – P, N – Set DisplacementBounds! Surface, Volume, Imager – Ci, Oi Light – Cl, Ol

Shading Methods Repeating Patterns – mod, sin – Divide and floor Shapes – Implicit form: is this pixel inside Color tables Noise or computed patterns 18

Noise Subtleties Many noise functions based on a lattice – Piecewise function between integer coordinates – Hash of integer coordinates  control points Interpolating values easy but poor – Even with higher-order interpolation Perlin’s noise – Passes through 0 at each integer – Hash gives gradient

Noise Characteristics Repeatable Locally continuous but distant points uncorrolated values – RenderMan [0,1], average 0.5 – Perlin’s [-1,1], average 0 1/2 – 1 cycle per unit Versions for 1D-4D input

Perlin Noise in RenderMan 21 surface noisetest(float sc=1) { Ci = float noise(floor(1/t)*sc*P); }

22 Fractional Brownian Motion (fBm) // Combine octaves, scaled by 1/f for(f=1; f<=floor(1/t); f*=2) Ci += (float noise(f*sc*P)-.5)/f; Ci +=.5;

23 Turbulence // fBm using abs(noise) for(f=1; f<=floor(1/t); f*=2) Ci += abs(float noise(f*sc*P)-.5)/f; Ci +=.5;

Advanced Shading Methods Perturbed patterns – Adjust position, radius, etc. with noise Bombing – Divide space into cells – Compute random position in each cell – Check if pixel is inside shape Blending – Fade effects in and out with smoothstep

RenderMan Shader Debugging printf – Format codes for colors and points – Use conditionals to just print a few pixels! Render as color – Map intermediate values to 0-1 – Interpret results

GPU Shading Texture/ Buffer Texture/ Buffer Vertex Geometry Fragment Application Displayed Pixels Displayed Pixels

GPU Shading Choices OS: Windows, Mac, Linux API: DirectX, OpenGL Language: HLSL, GLSL, Cg, … Compiler: DirectX, OpenGL, Cg, ASHLI Runtime: CgFX, ASHLI, OSG (& others), sample code

GLSL / HLSL Vertex, Geometry & Fragment/Pixel C-like, if/while/for Structs & arrays Float + small vector and matrix – Swizzle & mask (a.xyz = b.xxw) Common math & shading functions

Vertex Demo: Blend Positions

Vertex + Fragment Demo: Fresnel Environment Map

Noise Controlled, repeatable randomness – Still spotty implementation – Can use texture or compute

Modified Noise [Olano 2005] Three relatively independent modifications – New computable hash – Change gradient computation – Reorder computation Variety of computation/texture options – Can just store in a texture – Can compute with some texture accesses – Can compute with no texture accesses