Ch 1. Introduction Scientific Visualization Ch 2. Computer ... · Intro to VTK and Python. More...

Post on 27-May-2020

12 views 0 download

Transcript of Ch 1. Introduction Scientific Visualization Ch 2. Computer ... · Intro to VTK and Python. More...

IT Uppsala universitet

Scientific Visualization5 hp

Fall 2010

Filip Malmberg filip@cb.uu.se

Ch 1. IntroductionCh 2. Computer Graphics primerCh 4. The Visualization pipeline

UU/IT

08-01-29 | #2@ UU/IT

Filip Malmberg (filip.malmberg@cb.uu.se) Stefan Seipel (stefan.seipel@cb.uu.se) Patrik Malm (patrik.malm@cb.uu.se) Pontus Olsson (pontus.olsson@cb.uu.se) Gustaf Kylberg (gustaf.kylberg@cb.uu.se)

Teachers

Centre for Image Analysis, CBAITC building 2, floor 1Office 2111

UU/IT

08-01-29 | #3@ UU/IT

About me PhD-student in image processing. Working with medical volume images. Using visualization as a tool in my research.

UU/IT

08-01-29 | #4@ UU/IT

About the course 10 lectures 3 Computer exercises/assignments (3 hp) Written exam (2 hp)

Textbook:The Visualization Toolkit, An Object-Oriented Approach to 3D Graphics,4th edition, Kitware, Inc., 2006ISBN 1-930934-19-X

UU/IT

08-01-29 | #5@ UU/IT

Course webpagehttp://www.it.uu.se/edu/course/homepage/vetvis/ht10/

UU/IT

08-01-29 | #6@ UU/IT

What is visualization?Dictionary:vi·su·al·ize

• To form a mental image of; envisage: try to visualize the scene as it is described

• To make visible

UU/IT

08-01-29 | #7@ UU/IT

Interpreting data in visual terms When data is complex: Collected/Computed

When numerous data Visualization is not a substitute to,

but in addition to, statistical analysis and other quantitative methods

Visualization takes advantage of human sensory abilities• Pattern recognition, Trend discovery, etc.

UU/IT

08-01-29 | #8@ UU/IT

Example: Graphs

0500

1000150020002500300035004000

Mfl

op/s

ec

2 4 8 16 32 64

Number of Processors

158,7601,121,320

Unknowns

IBM SP2

UU/IT

08-01-29 | #9@ UU/IT

Some more sophisticated examples

Nuclear, Quantum, and Molecular Modeling

Structures, Fluids, and Fields

Advanced Imaging and Data Management

UU/IT

08-01-29 | #10@ UU/IT

Scientific visualization Scientific visualization is the process of

exploring, transforming, and viewing data as images

The dimensionality of the data is generally larger than or equal to 3

Visualization is often interactive We are not trying to create realistic images,

but to visualize data in an informative way Dependent on the task given

UU/IT

08-01-29 | #11@ UU/IT

Visualization serves many purposes ”Pretty pictures” For further analysis Debugging ...

UU/IT

08-01-29 | #12@ UU/IT

Visualization can be used in every step of most processes

Problem formulation Mathematical modelling Software/Hardware Simulation Result Interpretation

UU/IT

08-01-29 | #13@ UU/IT

General development of visualization

Rather new discipline still developing into sub-areas

Multi-disciplinary (Computer science, human perception, computer graphics, HCI)

Faster computers, high-speed networks, new user-interfaces

UU/IT

08-01-29 | #14@ UU/IT

Ch 3: Computer graphics primer Creating images with a computer – 3D

UU/IT

08-01-29 | #15@ UU/IT

Digital images

Image of a rat Close-up of rat nose

