1 Texture Mapping (2) Tex. Mapping for Volume Rendering (0,1) - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Texture Mapping (2) Tex. Mapping for Volume Rendering (0,1) - - PDF document

Texture-based Volume Rendering Texture Mapping Volume rendering by ray casting is time- Modern graphics hardware includes facility to draw a consuming textured polygon one ray per pixel The texture is an image with each ray


slide-1
SLIDE 1

1

5/12/2003

  • R. Crawfis, Ohio State Univ.

72

Texture-based Volume Rendering

Volume rendering by ray casting is time- consuming

  • ne ray per pixel

each ray involves tracking through volume calculating samples, and then compositing different for each viewpoint

Alternative approach - using texture maps

  • can exploit graphics hardware

5/12/2003

  • R. Crawfis, Ohio State Univ.

73

Texture Mapping

Modern graphics hardware includes facility to draw a textured polygon The texture is an image with red, green, blue and alpha components… … so several overlapping polygons can be composited

5/12/2003

  • R. Crawfis, Ohio State Univ.

74

Texture-based Volume Rendering

Draw from back-to-front a set of rectangles

first rectangle drawn as an area of coloured pixels, with associated opacity, as determined by transfer function and interpolation - and merged with background in a compositing

  • peration (supported by hardware)

successive rectangles drawn on top

5/12/2003

  • R. Crawfis, Ohio State Univ.

75

Texture-based Volume Rendering

For a given viewing direction, we would need to select slices perpendicular to this direction This requires interpolation to get the values on the slices Only expensive 3D texture hardware can do this fast enough…

image plane volume

3D texture mapping

5/12/2003

  • R. Crawfis, Ohio State Univ.

76

Texture-based Volume Rendering

Simpler solution - 2D texture mapping:

view volume as set of slices parallel to co-

  • rdinate planes

choose the orientation best suited to viewing direction

5/12/2003

  • R. Crawfis, Ohio State Univ.

77

Texture Mapping

2D image 2D polygon + Textured-mapped polygon

slide-2
SLIDE 2

2

5/12/2003

  • R. Crawfis, Ohio State Univ.

78

Texture Mapping (2)

(0,0) (1,0) (0,1) (1,1)

Each texel has 2D coordinates assigned to it.

assign the texture coordinates to each polygon to establish the mapping

(0,0.5) (0.5,0.5) (0,0) (0.5,0)

5/12/2003

  • R. Crawfis, Ohio State Univ.

79

  • Tex. Mapping for Volume Rendering

Remember ray casting …

y z

5/12/2003

  • R. Crawfis, Ohio State Univ.

80

Texture based volume rendering

x z y

  • Render each xz slice in the volume as a texture-mapped polygon
  • The texture contains RGBA (color and opacity)
  • The polygons are drawn from back to front

5/12/2003

  • R. Crawfis, Ohio State Univ.

81

Texture based volume rendering

5/12/2003

  • R. Crawfis, Ohio State Univ.

82

Changing Viewing Direction

What if we change the viewing position? That is okay, we just change the eye position (or rotate the polygons and re-render), Until … x y

5/12/2003

  • R. Crawfis, Ohio State Univ.

83

Changing View Direction (2)

Until …

You are not going to see anything this way …

This is because the view direction now is Parallel to the slice planes What do we do? x y

slide-3
SLIDE 3

3

5/12/2003

  • R. Crawfis, Ohio State Univ.

84

Switch Slicing Planes

What do we do?

  • Change the orientation of slicing planes
  • Now the slice polygons are parallel to

YZ plane in the object space x y

5/12/2003

  • R. Crawfis, Ohio State Univ.

85

Some Considerations… (5)

When do we need to change the slicing orientation?

When the major component of view vector changes from y to -x x y

5/12/2003

  • R. Crawfis, Ohio State Univ.

86

Major component of view vector? Given the view vector (x,y,z) -> get the maximal component If x: then the slicing planes are parallel to yz plane If y: then the slicing planes are parallel to xz plane If z: then the slicing planes are parallel to xy plane

  • > This is called (object-space) axis-aligned method.

Some Considerations… (6)

5/12/2003

  • R. Crawfis, Ohio State Univ.

87

Three copies of data needed

x z y xz slices yz slices xy slices

  • We need to reorganize the input textures for diff. View directions.
  • Reorganize the textures on the fly is too time consuming. We want

