Hank Childs, University of Oregon

Slides:



Advertisements
Similar presentations
7.1 Vis_04 Data Visualization Lecture 7 3D Scalar Visualization Part 2 : Volume Rendering- Introduction.
Advertisements

Hank Childs, University of Oregon Nov. 25th, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 15: animation, transparency.
VIS Group, University of Stuttgart Tutorial T4: Programmable Graphics Hardware for Interactive Visualization Pre-Integrated Splatting (Stefan Roettger)
Hank Childs, University of Oregon Oct. 22 nd, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 7: Arbitrary Camera Positions.
Direct Volume Rendering. What is volume rendering? Accumulate information along 1 dimension line through volume.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Hank Childs, University of Oregon November 15 th, 2013 Volume Rendering, Part 2.
Splatting Josh Anon Advanced Graphics 1/29/02. Types of Rendering Algorithms Backward mapping Image plane mapped into data Ray casting Forward mapping.
18.1 Si31_2001 SI31 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Light Maps What We Did Not Cover Learning More...
Introduction to Volume Rendering Presented by Zvi Devir.
Introduction to Volume Visualization Mengxia Zhu Fall 2007.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Unstructured Volume Rendering Jian Huang, CS 594, Spring 2002 This set of slides reference slides developed by Prof. Torsten Moeller, SFU, Canada.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Hank Childs, University of Oregon Oct. 10, 2014 CIS 441/541: Introduction to Computer Graphics Lecture 4: Interpolating Colors and the Z-buffer.
Game Programming 06 The Rendering Engine
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Hank Childs, University of Oregon Lecture #10 CIS 410/510: Isosurfacing.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Hank Childs, University of Oregon Unstructured Grids.
Hank Childs, University of Oregon Volume Rendering, Part 3.
Hank Childs, University of Oregon Volume Rendering, pt 1.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
UniS CS297 Graphics with Java and OpenGL Blending.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Model Optimization Wed Nov 16th 2016 Garrett Morrison.
Hank Childs, University of Oregon
Hank Childs, University of Oregon
- Introduction - Graphics Pipeline
Discrete Techniques.
Week 7 - Monday CS361.
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
CIS 410/510: Isosurfacing (pt 2)
Volume Visualization Chap. 10 November 20 , 2008 Jie Zhang Copyright ©
Visual Appearance Chapter 4
Hank Childs, University of Oregon
Hank Childs, University of Oregon
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
Hank Childs, University of Oregon
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Volume Visualization Chap. 10 December 3 , 2009 Jie Zhang Copyright ©
Real-Time Volume Graphics [06] Local Volume Illumination
Hank Childs, University of Oregon
Volume Rendering.
UMBC Graphics for Games
Visibility (hidden surface removal)
Computer Graphics Module Overview
CS5500 Computer Graphics May 29, 2006
CS-378: Game Technology Lecture #4: Texture and Other Maps
GR2 Advanced Computer Graphics AGR
Game Programming Algorithms and Techniques
Hank Childs, University of Oregon
Presentation transcript:

Hank Childs, University of Oregon Volume Rendering, pt 2 Hank Childs, University of Oregon

Announcements Project 8 statement Need a lecture on moviemaking? Grad students: still need to do short presentations I will do one soon Come to OH and let’s chat

Review

Plotting Techniques X-rays Film/image Emitter

Volume rendering Important visualization technique for 3D data Use combination of color and transparency to see entire 3D data set at one time. There are multiple ways to do volume rendering. I will describe one way today (raycasting). That will help explain the technique. I will describe alternate ways in future lectures.

Volume rendering overview Camera Pixels on the screen 3D data

Volume rendering overview Camera Pixels on the screen Ray casting game plan: For every pixel on the screen, Find ray for that pixel Intersect volume with ray Calculate color from intersection Assign color to pixel 3D data Which of these 4 steps will be easy? Which will be hard?

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection Assign Color To Pixel

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection Assign Color To Pixel

How do we specify a camera? The “viewing pyramid” or “view frustum”. Frustum: In geometry, a frustum (plural: frusta or frustums) is the portion of a solid (normally a cone or pyramid) that lies between two parallel planes cutting it.

This answers the “find ray for this pixel” question From Pixels to Rays From: Zhang, CSUSM, Introduction to Ray Tracing This answers the “find ray for this pixel” question

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection Assign Color To Pixel

Intersect Volume With Ray } Camera Pixels on the screen 3D data What is the result of the ray-volume intersection?

Ray-Volume Intersection How would you calculate this intersection?

