24
11.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 11 VRML - An Introduction

SI31 Advanced Computer Graphics AGR

Embed Size (px)

DESCRIPTION

SI31 Advanced Computer Graphics AGR. Lecture 11 VRML - An Introduction. Good Ideas are Simple. Realization 1: Hypertext + Internet = World Wide Web Realization 2: Adding images makes pages more interesting Realization 3: - PowerPoint PPT Presentation

Citation preview

Page 1: SI31 Advanced Computer Graphics AGR

11.1si31_2001

SI31Advanced Computer

GraphicsAGR

SI31Advanced Computer

GraphicsAGR

Lecture 11VRML - An Introduction

Page 2: SI31 Advanced Computer Graphics AGR

11.2si31_2001

Good Ideas are SimpleGood Ideas are Simple

Realization 1:– Hypertext + Internet = World Wide Web

Realization 2:– Adding images makes pages more interesting

Realization 3:– Images are pictures taken by the publisher -

why not send 3D scenes and allow the user to take the picture!

VRML: Virtual Reality Modelling Language– a language to describe 3D worlds - for the

Web

Page 3: SI31 Advanced Computer Graphics AGR

11.3si31_2001

World Wide Web PagesWorld Wide Web Pages

AUTHORINGPROCESS HTML

file

server

INTERNET

client

WEBBROWSER

text/html

.htmlMIMEtype

Page 4: SI31 Advanced Computer Graphics AGR

11.4si31_2001

VRMLVRML

AUTHORINGPROCESS VRML

file

server

INTERNET

client

VRMLBROWSER

x-world/x-vrml

.wrl

Major browsers:CosmoPlayerWorldViewCortonaBlaxxun

Page 5: SI31 Advanced Computer Graphics AGR

11.5si31_2001

Advantages of VRMLAdvantages of VRML

Transferring a 3D model - rather than a 2D image - to the browser has great advantages– viewer can choose how to look at

the model - or world– viewer can navigate the world– file size can often be much less

Page 6: SI31 Advanced Computer Graphics AGR

11.6si31_2001

How Did It All Begin?How Did It All Begin?

Original brainwave– Mark Pesce and Tony Parisi - early 1994– vision of a VR interface to the Web

VRML 1.0– practical realisation based on Open

Inventor (Silicon Graphics toolkit - similar to OpenGL but higher level)

– Open Inventor file format PLUS hyperlinks

– static, non-interactive worlds– Gavin Bell (SGI) - late 1994

Page 7: SI31 Advanced Computer Graphics AGR

11.7si31_2001

Where are we now?Where are we now?

VRML97– adds object behaviours and

interaction to allow creation of dynamicdynamic worlds

– ISO standard - December 1997– Gavin Bell, Rikk Carey (ex-SGI) and

Chris Marrin (SGI) 2001

– being reworked as XML (X3D)– many new developments

Page 8: SI31 Advanced Computer Graphics AGR

11.8si31_2001

A VRML FileA VRML File

VRML file consists of:

header nodes

– ‘Shape’ is the generic geometric node

– specific objects such as cylinders and spheres

– operations such as transformations

fields– parameters of

nodes

#VRML V2.0 utf8Shape {

geometry Cylinder {

radius3height 6

}}

Page 9: SI31 Advanced Computer Graphics AGR

11.9si31_2001

As Seen By A BrowserAs Seen By A Browser

#VRML V2.0 utf8

Shape {

geometry Cylinder {

radius2

height 4

}

}

Page 10: SI31 Advanced Computer Graphics AGR

11.10si31_2001

Adding Colour to the Scene

Adding Colour to the Scene

#VRML V2.0 utf8

Shape {

geometry Cylinder {

radius 2

height 4

}

appearance Appearance {

material Material {

diffuseColor 1 0 0

specularColor 1 1 1 }

}

}

Page 11: SI31 Advanced Computer Graphics AGR

11.11si31_2001

Co-ordinate SystemsCo-ordinate Systems

Each node is drawn within its own local co-ordinate system..

x

z

y

Page 12: SI31 Advanced Computer Graphics AGR

11.12si31_2001

Modelling TransformationsModelling Transformations

...and can be subjected to a modelling transformation to scale, rotate, translate

Transform is a VRML node - treated just like an object