to prepare the texture sets beforehand

5/12/2003

  • R. Crawfis, Ohio State Univ.

88

Texture based volume rendering

Algorithm: (using 2D texture mapping hardware) Turn off the depth test; Enable blending For (each slice from back to front) {

  • Load the 2D slice of data into texture memory
  • Create a polygon corresponding to the slice
  • Assign texture coordinates to four corners of

the polygon

  • Render and blend the polygon (use OpenGL

alpha blending) to the frame buffer }

5/12/2003

  • R. Crawfis, Ohio State Univ.

89

Problem (1)

Non-even sampling rate

d d’ d’’

d’’ > d’ > d

Sampling artifact will become visible

slide-4
SLIDE 4

4

5/12/2003

  • R. Crawfis, Ohio State Univ.

90

Problem (2)

Object-space axis-aligned method can create artifacts: Popping Effect

There is a sudden change of slicing direction when the view vector transitions from one major direction to another. The change in the image intensity can be quite visible x y

5/12/2003

  • R. Crawfis, Ohio State Univ.

91

Solution (1)

Insert intermediate slides to maintain the sampling rate

d d’ d’’

5/12/2003

  • R. Crawfis, Ohio State Univ.

92

Solution (2)

Use Image-space axis-aligned slicing plane:

the slicing planes are always parallel to the view plane

5/12/2003

  • R. Crawfis, Ohio State Univ.

93

3D Texture Based Volume Rendering

5/12/2003

  • R. Crawfis, Ohio State Univ.

94

3D Texture Mapping

Arbitrary slicing through the volume and texture mapping capabilities are needed

  • Arbitrary slicing polygon: this can be computed

using software in real time

This is basically polygon-volume clipping

5/12/2003

  • R. Crawfis, Ohio State Univ.

95

Slice-Interpolated Volume Rendering

color

  • pacity
  • bject (color, opacity)

Similar to raycasting with simultaneous rays

1.0

slide-5
SLIDE 5

5

5/12/2003

  • R. Crawfis, Ohio State Univ.

96

3D Texture Mapping

Texture mapping to the arbitrary slices

This requires 3D texture mapping harware Input texture: volume (pre-classified and shaded) essentially an (R,G,B,α) volume Depending on the position of the polygon, appropriate textures are resampled, constructed and mapped to the polygon.

5/12/2003

  • R. Crawfis, Ohio State Univ.

97

Solid (3D) Texture Mapping

Now the input texture space is 3D Texture coordinates: (r,s,t)

(0,0,0) (1,0,0) (0,1,0) (1,1,0) (0,1,1) (1,1,1) (r0,s0,t0) (r1,s1,t1) (r2,s2,t2) (r3,s3,t3)

5/12/2003

  • R. Crawfis, Ohio State Univ.

98

Slice Based Rendering

Volume Data Eye

Image plane

Graphics Hardware

  • Polygons – Proxy geometry
  • Textures – Data & interpolation
  • Blending operations – Numerical integration

Slices

5/12/2003

  • R. Crawfis, Ohio State Univ.

99

Slice Based Rendering

View direction

1 slice 5 slices 20 slices 45 slices 85 slices 170 slices

Slices

5/12/2003

  • R. Crawfis, Ohio State Univ.

100

Slice Based Problems?

Does not perform correct

Illumination Accumulation - but can get close

Can not easily add correct illumination and shadowing

See the Van Gelder paper for their addition for illumination

⌧Stored in LUT quantized normal vector directions

See Kniss papers (Utah) for use of vertex shaders and new hardware to solve many of these problems.

5/12/2003

  • R. Crawfis, Ohio State Univ.

101

Lighting and Shading

3D texture mapping with hardware tricks to achieve lighting is becoming feasible.

  • C. Lao, OSU
slide-6
SLIDE 6

6

5/12/2003

  • R. Crawfis, Ohio State Univ.

102

Pros and Cons

Advantages: - Fast with volume sizes that the hardware can take

e.g. 2 fps for 256 cube volumes

  • No popping effect

Disadvantages: - Need to compute the slicing planes for every view angle

  • only supported on high end hardware
  • low quality without per-pixel classification shading

and classification (i.e. post-classification and shading) Both 2D or 3D hardware texture mapping methods can not compute shading on the fly. The input textures have to be pre-shaded. With multi-texturing functions, per-pixel shading and classification are becoming possible.