• 沒有找到結果。

From Graphics to Visualization

N/A
N/A
Protected

Academic year: 2022

Share "From Graphics to Visualization"

Copied!
31
0
0

加載中.... (立即查看全文)

全文

(1)

From Graphics to Visualization

(2)

Introduction Light Sources

Surface Lighting Effects

Basic (Local ) Illumination Models Polygon-Rendering Methods

Texture Mapping

Transparency and Blending Visualization Pipeline

outline

(3)

Introduction

• Illumination Model (Lighting/Shading Model)

Calculation of color on an illuminated position on the surface of an object

• Surface Rendering

A procedure for applying a lighting model to

obtain pixels colors for all projected surface

positions

(4)

• Point Source

Diverging ray paths from a point light source

Light Sources

(5)

Light Sources

• Distributed Light Source

Light rays from an infinitely distant light source illuminate an object along nearly parallel light paths

(6)

Surface Lighting Effects

Diffusereflections from

a surface (dull/roughsurface) (shinysurface) Specular reflection superimposed on diffuse reflection vectors

(Global Illumination) Surface lighting effects are produced by a combination of illumination

from light sources and reflection from other surfaces.

(7)

Rendering methods differ in approximating lighting effects

• Global illumination: ray tracing, accurate by computationally expensive

• Local illumination: relate the illumination of a given scene point directly to the light set, not to any other scene points If we denote the angle of incidence between the incoming Light direction and the surface

Illumination Models

(8)

1) Ambient Light

2) Diffuse Reflection

If we denote the angle of incidence between the incoming Light direction and the surface normal as θ

a a ambdif f k I

I

Angle of incidence θ between the unit light- source direction vector L and the unit normal vector N at a surface position.

Basic (Local )Illumination

Models

(9)

Basic (Local )Illumination Models

2) Diffuse Reflection

I

I,diff

=K

d

I

l

cos θ I

I,diff

=K

d

I

l

(N‧L)

kd:

diffuse-reflection coefficient, or diffuse reflectivity.

◆ Lambertian reflectors

◆ Lambert’s cosine law

Total Diffuse-reflection of a single point-source illumination



 

0 L

N if

,

0 L

N if ), (

a a

l d a

a

diff

k I

L N I k I

I k

(10)

Basic (Local )Illumination Models

3) Specular Reflection and Phong Model

Phong Specular-Reflection Model (Phong Model)

l ns

spec

l

W I

I

,

(  ) cos

Specular reflection angle equals angle of incidence θ

 

 

0 L N or 0 R V if

, 0 . 0

0 L N and 0 R V if , ) (

,

ns

l s spec

l

R V I I k

(2-4) (2-5)

(11)

Basic (Local )Illumination Models

3) Specular Reflection and Phong Model

Modeling specular reflections (shaded area) with parameter ns

The projection of either

L or R onto the direction of the normal vector N has a magnitude equal to N˙L.

L N

L N

R  ( 2  ) 

(12)

3) Specular Reflection and Phong Model

Specular reflections from a spherical surface for varying specular parameter values and a single light source

Basic (Local )Illumination

Models

(13)

3) Specular Reflection and Phong Model

Halfway vector H along the bisector of the angle between L and V.

|

| L V V H L

 

Basic (Local )Illumination

Models

(14)

Color Intensity Calculations

Phong Algorithm:

I = I

a

+ I

d

+ I

s

I

a:

ambient reflection I

d

: diffuse reflection I

s

: specular reflection I

a

=k

a

I

e

I

d

=k

d

I

l

cosα here cosα =(L‧N) I

s

=k

s

I

l

cos

m

β here cosβ=(R‧V)

Multiple light sources:

P

L

R N

α α β V

 

n

i i

s d

a

r C

I I I

I

i i

1

ri i

Here riis the distance to the light i and C is a constant

Il

L, N, R, V are vectors

(15)

Shading

• Technique To Render Solid Surfaces

• Determines How Surfaces Will Be Filled

• Process for Computing the Color Intensity Value for Each Pixel Contained in a Polygon

• The Most Common Shading Techniques Are:

– Flat Shading glShadeModel (GL_FLAT);

– Gouraud Shading glShadeModel (GL_SMOOTH);