94 100 104 119 125 136 143 153 157 158103 104 106 98 103 119 141 155 159 160109 136 136 123 95 78 117 149 155 160110 130 144 149 129 78 97 151 161 158109 137 178 167 119 78 101 185 188 161100 143 167 134 87 85 134 216 209 172104 123 166 161 155 160 205 229 218 181125 131 172 179 180 208 238 237 228 200131 148 172 175 188 228 239 238 228 206161 169 162 163 193 228 230 237 220 199

UU/IT

08-01-29 | #16@ UU/IT

Color

UU/IT

08-01-29 | #17@ UU/IT

Visible spectrum Light=electromagnetic radiation

UU/IT

08-01-29 | #18@ UU/IT

Colour The eye’s and the brain’s impression of electromagnetic

radiation in the visual spectra

How is colour percieved?

Lightsource

Reflecting object

Detector

rods & cones

red-sensitive

green-sensitive

blue-sensitive

UU/IT

08-01-29 | #19@ UU/IT

Human color perception

3 types of “detectors”->We can think of colour as a “3D space”.

UU/IT

08-01-29 | #20@ UU/IT

RGB/ CMY colour space

RGB - for additive colour mixing, e.g., on a computer screenCMY - for subtractive colour mixing, e.g., in printing or painting

UU/IT

08-01-29 | #21@ UU/IT

HLS colour space Hue: dominant wavelength, tone Lightness: Intensity, brightness Saturation, dilution by white

Important aspects:•Intensity decoupled from colour•Related to how humans perceive colour

UU/IT

08-01-29 | #22@ UU/IT

Computer graphicsComponents: Model: geometry, surface properties, … Lighting: number, positions, properties Viewpoint Projection

Computer graphics is the foundation of data visualization... but visualization is more than computer graphics!

UU/IT

08-01-29 | #23@ UU/IT

Rendering Generation of an image from data. “Physical” view:

• Rays of light are emitted from a light source• Some rays strike an object• The object surface absorbs some light and reflects

the rest• Some reflected light enter our eyes (or a camera)• We ”see” the object

UU/IT

08-01-29 | #24@ UU/IT

Ray-tracing or ray-casting Ray-tracing simulates the interaction of light

with objects by following the path of each light ray.

In computations: • follow the rays backwards from the eye into the

scene

UU/IT

08-01-29 | #25@ UU/IT

Computationally: Ray casting Only rays that reach the eye matter Reverse direction and cast rays, instead of

trace rays Need at least one ray per pixel

UU/IT

08-01-29 | #26@ UU/IT

Image-order and object-order methods

Ray-tracing is an image-order process, determining what happens to each pixel (ray of light), one at a time

An object-order process works by rendering each object, one at a time

UU/IT

08-01-29 | #27@ UU/IT

Rasterization Line drawing Polygon (triangle) filling

Scan one line at a time:scan conversion/ scan line rendering

UU/IT

08-01-29 | #28@ UU/IT

What's so interesting about triangles?

Easy to handle mathematically (e.g. always flat)

In CG, complex surfaces are often approximated by a large number of triangles.

UU/IT

08-01-29 | #29@ UU/IT

// Image order renderingfor all pixels for all objects calculate the object's contribution to the pixel colour endend

Image-order and object-order methods

// Object order renderingfor all objects for all pixels (occupied by the object!) calculate the object's contribution to the pixel colour endend

UU/IT

08-01-29 | #30@ UU/IT

Lights in CG We simplify by assuming (infinitely distant)

point-shaped light sources Light is emitted in all directions from a single

point in space Far away implies that rays are parallel

UU/IT

08-01-29 | #31@ UU/IT

Light-surface interaction The Phong reflection model =

• Ambient reflection +• Diffuse reflection +• Specular reflection

n

l

rv

φθ

UU/IT

08-01-29 | #32@ UU/IT

Phong reflection model

Illustration of the Phong Reflection Model. Created by Brad Smith, August 7, 2006.

UU/IT

08-01-29 | #33@ UU/IT

Polygonal shading

Flat Gouraud Phong