Ray-Volume Intersection: How do you do it? Find first cell intersected Intersection is at a face Find where ray exits that cell That face is shared with another cell Keep going until you exit the volume, one cell at a time. What would this technique give you?

Intersect Volume With Ray } Camera Pixels on the screen 3D data What data would we be working with?

Face Intersections Can we calculate the intersections at the faces? Can we calculate the data at the faces? Is this a good idea? Why or why not? X (it is not a good idea if we interpolate between the face values) How do we fix this? X

Ray-Volume Intersection: sampling x Camera Pixels on the screen Sampling is the most common method for “ray-casting” volume rendering 3D data Do we know how to do this sampling?

Approximately how many samples will we calculate? How to sample quickly Multiple strategies. For now, similar as before: Find first cell intersected Intersection is at a face Find where ray exits that cell Are there samples within the cell? Then sample them? Go to next cell (which shares a face) and repeat Keep going until you exit the volume, one cell at a time, and see what samples it covers Approximately how many samples will we calculate?

New Material

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection Assign Color To Pixel

Refresher: Color Maps

Transfer function Assigns a color and an opacity to each scalar value. Technique Abstraction for assigning color Pseudocoloring Color Map Volume Rendering Transfer Function

Transfer Function

“Alpha Channel” Represents opacity Stored alongside RGB 1.0 or 255: fully opaque 0: fully transparent Stored alongside RGB Referred to as RGBA Floating point (1.0) vs byte (255): Precision vs uniformity with RGB & performance

Applying a transfer function Sample Scalar Value 5.8 1 4.7 2 3 3.5 4 1.1 R G B A 255 1.0 0.75 0.5 Quiz: calculate (approximate) results from transfer function for each sample

Transparency Quiz: If you have a red square that is 50% opaque in front of a black background, what color would you see? Represent your answer in terms of (R, G, B) Answer: (128, 0, 0)

Transparency If you have an opaque red square in front of a blue square, what color would you see? Red If you have a 50% transparent red square in front of a blue square, what color would you see? Purple If you have a 100% transparent red square in front of a blue square, what color would you see? Blue

Formula For Transparency Front = (Fr,Fg,Fb,Fa) a = alpha, transparency factor Sometimes percent Typically 0-255, with 255 = 100%, 0 = 0% Back = (Br,Bg,Bb,Ba) Equation = (Or = Fa*Fr+(1-Fa)*Ba*Br, Og = Fa*Fg+(1-Fa)*Ba*Bg, Ob = Fa*Fb+(1-Fa)*Ba*Bb, Oa = Fa+(1-Fa)*Ba) Alpha component is important! Any observations?

Wikipedia page is great reference: Representing Colors Two ways of representing colors Pre-multiplication Straight RGBA (non-premultiplied) Slides use straight RGBA Wikipedia page is great reference: http://en.wikipedia.org/wiki/Alpha_compositing

Representing colors: example 50% transparent red square Could use (128, 0, 0, 0.5) # pre-multiplied --or-- (255, 0, 0, 0.5) # straight RGBA The issue is whether the 0.5 is multiplied into the color components first. And changes equation

Formula For Transparency Front = (Fr,Fg,Fb,Fa) a = alpha, transparency factor Sometimes percent Typically 0-255, with 255 = 100%, 0 = 0% Back = (Br,Bg,Bb,Ba) Equation = (Or = Fa*Fr+(1-Fa)*Ba*Br, Og = Fa*Fg+(1-Fa)*Ba*Bg, Ob = Fa*Fb+(1-Fa)*Ba*Bb, Oa = Fa+(1-Fa)*Ba) Formula for straight RGBA Alpha component is important! Any observations?

Formula For Transparency Front = (Fr,Fg,Fb,Fa) a = alpha, transparency factor Sometimes percent Typically 0-255, with 255 = 100%, 0 = 0% Back = (Br,Bg,Bb,Ba) Equation = (Or = Fr+(1-Fa)*Ba*Br, Og = Fg+(1-Fa)*Ba*Bg, Ob = Fb+(1-Fa)*Ba*Bb, Oa = Fa+(1-Fa)*Ba) Formula for pre-multiplied Alpha component is important! Any observations?

Transparency If you have an 25% transparent red square (255,0,0) in front of a blue square (0,0,255), what color would you see (in RGB)? (192,0,64) If you have an 25% transparent blue square (0,0,255) in front of a red square (255,0,0), what color would you see (in RGB)? (64,0,192)

