2.1 si31-2001 SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Basic Modelling
description
Transcript of Basic Modelling
![Page 1: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/1.jpg)
1
Basic Modelling
![Page 2: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/2.jpg)
2
Lecture ObjectivesLecture Objectives
To understand how 3D scenes can be modelled - in terms of geometry, appearance and behaviour - and rendered on a display
To understand how to deliver interactive animated 3D graphics over the Internet
To be able to create interactive 3D graphics applications using industry standard software (OpenGL and VRML)
![Page 3: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/3.jpg)
3
The BasicsThe Basics
MODELLING– representing objects in 3D– transforming objects and composing scenes
VIEWING– projecting 3D scenes onto a 2D display
surface RENDERING
– illumination– shading– adding realism via textures, shadows
![Page 4: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/4.jpg)
4
Basic ModellingBasic Modelling
x
y
z
objects representedas set of faces - iepolygons- and facesas a set of points
scenes composedby scaling, rotating,translating objects tocreate a 3D world
![Page 5: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/5.jpg)
5
ViewingViewing
Clipping– selects a volume of interest– Projection– 3D scene is projected onto a 2D
plane
camera
![Page 6: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/6.jpg)
6
RenderingRendering
shading:how do we use ourknowledge of illuminationto shade surfaces in ourworld?
illumination:how is light reflectedfrom surfaces?
![Page 7: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/7.jpg)
7
RenderingRendering
texture
shadows
![Page 8: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/8.jpg)
8
InternetInternet
VRML– ISO standard for 3D graphics over
the Web– allows modelling of geometry,
appearance and behaviour
![Page 9: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/9.jpg)
9
Advanced RenderingAdvanced Rendering
ADVANCED RENDERING– direct versus global illumination
methods– ray tracing and radiosity
OTHER ADVANCED FEATURES– curve and surface modelling– image based rendering– non-photorealistic rendering
![Page 10: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/10.jpg)
10
Advanced RenderingAdvanced Rendering
Advanced Rendering - global illumination– ray tracing
– radiositybased on physics of radioactive heat
transfer between surfaces
light
eye
screen
objects
![Page 11: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/11.jpg)
11
Before we begin...mathematics!Before we begin...mathematics!
3D Co-ordinate Systems
LEFT RIGHT
x
yz
x
y
z
z points away z points toward
Align thumb with x, first finger with y, then second fingerof appropriate hand gives z direction. Common now touse a RIGHT HANDED system.
![Page 12: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/12.jpg)
12
Points and VectorsPoints and Vectors
We shall write points as column vectors
xyz
P =
Difference of two points gives a direction vector:D = P2 - P1
x
y
z
P2
P1
x
y
z
P
Note: If P1 and P2are on a plane, thenD lies in the plane
![Page 13: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/13.jpg)
13
Polygonal RepresentationPolygonal Representation
Any 3D object can be represented as a set of plane, polygonal surfaces
V1
V2V3
V4
V5V8
V7 V6
Note: each vertex part of severalpolygons
![Page 14: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/14.jpg)
14
Polygonal RepresentationPolygonal Representation
Objects with curved surfaces can be approximated by polygons - improved approximation by more polygons
![Page 15: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/15.jpg)
15
Scene OrganisationScene Organisation
Scene = list of objects Object = list of surfaces Surface = list of polygons Polygon = list of vertices
scene
objectsurfaces polygons
vertices
![Page 16: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/16.jpg)
16
Polygon Data StructurePolygon Data Structure
V1
V2V3
V4
V5V8
V7 V6
P1
P2
Object Table
Obj1P1, P2, P3,P4, P5, P6
Object Obj1
Vertex Table
V1X1, Y1, Z1
V2X2, Y2, Z2
. ...
Polygon Table
P1 V1, V2, V3, V4
P2 V1, V5, V6, V2
. ...
![Page 17: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/17.jpg)
17
Typical PrimitivesTypical Primitives
Graphics systems such as OpenGL typically support:– triangles, triangle strips and fans– quads, quad strips– polygons
Which way is front?– convention is that normal points
towards you if vertices are specified counter-clockwise
![Page 18: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/18.jpg)
18
Modelling Regular ObjectsModelling Regular Objects
Sweeping
Spinning
2D Profilesweep axis
spinning axis
R1 R2
![Page 19: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/19.jpg)
19
Sweeping a Circle to Generate a Cylinder as Polygons
Sweeping a Circle to Generate a Cylinder as Polygons
vertices at z=0
vertices at z=depthV1
V2
V3V4
V5
V6 V8
V7
V10
V9
V11
V12V13
V14
V15V16
V17
V18
V1[x] = R; V1[y] = 0; V1[z] = 0V2[x] = R cos ; V2[y] = R sin ; V2[z] = 0 (=/4)Vk[x] = R cos k; Vk[y] = R sin k; Vk[z] = 0wherek = 2 (k - 1 )/8, k=1,2,..8
![Page 20: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/20.jpg)
20
Complex PrimitivesComplex Primitives
Some systems such as VRML have cylinders, cones, etc as primitives– polygonal representation calculated
automatically OpenGL has a utility library (GLU)
which contains various high-level primitives– again converted to polygons
For conventional graphics hardware:– POLYGONS RULE!
![Page 21: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/21.jpg)
21
Automatic Generation of Polygonal Objects
Automatic Generation of Polygonal Objects
3D scanners - or laser rangers - are able to generate computer representations of objects– object sits on rotating table– contour outline generated for a
given height– scanner moves up a level and next
contour created– successive contours stitched
together to give polygonal representation
![Page 22: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/22.jpg)
22
A PuzzleA Puzzle
![Page 23: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/23.jpg)
23
Modelling Objects and Creating Worlds
Modelling Objects and Creating Worlds
We have seen how boundary boundary representations representations of simple objects can be created
Typically each object is created in its own co-ordinate systemco-ordinate system
To create a world, we need to understand how to transform objects so as to place them in the right place - translationtranslation, at the right size - scalingscaling, in the right orientation- rotationrotation
![Page 24: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/24.jpg)
24
TransformationsTransformations
The basic linear transformations are:– translation: P = P + T, where T is
translation vector– scaling: P’ = S P, where S is a scaling
matrix– rotation: P’ = R P, where R is a rotation
matrix As in 2D graphics, we use
homogeneoushomogeneous co-ordinates in order to express all transformations as matrices and allow them to be combined easily
![Page 25: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/25.jpg)
25
Homogeneous Co-ordinatesHomogeneous Co-ordinates
In homogeneous coordinates, a 3D point P = (x,y,z)T
is represented as:P = (x,y,z,1)T
That is, a point in 4D space, with its ‘extra’ co-ordinate equal to 1
NoteNote: in homogeneous co-ordinates, multiplication by a constant leaves point unchanged– ie (x, y, z, 1)T = (wx, wy, wz, w)T
![Page 26: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/26.jpg)
26
TranslationTranslation
Suppose we want to translate P (x,y,z)T by a distance (Tx, Ty, Tz)T
We express P as (x, y, z, 1)T and form a translation matrix T as below
The translated point is P’
T P
x’y’z’1
P’ =
1 0 0 Tx0 1 0 Ty0 0 1 Tz0 0 0 1
xyz1
= x + Txy + Tyz + Tz1
=
![Page 27: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/27.jpg)
27
ScalingScaling
Scaling by Sx, Sy, Sz relative to relative to the originthe origin:
x’y’z’1
Sx 0 0 00 Sy 0 00 0 Sz 00 0 0 1
xyz1
P’ = S P
= = Sx . xSy . ySz . z1
![Page 28: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/28.jpg)
28
RotationRotation
Rotation is specified with with respect to an axis respect to an axis - easiest to start with co-ordinate axes
To rotate about the x-axis:
a positive angle corresponds to counter-clockwise direction lookingat origin from positive position on axis
x’y’z’1
= 1 0 0 00 cos -sin 00 sin cos 00 0 0 1
xyz1
P’ = Rz () P
![Page 29: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/29.jpg)
29
Composite TransformationsComposite Transformations
The attraction of homogeneous co-ordinates is that a sequence of transformations may be encapsulated as a single matrix
For example, scaling with respect to a with respect to a fixed position (a,b,c) fixed position (a,b,c) can be achieved by:– translate fixed point to origin- say, T(-a,-b,-c)– scale- S– translate fixed point back to its starting
position- T(a,b,c) Thus: P’ = T(a,b,c) S T(-a,-b,-c) P = M P
![Page 30: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/30.jpg)
30
Rotation about a Specified AxisRotation about a Specified Axis
It is useful to be able to rotate about any axis in 3D space
This is achieved by composing 7 elementary transformations
![Page 31: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/31.jpg)
31
Rotation through about Specified Axis
Rotation through about Specified Axis
x
y
z
x
y
zrotate throughrequ’d angle,
x
y
z
x
y
z
P2
P1x
y
z
P2
P1x
y
z
initial positiontranslate P1to origin
rotate so that P2 lies on z-axis(2 rotations)
rotate axisto orig orientation
translate back
![Page 32: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/32.jpg)
32
Inverse TransformationsInverse Transformations
As in this example, it is often useful to calculate the inverse of a transformation– ie the transformation that returns to
original state Translation: T-1 (a, b, c) = T (-a, -
b, -c) Scaling: S-1 ( Sx, Sy, Sz ) =
S ............ Rotation: R-1
z () = Rz (-)
![Page 33: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/33.jpg)
33
Viewing - Projections
SEN 992 Computer Graphics ISEN 992 Computer Graphics I
![Page 34: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/34.jpg)
34
ViewingViewing
Graphics display devices are 2D rectangular screens
Hence we need to understand how to transform our 3D world to a 2D surface
This involves:– selecting the observer position observer position (or
camera position)– selecting the view plane view plane (or camera film
plane)– selecting the type of projectionprojection
![Page 35: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/35.jpg)
35
Perspective ProjectionsPerspective Projections
There are two types of projection: perspectiveperspective and parallelparallel
In a perspectiveperspective projection, object positions are projected onto the view plane along lines which converge at the observerP1
P2
P1’
P2’
view plane
camera
![Page 36: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/36.jpg)
36
Parallel ProjectionParallel Projection
In a parallel projection, the observer position is at an infinite distance, so the projection lines are parallelP1
P2
view plane
![Page 37: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/37.jpg)
37
Perspective and Parallel Projection
Perspective and Parallel Projection
Parallel projection preserves the relative proportions of objects, but does not give a realistic view
Perspective projection gives realistic views, but does not preserve proportions– Projections of distant objects are
smaller than projections of objects of the same size which are closer to the view plane
![Page 38: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/38.jpg)
38
Perspective and Parallel Projection
Perspective and Parallel Projection
perspective parallel
![Page 39: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/39.jpg)
39
Viewing Coordinate SystemViewing Coordinate System
Viewing is easier if we work in a viewing co-ordinate systemviewing co-ordinate system, where the observer or camera position is on the z-axis, looking along the negative z-direction
xV
yV
zV
Camera is positioned at:(0 , 0, zC)
![Page 40: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/40.jpg)
40
View PlaneView Plane
We assume the view plane is perpendicular to the viewing direction
The view planeis positioned at:(0, 0, zVP)
Let d = zC - zVP be thedistance between thecamera and the plane
xv
yv
zv
![Page 41: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/41.jpg)
41
Perspective Projection CalculationPerspective Projection Calculation
xv
yv
zv
zVview plane
Q
camerayV
zCzQ zVP
looking along x-axis
![Page 42: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/42.jpg)
42
Perspective Projection CalculationPerspective Projection Calculation
zVview plane
Q
camerayV
P
By similar triangles, yP / yQ = (zC - zVP) / (zC - zQ)and soyP = yQ * (zC - zVP) / (zC - zQ)oryP = yQ * d / (zC - zQ)
zCzQ zVP
xP likewise
![Page 43: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/43.jpg)
43
Transformation Matrix for Perspective
Transformation Matrix for Perspective
1 0 0 0
0 1 0 0
0 0 -zVP/d zVPzC/d
0 0 -1/d zC/d
xQ
yQ
zQ
1
xH
yH
zH
wH
=
Then xP = xH / wH
iexP = xH / ( (zC - zQ) / d )iexP = xQ / ( (zC - zQ) / d )
yP likewise
![Page 44: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/44.jpg)
44
Note for LaterNote for Later
The original z co-ordinate of points is retained – we need relative depth in the scene
in order to sort out which faces are visible to the camera
![Page 45: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/45.jpg)
45
Vanishing PointsVanishing Points
When a 3D object is projected onto a view plane using perspective, parallel lines in object NOT parallel to the view plane converge to a vanishing vanishing pointpoint
view plane
vanishing point
one-pointperspectiveprojectionof cube
![Page 46: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/46.jpg)
46
One- and Two-Point Perspective Drawing
One- and Two-Point Perspective Drawing
![Page 47: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/47.jpg)
47
One-point PerspectiveOne-point Perspective
Said to be the firstpainting in perspective
This is:Trinity with the Virgin,St John and Donors,by Mastaccio in 1427
![Page 48: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/48.jpg)
48
Two-point PerspectiveTwo-point Perspective
EdwardHopperLighthouseat Two Lights
-seewww.postershop.com
![Page 49: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/49.jpg)
49
Parallel Projection - Two typesParallel Projection - Two types
OrthographicOrthographic parallel projection has view plane perpendicular to direction of projection
ObliqueOblique parallel projection has view plane at an oblique angle to direction of projection
P1
P2
view plane
P1
P2
view plane
We shall only consider orthographic projectionorthographic projection
![Page 50: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/50.jpg)
50
Parallel Projection Calculation
Parallel Projection Calculation
xv
yv
zv
zVview plane
Q
yV
zQ zVP
looking along x-axis
![Page 51: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/51.jpg)
51
Parallel Projection CalculationParallel Projection Calculation
zVview plane
Q
yV
P
yP = yQ
and similarly xP = xQ
![Page 52: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/52.jpg)
52
Parallel Projection CalculationParallel Projection Calculation
So this is much easier than perspective!– xP = xQ
– yP = yQ
– zP = zVP
The transformation matrix is simply1 0 0 0
0 1 0 00 0 zVP/zQ 00 0 0 1
![Page 53: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/53.jpg)
53
View Volumes - View WindowView Volumes - View Window
Type of lens in a camera is one factor which determines how much of the view is captured– wide angle lens captures more than
regular lens Analogy in computer graphics is the
view windowview window, a rectangle in the view plane
xv
yv
zv
view window
![Page 54: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/54.jpg)
54
View Volume - Front and Back Planes
View Volume - Front and Back Planes
We will also typically want to limit the view in the zV direction
We define two planes, each parallel to the view plane, to achieve this– front plane (or near plane)– back plane (or far plane)
front planeback plane
zV
![Page 55: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/55.jpg)
55
View Frustum - Perspective Projection
View Frustum - Perspective Projection
view window
backplane
frontplane
camera
view frustum
zV
![Page 56: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/56.jpg)
56
View Volume - Parallel ProjectionView Volume - Parallel Projection
view window
backplane
frontplane
zV
view volume
![Page 57: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/57.jpg)
57
View VolumeView Volume
The front and back planes act as important clipping planesclipping planes
Can be used to select part of a scene we want to view
Front plane Front plane important in perspective to remove near objects which will swamp picture
![Page 58: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/58.jpg)
58
VRML - An Introduction
SEN 992 Computer Graphics ISEN 992 Computer Graphics I
![Page 59: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/59.jpg)
59
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 60: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/60.jpg)
60
World Wide Web PagesWorld Wide Web Pages
AUTHORINGPROCESS HTML
file
server
INTERNET
client
WEBBROWSER
text/html
.htmlMIMEtype
![Page 61: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/61.jpg)
61
VRMLVRML
AUTHORINGPROCESS VRML
file
server
INTERNET
client
VRMLBROWSER
x-world/x-vrml
.wrl
Major browser:CosmoPlayer
![Page 62: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/62.jpg)
62
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 63: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/63.jpg)
63
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 64: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/64.jpg)
64
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) 2000
– being reworked as XML (X3D)– many new developments
![Page 65: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/65.jpg)
65
A VRML FileA VRML File
VRML file consists of:
header nodes
– objects such as cylinders and spheres
– operations such as transformations
fields– parameters of
nodes
#VRML V2.0 utf8Shape {
geometry Cylinder {
radius3height 6
}}
![Page 66: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/66.jpg)
66
As Seen By A BrowserAs Seen By A Browser
#VRML V2.0 utf8
Shape {
geometry Cylinder {
radius2
height 4
}
}
![Page 67: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/67.jpg)
67
Adding Color to the SceneAdding Color 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 68: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/68.jpg)
68
Co-ordinate SystemsCo-ordinate Systems
Each node is drawn within its own local co-ordinate system..
x
z
y
![Page 69: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/69.jpg)
69
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 70: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/70.jpg)
70
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 71: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/71.jpg)
71
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 72: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/72.jpg)
72
TransformationsTransformations
Here we see Cylinder, Sphere and Cone nodes
Each has been subjected to a modelling transformation in order to position them
![Page 73: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/73.jpg)
73
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 74: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/74.jpg)
74
AnchorsAnchors
A piece of geometry can act as a link to another URL
![Page 75: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/75.jpg)
75
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 76: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/76.jpg)
76
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 77: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/77.jpg)
77
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 78: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/78.jpg)
78
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 79: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/79.jpg)
79
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 80: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/80.jpg)
80
Information About VRMLInformation About VRML
Web3D Consortium– http://www.web3d.org– links to specifications and resources
Web3D Information– http://web3d.about.com/compute/web3d
Leeds University VRML/Java3D Information Centre – http://www.scs.leeds.ac.uk/vrmljava3d
VRML Repository– http://www.sdsc.edu/vrml/
![Page 81: Basic Modelling](https://reader031.fdocuments.us/reader031/viewer/2022013101/568143f9550346895db08bc2/html5/thumbnails/81.jpg)
81
Range of books now available– The VRML 2.0 Handbook (Addison Wesley)
Jed Hartman and Josie Wernecke
http://vrml.sgi.com/handbook– The Annotated VRML Reference Book (Addison
Wesley)
Rikk Carey and Gavin Bell
http://www.best.com/~rikk/Book/ Tutorials include:
– Floppy’s guide: www.vapourtech.com/vrmlguide
Books and TutorialsBooks and Tutorials