Monte Carlo simulation

Slides:



Advertisements
Similar presentations
GPGPU labor XI. Monte Carlo szimuláció. Kezdeti teendők Tantárgy honlapja, Monte Carlo szimuláció A labor kiindulási alapjának letöltése (lab11_base.zip),
Advertisements

Prepared 7/28/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
In our lesson today we will learn how to find the area of a building.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Ray Tracing Tutorial. Ray Casting One type of visibility algorithm.
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
CS Data Structures Appendix 1 How to transfer a simple loop- expression to a recursive function (factorial calculation)
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
Volume Rendering using Graphics Hardware
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.
Acceleration Digital Image Synthesis Yung-Yu Chuang 10/4/2005 with slides by Mario Costa Sousa and Pat Hanrahan.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
Pipelines are for Whimps Raycasting, Raytracing, and Hardcore Rendering.
REAL-TIME VOLUME GRAPHICS Markus Hadwiger VRVis Research Center, Vienna Eurographics 2006 Real-Time Volume Graphics [04] GPU-Based Ray-Casting.
Introduction to CUDA (1 of 2) Patrick Cozzi University of Pennsylvania CIS Spring 2012.
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
-Global Illumination Techniques
03/28/03© 2005 University of Wisconsin NPR Today “Comprehensible Rendering of 3-D Shapes”, Takafumi Saito and Tokiichiro Takahashi, SIGGRAPH 1990 “Painterly.
3D Volume Visualization. Volume Graphics  Maintains a 3D image representation that is close to the underlying fully-3D object (but discrete)  경계표면 (Boundary.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Ray-tracing.
Bump Map 1. High Field Function: H(u, v) New Normal : N’
GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Motivation Properties of real data sets Surface like structures
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
Chris Covington CSCI263 – Final Project May 3, 2005 Changes and Additions: Further implemented the illumination model. Illumination is now calculated in.
Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa.
OpenGL Shading Language
Unstructured Volume Rendering. Grid Types uniformrectilinearregularcurvilinear Structured Grids: regularirregularhybridcurved Unstructured Grids:
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
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.
RENDERING : Global Illumination
EnSight analyze, visualize, communicate 2D Textures in EnSight example without texturesexample with textures.
Basic Ray Tracing CMSC 435/634.
3D Rendering 2016, Fall.
Advanced Computer Graphics
Tips for Shading Your Terrain
Visualization Shading
Volume Visualization Chap. 10 November 20 , 2008 Jie Zhang Copyright ©
CSE 455 HW 1 Notes.
Ray Tracing Dr. Scott Schaefer.
3D Graphics Rendering PPT By Ricardo Veguilla.
Ray Tracing Geometry CSE 681.
What are Range Images?.
Ray Tracing Geometry CSE 681.
An Approximation of Volumetric Lighting
cuRAND cuRAND uses GPU to generate pseudorandom numbers
Sketch the region enclosed by {image} and {image}
Sketch the region enclosed by {image} and {image}
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Ray Casting II MIT EECS Frédo Durand and Barb Cutler
Real-Time Volume Graphics [06] Local Volume Illumination
Folyadékszimuláció.
Hank Childs, University of Oregon
Digital Image Synthesis Yung-Yu Chuang 10/4/2005
Image synthesis using classical optics
CS5500 Computer Graphics May 29, 2006
Monte Carlo simulation
Programming with OpenGL Part 3: Shaders
Ray Tracing Geometry CSE 681.
Environment Mapping.
Introduction to Ray Tracing
ECE/CSE 576 HW 1 Notes.
Computer Graphics Ray tracing
Positioning Boxes Using CSS
Visible-Surface Determination
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Photon Density Estimation using Multiple Importance Sampling
Presentation transcript:

Monte Carlo simulation

Isosurface raycasting (visualization.cl) __kernel void isosurface(const int width, const int height, __global float4* visualizationBuffer, const int resolution, __global float* volumeData, const float isoValue, const float16 invViewMatrix){ // Images space coordinates int2 id = (int2)(get_global_id(0), get_global_id(1)); float2 uv = (float2)( (id.x / (float) width)*2.0f-1.0f, (id.y / (float) height)*2.0f-1.0f ); // Bounding box of the model in the 3D space float4 boxMin = (float4)(-1.0f, -1.0f, -1.0f,1.0f); float4 boxMax = (float4)(1.0f, 1.0f, 1.0f,1.0f); // Ray in the 3D space struct ray eyeRay; eyeRay.origin = (float4)(invViewMatrix.sC, invViewMatrix.sD, invViewMatrix.sE, invViewMatrix.sF); float4 temp = normalize(((float4)(uv.x, uv.y, -2.0f, 0.0f))); eyeRay.direction.x = dot(temp, ((float4)(invViewMatrix.s0,invViewMatrix.s1,invViewMatrix.s2,invViewMatrix.s3))); eyeRay.direction.y = dot(temp, ((float4)(invViewMatrix.s4,invViewMatrix.s5,invViewMatrix.s6,invViewMatrix.s7))); eyeRay.direction.z = dot(temp, ((float4)(invViewMatrix.s8,invViewMatrix.s9,invViewMatrix.sA,invViewMatrix.sB))); eyeRay.direction.w = 0.0f; float4 color = (float4)(0.0f); // Intersecting the bounding box with the ray float tnear, tfar; int hit = intersectBox(eyeRay.origin, eyeRay.direction, boxMin, boxMax, &tnear, &tfar); if(hit){ // TODO color = (float4)(1.0f); } // Writing the result color the image buffer if(id.x < width && id.y < height){ visualizationBuffer[id.x + id.y * width] = color;

Isosurface raycasting Step between tnear and tfar Calculate the current position in the 3D space Read the density (getDensityFromVolume) If the density is greater than isoValue, than the color shall be (float4)(1.0f) Exit from the loop

Isosurface raycasting Let`s add shading Light direction: 0.3, -2.0, 0.0, 0.0 To get the normal vector in the volumetric model, use the getNormalFromVolume function Color is defined as: clamp(dot(lightDir, normal), 0.0, 1.0)

Isosurface raycasting Hemisphere lighting Color: 0.5f + 0.5f * dot(lightDir, normal)

Alpha blended raycasting (visualization.cl) __kernel void alphaBlended(const int width, const int height, __global float4* visualizationBuffer, const int resolution, __global float* volumeData, const float alphaExponent, const float alphaCenter, const float16 invViewMatrix){ int2 id = (int2)(get_global_id(0), get_global_id(1)); float2 uv = (float2)( (id.x / (float) width)*2.0f-1.0f, (id.y / (float) height)*2.0f-1.0f ); float4 boxMin = (float4)(-1.0f, -1.0f, -1.0f,1.0f); float4 boxMax = (float4)(1.0f, 1.0f, 1.0f,1.0f); // calculate eye ray in world space struct ray eyeRay; eyeRay.origin = (float4)(invViewMatrix.sC, invViewMatrix.sD, invViewMatrix.sE, invViewMatrix.sF); float4 temp = normalize(((float4)(uv.x, uv.y, -2.0f, 0.0f))); eyeRay.direction.x = dot(temp, ((float4)(invViewMatrix.s0,invViewMatrix.s1,invViewMatrix.s2,invViewMatrix.s3))); eyeRay.direction.y = dot(temp, ((float4)(invViewMatrix.s4,invViewMatrix.s5,invViewMatrix.s6,invViewMatrix.s7))); eyeRay.direction.z = dot(temp, ((float4)(invViewMatrix.s8,invViewMatrix.s9,invViewMatrix.sA,invViewMatrix.sB))); eyeRay.direction.w = 0.0f; float4 sum = (float4)(0.0f); float tnear, tfar; int hit = intersectBox(eyeRay.origin, eyeRay.direction, boxMin, boxMax, &tnear, &tfar); if(hit){ sum = (float4)(1.0f); } if(id.x < width && id.y < height){ visualizationBuffer[id.x + id.y * width] = (float4)(sum);

Alpha blended raycasting „X-Ray” image Step from tfar to tnear Sum the density according to the absorption Alpha = pow(density, alphaExponent) * step Sum = (1-alpha)*sum + alpha * (float4)(1.0)

Alpha blended raycasting Add shading Step from tfar to tnear Sum the lighting while taking the absorption into consideration Density: getDensityFromVolume Normal vector: getNormalFromVolume Alpha: clamp(alphaExponent * (density – alphaCenter) + 0.5, 0.0, 1.0 Color: 0.5f + 0.5f * dot(lightDir, normal) Color sum: (1-alpha) * sum + alpha * color

Alpha blended raycasting Using a transfer function color *= (float4)(density, density * density, density * density * density, 1.0f) + 0.1f;