Docsity

Computer Graphics Lecture Notes: Planar Reflections and Shadows, Study notes of Computer Graphics

Partial preview of the text

Download Computer Graphics Lecture Notes: Planar Reflections and Shadows and more Study notes Computer Graphics in PDF only on Docsity!

Computer Graphics

CS 470

Computer Science and Electrical Engineering Dept.

West Virginia University

2nd October 2006

Outline

(^1) Planar reflections

(^2) Planar shadows

Planar reflections

Reflection matrix

For reflections in some other plane, transform that plane to the y=0 plane,

reflect, and transform back. If the plane is defined by a point, p , and normal n.

Translate the plane to the origin : T (โˆ’ p ).

Rotate so that n is parallel with the y-axis : R (ฮธ, v ).

I (^) ฮธ = cosโˆ’^1 ( n ยท e 2 )

I (^) v = n ร— e^2 || n ร— e 2 ||

Scale about the y-axis by factor -1 : S(1, -1, 1).

Apply inverse rotation: R

โˆ’ 1 (ฮธ, v ) = R (โˆ’ฮธ, v )

Translate back to original position: T

โˆ’ 1 (โˆ’ p ) = T ( p )

The complete transformation for a plane in general position is

q

โ€ฒ = T ( p ) R (โˆ’ฮธ, v ) S ( 1 , โˆ’ 1 , 1 ) R (ฮธ, v ) T (โˆ’ p ) q

Planar shadows

Shadow matrix

We can use a matrix to form the shadow of an object cast on a plane.

( lx , ly ): light position

( vx , vy ): object vertices

( px , py ): shadow vertices

Planar shadows

Shadow matrix

Using the same analysis we can get an equation for pz in terms of vz.

pz =

lyvz โˆ’ lzvy

ly โˆ’ vy

Since we are computing the shadow for the y=0 plane, py = 0.

Consider the equation:

ly โˆ’ lx 0 0

0 0 0 0

0 โˆ’ lz ly 0

0 โˆ’ 1 0 ly

vx

vy

vz

1

lyvx โˆ’ lxvy

0

lyvz โˆ’ lzvy

ly โˆ’ vy

Note : this is not an affine transformation.

Planar shadows

Shadow matrix

After the perspective division process

x

y

z

w

x / w

y / w

z / w

1

We have

Mv =

lyvx โˆ’ lxvy

0

lyvz โˆ’ lzvy

ly โˆ’ vy

lyvx โˆ’ lxvy ly โˆ’ vy

0 lyvz โˆ’ lzvy ly โˆ’ vy

1

So M is the shadow projection matrix

M =

2

6 (^64)

ly โˆ’ lx 0 0 0 0 0 0 0 โˆ’ lz ly 0 0 โˆ’ 1 0 ly

3

7 (^75)