Hank Childs, University of Oregon Volume Rendering, Part 3.

Slides:



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

Lecture 8 Transparency, Mirroring
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Direct Volume Rendering. What is volume rendering? Accumulate information along 1 dimension line through volume.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Hank Childs, University of Oregon November 6 th, 2013 Spatial-Based and Variable-Based Selections.
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.
Hank Childs, University of Oregon December 6 th, 2013 Meshes, Fields, and Interpolation, Part 2.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Splatting Josh Anon Advanced Graphics 1/29/02. Types of Rendering Algorithms Backward mapping Image plane mapped into data Ray casting Forward mapping.
Introduction to Volume Rendering Presented by Zvi Devir.
Introduction to Volume Visualization Mengxia Zhu Fall 2007.
Seminar 1 Surface Rendering, Decimation Presented By Sonali Barua Date:10/31/2005.
Sorting and cell compositing for irregular meshes Nelson Max, Peter Williams, Richard Cook, Claudio Silva.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Hidden Surface Removal
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
19/18/ :34 Graphics II Volume Rendering Session 10.
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.
Marching Cubes: A High Resolution 3D Surface Construction Algorithm William E. Lorenson Harvey E. Cline General Electric Company Corporate Research and.
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.
Hank Childs, University of Oregon October 3, 2014 CIS 441/541: Intro to Computer Graphics Lecture 2: The Scanline Algorithm.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
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
Hank Childs, University of Oregon Lecture #6 CIS 410/510: Advection (Part 1)
Hank Childs, University of Oregon Lecture #4 Fields, Meshes, and Interpolation (Part 3)
Hank Childs, University of Oregon Lecture #3 Fields, Meshes, and Interpolation (Part 2)
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
Hank Childs, University of Oregon Lecture #10 CIS 410/510: Isosurfacing.
Hank Childs, University of Oregon Lecture #2 Fields, Meshes, and Interpolation (Part 1)
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Hank Childs, University of Oregon Unstructured Grids.
Hank Childs, University of Oregon Volume Rendering, pt 1.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
RENDERING : Global Illumination
CDS 301 Fall, 2008 Domain-Modeling Techniques Chap. 8 November 04, 2008 Jie Zhang Copyright ©
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Solid Modeling Dr. Scott Schaefer.
Model Optimization Wed Nov 16th 2016 Garrett Morrison.
Hank Childs, University of Oregon
CIS 410/510: Isosurfacing (pt 2)
Hank Childs, University of Oregon
3D Graphics Rendering PPT By Ricardo Veguilla.
Hank Childs, University of Oregon
Jim X. Chen George Mason University
Real-Time Volume Graphics [06] Local Volume Illumination
Hank Childs, University of Oregon
Hank Childs, University of Oregon
Lecture 13 Clipping & Scan Conversion
Visualization CSE 694L Roger Crawfis The Ohio State University.
CS-378: Game Technology Lecture #4: Texture and Other Maps
Introduction to Meshes
Presentation transcript:

Hank Childs, University of Oregon Volume Rendering, Part 3

Announcements VisIt lecture: posted! Grading: will happen soon Projects: – ~30 hours – Aim for something worthy of your resume Pre-defined project: posted! Piazza:

Review

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 on Friday. 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 on Friday.

Volume rendering overview Camera Pixels on the screen 3D data 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 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

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.

From: Zhang, CSUSM, Introduction to Ray Tracing From Pixels to Rays 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: sampling Camera Pixels on the screen 3D data x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Sampling is the most common method for “ray-casting” volume rendering Do we know how to do this sampling?

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?

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

Transfer Function

“Alpha Channel” Represents opacity – 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 SampleScalar Value RGBA Quiz: calculate the 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)

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 = (Fa*Fr+(1-Fa)*Ba*Br, Fa*Fg+(1-Fa)*Ba*Bg, Fa*Fb+(1-Fa)*Ba*Bb, Fa+(1-Fa)*Ba) Alpha component is important! Any observations?

Outline Find Ray For That Pixel Intersect Volume With Ray Calculate Color From Intersection 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.

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

Opacity Correction ems/gpugems_ch39.html

New Material: Volume Rendering

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 ( ) – 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)

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 temperature density 32F 212F 122F 167F 77F

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

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

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?

Unstructured Meshes

An example mesh Why do you think the triangles change size?

Types of Meshes Curvilinear Adaptive Mesh Refinement Unstructured

Curvilinear Mesh Logically rectilinear – Each cell has an (i, j) – Always left, right, bottom, top neighbor (unless on boundary) Points can be anywhere … as long as the cells don’t overlap VTK calls this “vtkStructuredGrid”

Curvilinear Mesh A curvilinear mesh has 5x5 cells and a cell-centered variable stored. Quiz: how many bytes to store this data set if all data is in single precision floating point? 2 ints + 6x6 floats (points) + 5x5 floats (variable) = 2*4+36*4+25*4 = 63*4 = 272 bytes 2 ints + 6x6 floats (points) + 5x5 floats (variable) = 2*4+36*4+25*4 = 63*4 = 272 bytes