– Phong Shading (OpenGL by default doesn't do phong shading )

(16)

Shading Techniques

Flat Shading

Gouraud Shading Phong Shading

No Shading

(17)

Flat Shading

(18)

Flat Shading

• Constant Shading Or Flat Shading

• The Simplest and Cheapest and Therefore Fastest Shading Method

• Filling An Entire Polygon with One Color Intensity

• This Model is Only Valid (Realistic) If:

– The light source is imagined to be at infinity – The viewer is at infinity

– The polygon is not an approximation to a curved surface

(19)

Gouraud Shading

(20)

Gouraud Shading

• Also called Smooth shading

• Color Interpolation Algorithm

– Interpolation along polygon edges – Interpolation across polygon surfaces

Color Values Given On A Per Vertex Basis

Interpolation Along The Edges

Interpolation Across The Surface

V1 V2

V3

(21)

Gouraud Shading Illustration

I

1

( x

1

, y

1

)

I

2

( , x y

2 2

)

I

3

( , x y

3 3

)

I

a

I

b

I

s

 

I

a

y y I y

s

y I y y

s

 1   

1 2

1

(

2

)

2

(

1

)

 

I

b

y y I y

s

y I y y

s

 1   

1 3

1

(

3

)

3

(

1

)

 

I

s

x x I x x I x x

b a

a b s b s a

  1   

( ) ( )

y

s

I

a j, 1

I

a j,

  I

a

I

b j, 1

I

b j,

  I

b

I

i1,s

I

i s,

  I

s

I

a

y y I I

 1 

1 2

1 2

( ) I

y y I I

b

 1 

1 3

1 3

( ) I

x x I I

s

b a

b a

  1 

( )

 1

 j

y

s

(22)

Phong Shading

(23)

Phong Shading

• An Interpolation Process Similar To Gouraud Shading

• Interpolation Over Normal Vector Instead of Vertex Color

– Normal vectors tell about an objects orientation

– Surface orientation is important in respect to the position of

• The observer/viewer of a scene

• The source of lighting

• Creates greater realism than Gouraud shading

– Specially when combined with an illumination model

– Usually implemented through application software

– Very computing intense

(24)

Phong Shading Illustration

( , x y

2 2

)

( , x y

3 3

)

y

s

N

1

N

3

N

2

N

a

N

s

N

b

1

1

(

2

)

2

(

1

)

2 1

s s

a

N y y N y y

y

N y

   

( ) ( )

1

1 3 3

1 3 1

s s

b

N y y N y y

y

N y

   

( ) ( )

1

a s

b s

b a a

b

s

N x x N x x

x

N x

   

 )

,

( x

1

y

1

(25)

Fill-Area Primitives

• Fill (Filled) Area

-- An area filled with some solid color or a pattern

• Surface Tessellation

-- Approximating a curved surface with polygon facets (a

polygon mesh)

(26)

Texture Mapping

Texture Mapping

(a) Texture Image; (b) Texture-mapped object

(27)

Texture Mapping

Texture Image

(28)

Texture Mapping

Texture Mapping: Coordinates Transformations

(29)

Texture Mapping

Texture Mapping

(30)

Transparency and Blending

(a) as Background + (b) as Foreground

=> blended as (c) The Grid

The Gaussian Surface

Height plot of e

-(x^2+y^2)

drawn

on top of the domain grid

(31)

Visualization Pipeline

float data[N_x,N_y]

Class Quad

) ( 2 2

) ,

f( x y e

x

y Continuous data

Discrete dataset

Geometric object

Displayed image

Data Acquisition

Data Mapping

Rendering

參考文獻

相關文件

Output : For each test case, output the maximum distance increment caused by the detour-critical edge of the given shortest path in one line.... We use A[i] to denote the ith element

Cowell, The Jātaka, or Stories of the Buddha's Former Births, Book XXII, pp.

Given a shift κ, if we want to compute the eigenvalue λ of A which is closest to κ, then we need to compute the eigenvalue δ of (11) such that |δ| is the smallest value of all of

2.1.1 The pre-primary educator must have specialised knowledge about the characteristics of child development before they can be responsive to the needs of children, set

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

(1) principle of legality - everything must be done according to law (2) separation of powers - disputes as to legality of law (made by legislature) and government acts (by