Next week!

Choose the day you like!

11/10 Tuesday is still my fav!

There will be a small assignment/report!

Due 11/13!

Thursday 11/5

Tuesday 11/10

Thursday 11/12

at the conference

in the classroom

in the classroom

webgpu part 2

Transformations

Translate

Rotate

Scale

cos(T)   -sin(T)   0   0

sin(T)   cos(T)   0    0

    0          0        1    0

    0          0       0     1

rotation around Z

cos(T/2)

sin(T/2) * 0

sin(T/2) * 0

sin(T/2) * 1

Matrix

Quaternion

w

x

y

z

with angle T

cos(T)   -sin(T)   0   0

sin(T)   cos(T)   0    0

    0          0        1    0

    0          0       0     1

2, 2, 2

with T = Pi/2

0

0

1

2 Pi

Pi

Pi/2

1.5 Pi

-1

-2, 2, 2

cos(T/2)

sin(T/2) * 0

sin(T/2) * 0

sin(T/2) * 1

Quaternion

w

x

y

z

~0.7

~0.7

0

0

Pi/2 / 2

~0.7

0

0

~0.7

0

2

2

2

w

x

y

z

*

Quaternion

~0.7

0

0

~0.7

0

2

2

2

*

~0.7

- 0

- 0

- ~0.7

Inverse

page 64, Gortler: 3D Computer Graphics

  0

- 2

  2

  2

implement this in python and show that 0,-2,2,2 is the output!

Rigid Body Transformation

Quaternion

Translation Vector

w

x

y

z

x

y

z

0

Scaling

x, y, z

if required:

Euler Angles

Gimbal Lock

Quaternions fixes this!

Arcball

Trackball

Controls

Natural Feeling

Spins twice as fast

Completely path independent

Both:

Map 2D to 3D Sphere

esay to implement with Quaternions

Picking

or unprojecting from 2D to 3D

Framebuffer (hidden)

1

2

3

4

( 1, 0, 0, 1 )

( 0, 1, 0, 1 )

( 1, 1, 0, 1 )

( 0, 0, 1, 1 )

( 0, 0, 0, 1 )

gl.readPixels

(r, g, b, a)

map to object ID

( 0, 1, 0, 1 )

2

Object Picking

Object Picking

Raycasting

More complex

Quick'n'Dirty

Very precise (Face picking)

Object precision

Occlusion not a problem

Objects can be hidden

raycaster = THREE.Raycaster();
raycaster.setFromCamera(vp_coords_near, camera);
intersects = raycaster.intersectObject( scene.children );
$ subl .
$ cd 05/inkman
$ git pull

Sync your fork!

$ python -m http.server

How are the colors chosen?

What are these .jpg images?

How are the colors chosen?

What are these .jpg images?

material.color.setHex( Math.random() * 0xffffff );

texture

specular

normals

r    g    b    a

alpha

0: fully transparent

     ....

255: fully opaque

0: minimum

     ....

255: maximum

red

green

blue

All image formats (PNG, JPEG, BMP...)

4 channels

r    g    b    

0: minimum

     ....

255: maximum

red

green

blue

All image formats (PNG, JPEG, BMP...)

3 channels

g

0: minimum

     ....

255: maximum

grayscale

All image formats (PNG, JPEG, BMP...)

1 channel

lil-gui

Let's do it!!!

connect XTK or Three.js with Tweakpane!

<script type="module">
  
// ...

  
import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js';
  
let effect; 
 
// ...
 
effect = new AnaglyphEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );
effect.planeDistance = 5.0; 

// ...

function animate() {

  // ...

  effect.render( scene, camera ); // replace renderer. with effect.

  // ...

}

</script>

submit your music

Lecture 16

By Daniel Haehn

Lecture 16

Slides for CS460 Computer Graphics at UMass Boston. See https://cs460.orghttps://cs460.org

  • 1,346