Illumination depends on normal vector!

UU/IT

08-01-29 | #34@ UU/IT

Local vs. Global illumination

Historically:

Ray tracing

Scan line

Global illumination

Local illumination

Offline rendering

Realtime rendering

UU/IT

08-01-29 | #35@ UU/IT

Surface vs. volume rendering For simplicity, we can view the surface of

objects and their interactions with light However, translucent objects scatter light and

we need to consider properties inside the objects

Chapter 7 describes volume rendering (Lecture 4)

vs.

UU/IT

08-01-29 | #36@ UU/IT

Camera model

UU/IT

08-01-29 | #37@ UU/IT

Camera movementsMovement around focal point Movement around camera center

UU/IT

08-01-29 | #38@ UU/IT

Coordinate systems4 coordinate systems: Model: where the object is defined World: 3D space where actors are positioned View: what is visible to the camera Display: (x, y) pixel locations See Figure 3-14

UU/IT

08-01-29 | #39@ UU/IT

Coordinate transformations 3D to 2D Perspective Rotation, translation, scaling Homogeneous coordinates 4x4 transformation matrices

UU/IT

08-01-29 | #40@ UU/IT

Hidden surface removal Inter-object occlusion is an important depth

cue. Needs to be handled correctly when rendering

3D objects.

UU/IT

08-01-29 | #41@ UU/IT

Z-buffer algorithm

fill z-buffer with infinite distancefor all objects for each (object) pixel calculate object's z-value if z(x,y) is closer than z-buffer(x,y) draw pixel z-buffer(x,y)=z(x,y) end endend

Note: With ray tracing, we get this for “free”

UU/IT

08-01-29 | #42@ UU/IT

Learning more about CG• Computer graphics, 10 hp• Period 3

UU/IT

08-01-29 | #43@ UU/IT

Ch 4. The visualization pipeline Computer graphics: Convert graphics

primitives to images Visualization: Convert data to graphics

primitives

UU/IT

08-01-29 | #44@ UU/IT

Visualization pipelineThe pipeline consists of objects to represent data objects to operate on data indicated direction of data flow (arrow

connections between objects)

UU/IT

08-01-29 | #45@ UU/IT

Data objects Represent information Provide methods to create, access, and delete

data To modify data is not really allowed; reserved

for process objects

UU/IT

08-01-29 | #46@ UU/IT

Process objects Operate on input data to generate output data New data or new form

Source objects • initiate (read, generate) visualization data flow

Filter objects • maintain visualization data flow

Mapper objects • terminate (write, graph) visualization data flow

UU/IT

08-01-29 | #47@ UU/IT

A visualization pipeline

UU/IT

08-01-29 | #48@ UU/IT

Pipeline topology How to connect data objects and process

objects Pipeline connections

• type concerns the form of data that process objects take as input or generate as output

• multiplicity deals with # of input and # of output allowed

Feedback loops• view intermediate results

UU/IT

08-01-29 | #49@ UU/IT

Executing the pipeline Causing each process object to operate Most often repeated executions due to user

interaction• change parameters of process object• change input to process object

For efficiency reasons, see to that only execute the process objects whose input has changed

Synchronization between process objects required prior to execution

UU/IT

08-01-29 | #50@ UU/IT

Memory and computation trade-off Visualization is resource demanding in

• computer memory due to input size• computational times due to algorithm complexity

Static memory model• intermediate data saved to reduce overall

computation Dynamic memory model

• intermediate data discarded, but may have to be re-computed

Combination of static and dynamic models

UU/IT

08-01-29 | #51@ UU/IT

Next lecture Intro to VTK and Python. More about the visualization pipeline, as

implemented in VTK.

IT Uppsala universitet

Scientific Visualization5 hp

Fall 2010

Filip Malmberg filip@cb.uu.se

Ch 1. IntroductionCh 2. Computer Graphics primerCh 4. The Visualization pipeline