It applies to a group of children nodes

#VRML V2.0 utf8

Transform{

scale 5.0 0.5 1.0

children [

Shape {

geometry Cylinder {

radius 2

height 4

}

appearance Appearance {

material Material {

diffuseColor 1 0 0

specularColor 1 1 1 }

} } ] }

Page 13: SI31 Advanced Computer Graphics AGR

11.13si31_2001

Hierarchical StructureHierarchical Structure

#VRML V2.0 utf8

Transform{

scale 5.0 0.5 1.0

children [

Shape {

geometry Cylinder {

radius 2

height 4

}

appearance Appearance {

material Material {

diffuseColor 1 0 0

specularColor 1 1 1 }

} } ] }

TRANSFORM

SHAPE

parent

child

Page 14: SI31 Advanced Computer Graphics AGR

11.14si31_2001

Hierarchical StructureHierarchical Structure

This generalises to allow nodes to appear in a hierarchy

This is known as the VRML scene scene graphgraph

TRANSFORM

SHAPE TRANSFORM

SHAPE SHAPE

Page 15: SI31 Advanced Computer Graphics AGR

11.15si31_2001

TransformationsTransformations

Here we see Cylinder, Sphere and Cone nodes

Each has been subjected to a modelling transformation in order to position them

Page 16: SI31 Advanced Computer Graphics AGR

11.16si31_2001

InstancesInstances

A node can be given a ‘name’ and then used multiple times - with different transformations applied to each

DEF kwb Shape {...} gives it a name

USE kwb allows it to be included at other points in the scene graph

Page 17: SI31 Advanced Computer Graphics AGR

11.17si31_2001

AnchorsAnchors

A piece of geometry can act as a link to another URL

Page 18: SI31 Advanced Computer Graphics AGR

11.18si31_2001

TexturesTextures

Texture mapping: Images can be mapped to geometry to provide texturing

VRML looks like:Shape{

geometry Sphere { }

appearance Appearance{

texture ImageTexture{

url “http://..../kwb.gif”}

Page 19: SI31 Advanced Computer Graphics AGR

11.19si31_2001

Polygonal SurfacesPolygonal Surfaces

The general primitive for drawing polygonal surfaces is:– IndexedFaceSet– coord field lists

the points– coordIndex

describes the polygons

Shape{geometry IndexedFaceSet {

coord Coordinate {point [ 17.5 11.2 -

1.2,17.5 15.0 -

1.2,… ]}

coordIndex [ 0 1 2 3 -1,4 1 0 5 -1,…]

}}

Page 20: SI31 Advanced Computer Graphics AGR

11.20si31_2001

LightsLights

VRML includes:– DirectionalLight– PointLight– SpotLight

Note # sign is a comment

Example:

PointLight{

on TRUE

intensity 0.75

color 1 0 0 #red

location 0 0 0

radius 100

}

Page 21: SI31 Advanced Computer Graphics AGR

11.21si31_2001

Viewing Viewing

Specified via the Viewpoint node

VRML file can have a number of Viewpoint nodes - browsers allow a user to jump from one viewpoint to another

Orientation = axis + angle of rotation

Example:

Viewpoint {

position 0 0 5

orientation 0 0 1 0.3

description“frontview”

}

Page 22: SI31 Advanced Computer Graphics AGR

11.22si31_2001

Other Basic FeaturesOther Basic Features

Inline node– incorporate VRML code from

another url– this allows us to composecompose large

worlds from many smaller ones Level of Detail

– different geometric representations depending on distance

Page 23: SI31 Advanced Computer Graphics AGR

11.23si31_2001

Information About VRMLInformation About VRML

Web3D Consortium– http://www.web3d.org– links to specifications and resources– new SDK just released

Web3D Information– http://web3d.about.com/compute/web3d

Tutorials include:– Floppy’s guide:

www.vapourtech.com/vrmlguide Many, many examples:

– eg www.intoronto.com

Page 24: SI31 Advanced Computer Graphics AGR

11.24si31_2001

Range of books now available– The VRML 2.0 Handbook (Addison Wesley)

Jed Hartman and Josie Wernecke

– The Annotated VRML Reference Book (Addison Wesley)

Rikk Carey and Gavin Bell

http://www.best.com/~rikk/Book/

BooksBooks