Calculating Color Sample Scalar Value 5.8 1 4.7 2 3 3.5 4 1.1 R G B A 255 1.0 0.75 0.5 Equation = (Fa*Fr+(1-Fa)*Ba*Br, Fa*Fg+(1-Fa)*Ba*Bg, Fa*Fb+(1-Fa)*Ba*Bb, Fa+(1-Fa)*Ba) Apply this equation over and over until you run out of samples (then use background color)

Game Plan Initialize pixel color / alpha with TransferFunction(first sample) Iterate over remaining samples Front-to-back order pixel color / alpha updated each time using composite function

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection Assign Color To Pixel

Assign Color To Pixel Allocate a buffer for storing RGB values Buffer should have one RGB for every pixel on the screen. As you calculate color for a ray, assign that color to its corresponding buffer entry When you have all of the colors, put that image up on the screen, as if you had rendered it using graphics cards.

Volume rendering overview Camera Pixels on the screen Ray casting game plan: For every pixel on the screen, Find ray for that pixel Intersect volume with ray Calculate color from intersection Assign color to pixel 3D data Which of these 4 steps were easy? Which were hard?

Ray-Volume Intersection: sampling x x Camera Pixels on the screen What happens when we change the sampling rate? 3D data Imagine if we had half or twice as many transparent squares… Should the picture change if we change the sampling rate?

What is the opacity of these three samples together? Opacity Adjustment Consider ray with this profile 100% transfer function Opacity from 50% x x x Distance along ray What is the opacity of these three samples together?

Opacity Adjustment Consider ray with this profile New interpretation: opacity is for a range, not a point. If you double the sampling, then the range is reduced. Typically think of opacity for a given sampling rate and then adjust as sampling rate changes. 100% transfer function Opacity from 50% x x x x x Distance along ray What is the opacity of these five samples together?

Opacity Correction http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html

Next Time A lot more about volume rendering More techniques Multi-variate volume rendering Lighting calculations Optimizations Combinations with surface rendering

New Material: Volume Rendering

Another idea for rendering (triangles) Camera space: Camera located at origin, looking down -Z Triangle coordinates relative to camera frame O O World space: Triangles in native Cartesian coordinates Camera located anywhere Image space: All viewable objects within -1 <= x,y,z <= +1 x y z Screen space: All viewable objects within -1 <= x, y <= +1 Device space: All viewable objects within 0<=x<=width, 0 <=y<=height We don’t need to do it this way for volume rendering (although we could)

Different Types of Volume Rendering Image Order: iterate over pixels Object Order: iterate over data

Object Order: Splatting Turn every point into a disk (aligned to the camera) Color and transparency vary Render the splats from back to front using graphics hardware.

Object Order: Transparent Planes Strategy: Slice the volume by many planes (200-1000) Apply transfer function to each vertex on the plane Result: plane with variation in color and transparency Render the planes from back to front These can be quickly rendered using “2D textures” or “3D textures”. Image from VTK book

Volume Rendering: A Framework For Rendering Compositing: use combination of color and transparency to enable visualization of entire 3D data Alternate ideas: maximum value along ray average value along ray distance to key value along ray

Ray functions: compositing Image from VTK book

Ray functions: maximum Image from VTK book

Ray functions: average value Image from VTK book

Ray functions: distance to value Image from VTK book

Volume rendering More on volume rendering Shading Multi-variate volume rendering Optimizations Combinations with surfaces

Shading surfaces This is done by calculating surface normal and then calculating light reflection (or lack of light reflection from light source)

Answer: use gradient of field for “surface” normal Shading volumes Want to do all the same lighting equations, but we need a surface normal … for a volume. What to do? Answer: use gradient of field for “surface” normal

Volume rendering More on volume rendering Shading Multi-variate volume rendering Optimizations Combinations with surfaces

Multi-variate volume rendering Simplest form 32F 77F 122F 167F 212F temperature density

Multi-variate transfer functions From cs.utah.edu/~jmk

Multi-variate transfer functions From cs.utah.edu/~jmk Multi-variate transfer functions

Volume rendering More on volume rendering Shading Multi-variate volume rendering Optimizations Combinations with surfaces

Optimizing Volume Rendering Big topic: How to find samples quickly? How to use advanced HW (GPUs) efficiently? Early ray termination Just stop going when opacity gets greater than some threshold. You do this for pre-defined project

Volume rendering More on volume rendering Shading Multi-variate volume rendering Optimizations Combinations with surfaces

Surface Rendering + Volume Rendering How was this picture made?