Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Scene Modeling
July 1, 1999
July 1, 1999
Motivational Film
✔Grinning Evil Death– MIT Media Lab (1990)
July 1, 1999
Logistics
✔Paper summaries on Scene Modeling– Any takers?
✔Projects– Presentations
• Presentation week…need 2 additional hours(early or late)
• 15 minutes / presentation• signup -- schedule on Web
July 1, 1999
Photography and Light
pho•tog•ra•phy, n., the process or art ofproducing images of objects by the action oflight on a sensitized surface, esp, a film in acamera.
Yeah, we get it…photography,light…whatever..
July 1, 1999
Computer Graphics as Virtual Photography
camera(captureslight)
syntheticimage
cameramodel
(focusessimulatedlighting)
processing
photoprocessing
tonereproduction
realscene
3Dmodels
Photography:
ComputerGraphics:
Photographicprint
July 1, 1999
Today’s Class
✔Scene Modeling– Placing individual object model, lights, etc.
into a single scene
July 1, 1999
Today’s Class
✔Scene Modeling– Coordinate transformations
– Object hierarchy– Scene Description Languages
• OpenGL• Graph Based• Object-Oriented
July 1, 1999
Coordinate Transformations
✔How to specify placement of individualobjects into a scene
✔Two coordinate systems– Object coordinate system
– World coordinate system
July 1, 1999
Coordinate Transformations
✔Homogeneous Coordinates– (x,y,z) -> (X, Y, Z, W)
– (x,y,z) = (X/W, Y/W, Z/W, 1)
✔Why?– Easily incorporate projections into
transformation model…more when we getto camera models
July 1, 1999
Coordinate Transformation
✔Transformation Matrix
{ {objecttiontransforma
44434241
34333231
24232221
14131211
world
11
⋅
=
o
o
o
w
w
w
z
y
x
mmmm
mmmm
mmmm
mmmm
z
y
x
4444 34444 21
July 1, 1999
Coordinate Transformation
✔Transform operations– Scaling
– Translation– Rotation
July 1, 1999
Coordinate Transformation
✔Scaling– Make object bigger or smaller
=
1000
000
000
000
),,(z
y
x
zyx s
s
s
sssS
July 1, 1999
Coordinate Transformation
✔Translation– Move object to a new location
=
1000
100
010
001
),,(z
y
x
zyx d
d
d
dddT
July 1, 1999
Coordinate Transformation
✔Rotation– rotate object about a given axis
−
=
1000
0100
00cossin
00sincos
)(θθθθ
θzR
July 1, 1999
Coordinate Transformation
✔Rotation
−
=
1000
0cossin0
0sincos0
0001
)(θθθθ
θxR
−=
1000
0cos0sin
0010
0sin0cos
)(θθ
θθ
θyR
July 1, 1999
Coordinate Transformations
✔Individual operations can be composedinto a single matrix.
xy RSTRM ⋅⋅⋅=
July 1, 1999
Coordinate Transformation
✔Beware: Transformation is notcommunitive
TRSRRSTR xyxy ⋅⋅⋅≠⋅⋅⋅
July 1, 1999
Coordinate Transformation
✔So how do you transform objects?– On a point by point basis
– Example• Sphere• NURB• Polygonal Mesh
July 1, 1999
Object Hierarchy
✔Wish to rotate wrt p
BA
p
July 1, 1999
Object Hierarchy
✔TBW = transformation of B wrt world✔TAW = transformation of A wrt world✔TBA= transformation of B wrt A
AWBABW TTT ⋅=
✔To rotate about p, change TBA
July 1, 1999
Object Hierarchy
✔Stack of transformation matrices
Arm wrt world
Body wrt world
Finger wrt world
July 1, 1999
Object Heirarchy
✔Enough about transformations….whatabout languages?
✔Any questions?
July 1, 1999
Scene Modeling Languages
✔From the low level to the high level– OpenGL
– Inventor (Graph Based Scene Languages)– True Object Oriented Model Languages.
July 1, 1999
Scene Modeling Languages
✔Open GL– Originally designed as an API for SGI’s
rendering hardware– Very low level “C” programming library– Includes:
• Scene modeling• Rendering• Animation• Some rudimentary and low level interactivity
July 1, 1999
Scene Modeling Languages
✔OpenGL - scene modeling– Objects
• only knows about polygons (different kinds ofpolygons, but just polygons)
• Polygons are specified by vertex list• You are responsible for definition of normal
vector.
July 1, 1999
Scene Modeling Languages
✔OpenGL– Transformations
• Routines for scaling, translation, and rotation• Routines for direct manipulation of
transformation matrix• Maintains a stack of transformation matricies
for support of object hierarchy
July 1, 1999
Scene Modeling Languages
✔OpenGL– Shading
• Support for flat at smooth shading• Support for ambient, diffuse, and specular
material components• Native support for texture mapping
July 1, 1999
Scene Modeling Languages
✔OpenGL– Lighting
• support for ambient light• support for multiple individual light sources• support for spotlights
July 1, 1999
Scene Modeling Languages
✔OpenGL– Models a state machine. Maintains
current:• Color• Transformation (transformation stack)• Material properties
– New polygonal objects will use currentcolor, transforms and materials.
July 1, 1999
Scene Modeling Languages
✔Open GL– Summary
• Low level “C” interface• Polygonal model• State machine• Transformation Stack
July 1, 1999
Scene Modeling Languages
✔Open GL - Further Reading– Fosner, OpenGL Programming for
Windows95 and WindowsNT– http://www.sgi.com/Technology/openGL
July 1, 1999
Scene Modeling Languages
✔Graph Based Languages (Inventor)– Object oriented wrapper around GL
• Not a truly Object Oriented scenerepresentation.
– Scene is represented by a tree structure(scene graph)
– Scene graph is passed to a viewer which isresponsible for rendering
– Basis for VRML and Java3D
July 1, 1999
Scene Modeling Languages
✔Graph Based Languages (Inventor)– Object oriented wrapper around GL
• Not a truly Object Oriented scenerepresentation.
– Implemented as C++ library withassociated file format.
July 1, 1999
Scene Modeling Languages
✔Inventor– Scene is represented by a tree structure
(scene graph)– Scene graph is passed to a viewer which is
responsible for rendering
– Basis for VRML and Java3D– Max will be talking about VRML in a couple
of weeks.
July 1, 1999
Scene Modeling Languages
✔Inventor -- Graph Nodes– Shape nodes
• represent physical objects• cone, cylinder, sphere, 3Dtext, triangleMesh,
NURB surface
– Lighting Nodes• introduces lights to a scene• directional, point, spot
July 1, 1999
Scene Modeling Languages
✔Inventor– Camera Nodes
• Introduces a camera model• Orthographic/Perspective camera
– Property nodes• Appearance nodes (texture, color, material)• Transformations nodes (scale, rotate, translate)• Other (environment, normal, draw style)
July 1, 1999
Scene Modeling Languages
✔Inventor– Group nodes
• Support for definition of “objects”• Locally groups subgraphs• Switch node (switch between 2 subgraphs)
July 1, 1999
Scene Modeling Language
✔Inventor
July 1, 1999
Scene Modeling Languages
✔Inventor -- Node Kits
July 1, 1999
Scene Modeling Languages
✔Graph Actions– Traversal of scene graph for a particular
purpose.– Examples
• Rendering• Searching• Compute Bounding Box• Interactivity / Picking• Write to file
July 1, 1999
Scene Modeling Languages
✔Inventor - Rendering– Like OpenGL, Inventor assumes a state
machine.– Unlike OpenGL, entire state can be placed
on a stack.
– Visiting a shape node introduces a newobject with “current” properties
– Visiting a property node is equivalent tomaking a given material current.
July 1, 1999
Scene Modeling Languages
✔Inventor - Rendering– Entering a group node pushes current
state on stack– Leaving a group node pops current state
off stack.
July 1, 1999
Scene Modeling Language
✔Inventor -- Interactive aspects:– Event model
• Ability to define and respond to events
– Sensors• Tracks changes in scene and responds• Performs node change at given time intervals
– Manipulators• Interface to input devices (e.g. mouse,
trackball)
July 1, 1999
Scene Modeling Language
✔Inventor - summary– “Object oriented” wrapper to OpenGL
– Scene represented as graph– Actions performed on graphs for specific
purposes (like rendering)
– Supports events and interactivity– Precursor to VRML and Java3D
July 1, 1999
Scene Modeling Languages
✔Inventor - further reading– [Strauss92]
– Strauss/Carey, The Inventor Mentor
July 1, 1999
Scene Modeling Language
✔Inventor - not a truly OO scene model– Separation between object and materials
– Still based on state machine model.– Created for CG user. Still doesn’t fit real
world paradigm• e.g. We usually aren’t concerned
transformation matricies
July 1, 1999
Scene Modeling Language
✔GROOP– truly object oriented scene description
– transformations, material, geometry, andcolor are all associated with an object
– uses a camera/actor/stage paradigm.
July 1, 1999
Scene Modeling Languages
✔GROOP
July 1, 1999
Scene Modeling Language
✔GROOP– Scene object is a collection of objects in a
scene.– Objects are introduced by literally “Adding”
them to a scene.
– Unlike Inventor, order of addition is notimportant.
July 1, 1999
Scene Modeling Languages
✔GROOP– Extensibility achieved by use of C++
inheritance.
July 1, 1999
Scene Modeling Languages
✔GROOP - summary– example of a truly object oriented scene
description mechanism– intuitive– extensible
– Alas, not used….never caught on.
July 1, 1999
Summary
✔Scene Modeling– means of assembling objects into a scene
– Coordinate Transformations– Scene Modeling Languages
• Open GL• Inventor• GROOP
July 1, 1999
Next Class
✔Switch from modeling to rendering✔Rendering Equation
– basic theory behind rendering algorithms
July 1, 1999
Remember
✔Class Web Site:– http://www.cs.rit.edu/~jmg/virtualPhoto
✔Any questions?