43
Using AVS/Express in an Introductory Computer Graphics Course

Using AVS/Express in an Introductory Computer Graphics Course

Embed Size (px)

Citation preview

Page 1: Using AVS/Express in an Introductory Computer Graphics Course

Using AVS/Express in an Introductory Computer

Graphics Course

Page 2: Using AVS/Express in an Introductory Computer Graphics Course

2

Course Structure

• Undergraduate course is a modular scheme

• Students study 8 modules per year, each one for 15 weeks, for 3 years

• Second year: Tools for Graphics and Visualisation

• Third year: Methods for Graphics and Visualisation

Page 3: Using AVS/Express in an Introductory Computer Graphics Course

3

Tools for Graphics and Visualisation

• Uses 2D images to implement some of the standard algorithms in computer graphics:-– draw a circle– rotate, scale, and translate a 2D shape– window to viewport transformation– calculate co-ordinates of intersection of 2 lines– zoom in and out, & pan up/down/left/right – Bezier Curve drawing to fit 4 points

Page 4: Using AVS/Express in an Introductory Computer Graphics Course

4

Visualisation component

• Create 3D shape from either: -

– 2D profile

– surface co-ordinates

• Use AVS/Express to visualise the 3D shape• Use AVS/Express to animate the 3D shape

Page 5: Using AVS/Express in an Introductory Computer Graphics Course

5

Draw a Circle

• The co-ordinates of any point on the edge of a circle centred at the origin may be obtained from the following equations: -

• X = Radius*cosine() • Y = Radius*sine()• where is the angle in radians between the X axis

and a point on the circle (in an anti-clockwise direction)

Page 6: Using AVS/Express in an Introductory Computer Graphics Course

6

Draw a Circle

=degrees*/180

X = Radius*cosine()

Y = Radius*sine()

X-axis

Y-axis

Radius

Page 7: Using AVS/Express in an Introductory Computer Graphics Course

7

Create 3D solid from 2D profile

Profile

Y

X

Solid of revolutionof bottle

shape

Y

X

Z

Page 8: Using AVS/Express in an Introductory Computer Graphics Course

8

Create 3d solid from 2D profile

• The students use the circle code to generate the X and Z co-ordinates (the Y co-ordinates remain constant for each point on the profile)

• They also have to generate an extra set of co-ordinates (exactly the same as the first set) to make AVS/Express join the last point up to the first one.

Page 9: Using AVS/Express in an Introductory Computer Graphics Course

9

Surface Plot

• Specify a regular grid for the (x,y,z) co-ordinates

• Student has to generate a height for each co-ordinate based on a random number

Page 10: Using AVS/Express in an Introductory Computer Graphics Course

10

a b

c

3D Surface

• Randomly modify its new height within limits

• Create a new mid-way point

• Make its height the average of the adjacent points

Page 11: Using AVS/Express in an Introductory Computer Graphics Course

11

Include the diagonals

• Also along the diagonals based on the heights of the four corners (a, b, c, and d)

a b

d c

Page 12: Using AVS/Express in an Introductory Computer Graphics Course

12

Page 13: Using AVS/Express in an Introductory Computer Graphics Course

13

Field file for a bottle

# AVS field file

# bottle

ndim = 2

dim1 = 21

dim2 = 15

nspace = 3

veclen = 1

data = integer

field = irregular

Page 14: Using AVS/Express in an Introductory Computer Graphics Course

14

Field file for bottle (continued)

coord 1 file=bottle.dat filetype=ascii skip=0 offset=0 stride=4

coord 2 file=bottle.dat filetype=ascii skip=0 offset=1 stride=4

coord 3 file=bottle.dat filetype=ascii skip=0 offset=2 stride=4

variable 1 file=bottle.dat filetype=ascii skip=0 offset=3 stride=4

Page 15: Using AVS/Express in an Introductory Computer Graphics Course

15

Page 16: Using AVS/Express in an Introductory Computer Graphics Course

16

3D axis with text title

Bottle

Page 17: Using AVS/Express in an Introductory Computer Graphics Course

17

Used crop to reduce

the number of horizontal

steps drawn

Crop

Page 18: Using AVS/Express in an Introductory Computer Graphics Course

18

Used crop to reduce

the number

of vertical points drawn

Crop

