Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering

Similar documents
Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering

Texture Mapping. Mike Bailey.

Computational Strategies

Lecture 07: Buffers and Textures

Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.

Lecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

OpenCL / OpenGL Texture Interoperability: An Image Blurring Case Study

CS212. OpenGL Texture Mapping and Related

Grafica Computazionale

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

Assignment #4: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing

Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016

Lighting and Texturing

Computer Graphics. Three-Dimensional Graphics VI. Guoying Zhao 1 / 73

Objectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)

CT5510: Computer Graphics. Texture Mapping

ก ก ก.

三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒

OpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options

Cap. 3 Textures. Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre

Texturing. Slides done by Tomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

CS 432 Interactive Computer Graphics

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

Texture Mapping and Special Effects

Lecture 5. Scan Conversion Textures hw2

Lecture 5 3D graphics part 3

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics

CS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial

OpenGL & Visualization

Scalar Visualization

Computer Graphics Programming

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

Scalar Visualization. In Visualization, we Use the Concept of a Transfer Function to set Color as a Function of Scalar Value.

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Scalar Field Visualization. Some slices used by Prof. Mike Bailey

Yazhuo Liu Homework 3

Computer Graphics Lighting

Computer Graphics Lighting. Why Do We Care About Lighting?

Overview. Goals. MipMapping. P5 MipMap Texturing. What are MipMaps. MipMapping in OpenGL. Generating MipMaps Filtering.

Assignment #6 2D Vector Field Visualization Arrow Plot and LIC

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

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

CS452/552; EE465/505. Texture Mapping in WebGL

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

Department of Computer Sciences Graphics Spring 2013 (Lecture 19) Bump Maps

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

QUESTION 1 [10] 2 COS340-A October/November 2009

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map

Texturing. Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013

IntMu.Lab5. Download all the files available from

Lecture 2 2D transformations Introduction to OpenGL

3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. x y z. x y z. glvertex3f(x, y,z);

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

GEOMETRIC OBJECTS AND TRANSFORMATIONS I

Steiner- Wallner- Podaras

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Introduction to OpenGL

Page 6 PROCESSOR PROCESSOR FRAGMENT FRAGMENT. texy[1] texx. texy[1] texx. texy[0] texy[0]

CS179: GPU Programming

Volume Graphics Introduction

Texturas. Objectives. ! Introduce Mapping Methods. ! Consider two basic strategies. Computação Gráfica

Computer Graphics. Bing-Yu Chen National Taiwan University

Texture Mapping and Sampling

Shading/Texturing. Dr. Scott Schaefer

MULTI-PASS VS SINGLE-PASS CUBEMAP

+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation

Introduction to Computer Graphics with WebGL

New Concepts. Loading geometry from file Camera animation Advanced lighting and materials Texture mapping Display lists

Magnification and Minification

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

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

CSCI E-74. Simulation and Gaming

Textures. Datorgrafik 2006

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline:

Most device that are used to produce images are. dots (pixels) to display the image. This includes CRT monitors, LCDs, laser and dot-matrix

CS 4204 Computer Graphics

Texture Mapping. Texture (images) lecture 16. Texture mapping Aliasing (and anti-aliasing) Adding texture improves realism.

lecture 16 Texture mapping Aliasing (and anti-aliasing)

Visualization based on interactive clipping: application to confocal data

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

Lecture 5b. Transformation

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) Texture map. The texture

Marching Squares Algorithm. Can you summarize the marching squares algorithm based on what we just discussed?

Texture. No Textures

LSU EE Homework 3 Solution Due: 12 October 2015

Data Visualization (DSC 530/CIS )

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

New topic for Java course: Introduction to 3D graphics programming

CIS 467/602-01: Data Visualization

Scalar Field Visualization I

Lecture overview. Visualisatie BMT. Transparency. Transparency. Transparency. Transparency. Transparency Volume rendering Assignment

Texture Mapping. Computer Graphics, 2015 Lecture 9. Johan Nysjö Centre for Image analysis Uppsala University

Imaging and Raster Primitives

CG Programming: 3D Texturing

General Purpose computation on GPUs. Liangjun Zhang 2/23/2005

Transcription:

Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering Goals: Due October 4 th, before midnight This is the continuation of Assignment 4. The goal is to implement a simple DVR -- 2D texture-based volume rendering. You will need to re-use the 3D synthetic temperature generated in Assignment 4. Your color coding, 3D slicing, and wire-frame iso-surfacing should still be functional for this Assignment. Tasks: Task 1: Writing question (20 points) 1. There are a number of important components (or sub-tasks) needed by direct volume rendering. Please describe them. Which one is the most important sub-task, and why? 2. One issue of the image-order method (e.g., ray-casting) is that not all vorxels participate during the rendering. Describe a strategy that may involve more voxels during the ray-casting without using the object-order approach. Task 2. Texture-based Direct Volume Rendering (80 points) Implement the 2D texture approach of the texture-based volume rendering. Here is a more detailed instruction on how you should do this. First, create a volume of nodes. You should have done this for the previous assignment, but you may need to re-set the resolution of your 3D grid (see below). struct node Nodes[NX][NY][NZ]; //Pick NX, NY, and NZ such that each is a power of 2, e.g. 64, 128, 256 1

