Top Banner
CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel
13

CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Dec 19, 2015

Download

Documents

Dana Reed
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

CS4395: Computer Graphics 1

Bump Mapping

Mohan SridharanBased on slides created by Edward Angel

Page 2: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Introduction

• Mapping methods:– Texture mapping.

– Environmental (reflection) mapping:• Variant of texture mapping.

– Bump mapping:• Solves flatness problem of texture mapping.

CS4395: Computer Graphics 2

Page 3: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Examples

CS4395: Computer Graphics 3

Page 4: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Modeling an Orange• Consider modeling an orange.• Texture map a photo of an orange onto a surface:– Captures dimples.– Will not be correct if we move viewer or light.– We have shades of dimples rather than their correct

orientation.

• We need to perturb normal across surface of object and compute a new color at each interior point.

CS4395: Computer Graphics 4

Page 5: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Bump Mapping (Blinn)

• Consider a smooth surface:

CS4395: Computer Graphics 5

n

p

Page 6: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Rougher Version

CS4395: Computer Graphics 6

n’

p

p’

Page 7: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Equations

CS4395: Computer Graphics 7

pu=[ ∂x/ ∂u, ∂y/ ∂u, ∂z/ ∂u]T

p(u,v) = [x(u,v), y(u,v), z(u,v)]T

pv=[ ∂x/ ∂v, ∂y/ ∂v, ∂z/ ∂v]T

n = (pu pv ) / | pu pv |

Page 8: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Tangent Plane

CS4395: Computer Graphics 8

pu

pv

n

Page 9: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Displacement Function

CS4395: Computer Graphics 9

p’ = p + d(u,v) n

d(u,v) is the bump or displacement function.

|d(u,v)| << 1

Page 10: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Perturbed Normal

CS4395: Computer Graphics 10

n’ = p’u p’v

p’u = pu + (∂d/∂u)n + d(u,v)nu

p’v = pv + (∂d/∂v)n + d(u,v)nv

If d is small, we can neglect last term.

Page 11: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Approximating the Normal

CS4395: Computer Graphics 11

n’ = p’u p’v

≈ n + (∂d/∂u)n pv + (∂d/∂v)n pu

The vectors n pv and n pu lie in the tangent plane. Hence the normal is displaced in the tangent plane .Must pre-compute the arrays ∂d/ ∂u and ∂d/ ∂v Finally, we perturb the normal during shading.

Page 12: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

Image Processing

• Suppose that we start with a function d(u,v).• We can sample it to form an array D=[dij].

• Then ∂d/ ∂u ≈ dij – di-1,j

and ∂d/ ∂v ≈ dij – di,j-1

• Embossing: multi-pass approach using accumulation buffer.

CS4395: Computer Graphics 12

Page 13: CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.

How to do this?

• The problem is that we want to apply the perturbation at all points on the surface.

• Cannot solve by vertex lighting (unless polygons are very small).

• Really want to apply to every fragment. Can not do that in fixed function pipeline.

• But can do with a fragment program – later

CS4395: Computer Graphics 13