Page 19: Using AVS/Express in an Introductory Computer Graphics Course

19

Used downsize to reduce

the number of steps drawn around

the circle

Downsize

Page 20: Using AVS/Express in an Introductory Computer Graphics Course

20

Used downsize to reduce

the number

of profile points drawn

Downsize

Page 21: Using AVS/Express in an Introductory Computer Graphics Course

21

Page 22: Using AVS/Express in an Introductory Computer Graphics Course

22

Field file for 3D solid example

# AVS field file

ndim = 2

dim1 = 9

dim2 = 11

nspace = 3

veclen = 1

data = integer

field = irregular

Page 23: Using AVS/Express in an Introductory Computer Graphics Course

23

Field file (continued)

coord 1 file=xmastree.dat filetype= ascii Skip=0 offset=0 stride=4

coord 2 file=xmastree.dat filetype= ascii Skip=0 offset=1 stride=4

coord 3 file=xmastree.dat filetype= ascii Skip=0 offset=2 stride=4

variable 1 file=xmastree.dat filetype=ascii Skip=0 offset=3 stride=4

Page 24: Using AVS/Express in an Introductory Computer Graphics Course

24

Page 25: Using AVS/Express in an Introductory Computer Graphics Course

25

Neither downsize nor crop used on the first image

Page 26: Using AVS/Express in an Introductory Computer Graphics Course

26

Used downsize to reduce

the number of steps in each circle

Downsize

Page 27: Using AVS/Express in an Introductory Computer Graphics Course

27

Used downsize to reduce

the number

of profile points

Downsize

Page 28: Using AVS/Express in an Introductory Computer Graphics Course

28

Used crop to reduce

the number of horizontal

steps drawn

Crop

Page 29: Using AVS/Express in an Introductory Computer Graphics Course

29

Here is a selection of some

other shapes created

by the students

Page 30: Using AVS/Express in an Introductory Computer Graphics Course

30

“Brolly”

Page 31: Using AVS/Express in an Introductory Computer Graphics Course

31

“Rings”

Page 32: Using AVS/Express in an Introductory Computer Graphics Course

32

“Speaker”

Page 33: Using AVS/Express in an Introductory Computer Graphics Course

33

Cross section of

a “speaker”

Page 34: Using AVS/Express in an Introductory Computer Graphics Course

34

Two stroke

cylinder

Page 35: Using AVS/Express in an Introductory Computer Graphics Course

35

Animation using AVS/Express

• Once an image has been created, the students can animate the image using the keyframe method of animation

• This creates a series of views (keyframes)

• AVS/Express can save images from a view

• Then add frames between the keyframes to produce the animated sequence

Page 36: Using AVS/Express in an Introductory Computer Graphics Course

36

Key-frame animation

• Need two images which depict the start and end frames

• Create an animation sequence by adding frames between the two images

• The two images must have a reasonable level of coherence

Page 37: Using AVS/Express in an Introductory Computer Graphics Course

37

AVS/Express

• AVS/Express interpolates images between a series of captured visualisations

• Student captures the keyframes

• Assigns each keyframe to a time step

• AVS/Express automatically adds the required number of frames between these keyframes to produce an animated sequence

Page 38: Using AVS/Express in an Introductory Computer Graphics Course

38

Keyframes and interpolated frames

keyframes the user defines

interpolated frames added by AVS/Express

Page 39: Using AVS/Express in an Introductory Computer Graphics Course

39

AVS animation features

• Simple to add/delete/move keyframes

• If not a regular time interval between keyframes, then specify the time of next frame before adding it

• Can create a cyclic animation

• Playback control offers forwards, backwards, and “bounce”

Page 40: Using AVS/Express in an Introductory Computer Graphics Course

40

Page 41: Using AVS/Express in an Introductory Computer Graphics Course

41

Keyframe Controls

Page 42: Using AVS/Express in an Introductory Computer Graphics Course

42

Module Panel

Modules pull-down

menu

Playback the

animation

Page 43: Using AVS/Express in an Introductory Computer Graphics Course

43

Finally . . .

Create 2D

profile

Create 3D data

Use AVS/Express

to animate the image

Use AVS/Express to visualise

the data

• This is how we teach visualisation in a level 2 module: -

• What could we do in the level 3 module?