For each node structure, compute its scalar value S (which you may need to re-compute again due to the different NX, NY, and NZ) and its associated R, G, B. Use the same scalar value function and colormapping scheme that you have been using in the past assignments. Create a normal slider that will determine the opacity that the visible S values will have. (10 points) Add an interface to turn on and off the GL_Linear for the texture interpolation (10 points). Write 3 routines, CompositeXY(), CompositeXZ(), and CompositeYZ(). These will composite the voxels and fill one of the following 3 texture arrays: TextureXY[NZ][NY][NX][4]; TextureXZ[NY][NZ][NX][4]; TextureYZ[NX][NZ][NY][4]; These arrays hold 4 components with R, G, B channels and an alpha channel to control the opacity. The following routine can be used to composite the texture at XY planes. The texture on XZ and YZ planes can be composited similarly. void CompositeXY( void ) int x, y, z, zz; float alpha; /* opacity at this voxel float r, g, b; /* running color composite for( x = 0; x < NX; x++ ) for( y = 0; y < NY; y++ ) r = g = b = 0.; for( zz = 0; zz < NZ; zz++ ) /* which direction to composite: if( Zside == PLUS ) z = zz; z = ( NZ-1 ) - zz; if(????? ) // determine whether the value is out of the // range set by the range slider r = g = b = 0.; alpha = 0.; r = Nodes[x][y][z].r; 2

g = Nodes[x][y][z].g; b = Nodes[x][y][z].b; alpha = MaxAlpha; TextureXY[zz][y][x][0] = () ( 255.*r +.5 ); TextureXY[zz][y][x][1] = () ( 255.*g +.5 ); TextureXY[zz][y][x][2] = () ( 255.*b +.5 ); TextureXY[zz][y][x][3] = () ( 255.*alpha +.5 ); Depending on the rotation of the volume, you will want to draw the parallel planes in the X, Y, or Z direction, and draw them minus-to-plus or plus-to-minus. The following code tells you which of these cases is the one that you will need. /* which way is a surface facing: const int MINUS = 0 ; const int PLUS = 1 ; /* what is the major direction: #define X 0 #define Y 1 #define Z 2 int Major; /* X, Y, or Z int Xside, Yside, Zside; /* which side is visible, PLUS or MINUS / determine which sides of the cube are facing the user this assumes that the rotation is being done by: glrotatef( Yrot, 0., 1., 0. ); glrotatef( Xrot, 1., 0., 0. ); * void DetermineVisibility() 3

float xr, yr; float cx, sx; float cy, sy; float nzx, nzy, nzz; and z side /* z component of normal for x side, y side, xr = Xrot * ( M_PI/180. ); yr = Yrot * ( M_PI/180. ); cx = cos( xr ); sx = sin( xr ); cy = cos( yr ); sy = sin( yr ); nzx = -sy; nzy = sx * cy; nzz = cx * cy; /* which sides of the cube are showing: /* the Xside being shown to the user is MINUS or PLUS Xside = ( nzx > 0.? PLUS : MINUS ); Yside = ( nzy > 0.? PLUS : MINUS ); Zside = ( nzz > 0.? PLUS : MINUS ); /* which direction needs to be composited: if( fabs(nzx) > fabs(nzy) && fabs(nzx) > fabs(nzz) ) Major = X; if( fabs(nzy) > fabs(nzx) && fabs(nzy) > fabs(nzz) ) Major = Y; Major = Z; To draw the obtained texture arrays using the OpenGL texture mapping functionality. Here is what you will do. gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); gltexenvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); filter = GL_NEAREST; if( Bilinear ) filter = GL_LINEAR; gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter ); gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter ); glpixelstorei( GL_UNPACK_ALIGNMENT, 1 ); glenable( GL_TEXTURE_2D ); 4

glblendfunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glenable( GL_BLEND ); if( Major == Z ) if( Zside == PLUS ) z0 = -10.; dz = 20. / (float)( NZ - 1 ); z0 = 10.; dz = -20. / (float)( NZ - 1 ); for( z = 0, zcoord = z0; z < NZ; z++, zcoord += dz ) glteximage2d( GL_TEXTURE_2D, 0, 4, NX, NY, 0, GL_RGBA, GL_UNSIGNED_BYTE, &TextureXY[z][0][0][0] ); glbegin( GL_QUADS ); gltexcoord2f( 0., 0. ); glvertex3f( -10., -10., zcoord ); gltexcoord2f( 1., 0. ); glvertex3f( 10., -10., zcoord ); gltexcoord2f( 1., 1. ); glvertex3f( 10., 10., zcoord ); gltexcoord2f( 0., 1. ); glvertex3f( -10., 10., zcoord ); glend(); Grades: Tasks Total points 1 20 2 80 5