Example unstructured mesh Meshes contain: – Cells – Points This mesh contains 3 cells and 13 vertices Pseudonyms: Cell == Element == Zone Point == Vertex == Node

Example unstructured mesh Cell 0: – { (0, 0, 0), // 10 (1, 0, 0), // 11 (1, 1, 0), // 8 (0, 1, 0), // 7 (0, 0, 1), // 4 (1, 0, 1), // 5 (1, 1, 1), // 2 (0, 1, 1) } // 1 If we stored each cell like this, how many bytes would it take? (assume single precision) If we stored each cell like this, how many bytes would it take? (assume single precision) A: 1 int (# cells), 3 ints (# pts per cell), floats = 268 bytes Let’s call this the “explicit” scheme

Example unstructured mesh Pts: – {(0, 1, 1), (1, 1, 1), (2,1,1), (0,0,1), (1,0,1), (2,0,1), (0,1,0), (1,1,0), (2,1,0), (0,0,0), (1,0,0), (2,0,0), (2.5, 0.5, 0.5)} Cells: – 3 cells 1 st cell: hexahedron – (10,11,8,7,4,5,2,1) 2 nd cell: hexahedron – (11,12,9,8,5,6,3,2) 3 rd cell: prism – (13,3,6,12,9) If we stored each cell like this, how many bytes would it take? (assume single precision) If we stored each cell like this, how many bytes would it take? (assume single precision) A: 1 int (# pts), 1 int (# cells), 3 ints (# cell type), 13*3 floats (pts), ints = 260 bytes Let’s call this the “connectivity” scheme

Comparing unstructured mesh storage schemes Hexahedral meshes: each internal point incident to 8 cells – Explicit scheme: represent that point 8 times: 24 floats for storage – Connectivity scheme: represent that point once in point list, 8 times in connectivity list: 3 floats + 8 ints (takeaway: connectivity wins!) Further benefit to connectivity scheme is in finding exterior faces.

Finding external faces: motivation Interval volume, clip: – Take data set (rectilinear, unstructured, or other) and produce unstructured mesh – When rendering, only want to render the faces on the outside (the inside aren’t visible) Question: what proportion of faces are exterior? Question: how to find exterior faces?

Finding external faces: algorithm For each face, count how many cells are incident. – If “1”, then external – If “2”, then interior Question: why does this work?

Finding exterior faces: algorithm Estimate # of faces (ncells * 6 / 2) Double that number Create a hash table of that size For each cell C – For each face F of C Create hash index for F based on connectivity indices Search hash table – If F already there, remove F from hash – If face not there, add F to hash All faces in hash are exterior

Interpolation for arbitrary cells: tetrahedrons Assume tetrahedron T, point P in T Goal: calculate F(P) P0 P1 P2 P3 P

Interpolation for arbitrary cells: tetrahedrons Assume tetrahedron T, point P in T Goal: calculate F(P) P0 P1 P2 P3 P Set up parametric coordinate system R S T

Interpolation for arbitrary cells: tetrahedrons Assume tetrahedron T, point P in T Goal: calculate F(P) P0 P1 P2 P3 P Calculate parametric coordinates (a,b,c) R S T P = P0+aR+bS+cT This is a 3x3 matrix solve. This matrix is invertible since R,S,T form a basis

Interpolation for arbitrary cells: tetrahedrons Assume tetrahedron T, point P in T Goal: calculate F(P) P0 P1 P2 P3 P Calculate F(P) as weighted sum of vertices R S T P = P0+aR+bS+cT F(P) = sum(Wi*F(Pi)) W0 = 1-a-b-c W1 = a W2 = b W3 = c

General idea Set up parametric coordinate system Calculate parametric coordinates for P Calculate F(P) as Sum(Wi*F(Pi)) – Weights Wi can get pretty tricky. VTK book has weights & good description in Ch. 8.2.

How to do contouring Basically the same: – Iterate over cells – Identify case – Lookup case in table – Create resulting geometry Difference: – New tables for each cell type

How to do ray casting Basically the same: – Cast rays for every pixel on the screen – Sample along rays – Apply transfer function – Composite front to back – Assign color to image Differences: – Sampling gets hard! Which cell contains a sample point? – Need smart data structures …. – …. Or a way to transform data to make it easy

How to do particle advection Basically the same: – Start with a seed location – Evaluate velocity – Displace particle – Repeat until termination criteria reached Differences: – Evaluating velocity different x2: Now a harder proposition: which cell contains particle? Now more math: how to LERP velocity?

Adaptive Mesh Refinement Put resolution where you want it… … but simpler than unstructured (indexing & interpolation) and cheaper (memory) Problems: – Everything great, except at the boundaries….

And now… You know everything I think you should know after having taken a sci-vis class. – Still need unstructured mesh lectures I am proud of this class. Next few lectures should be fun. Projects will hopefully be fun too.