CS 184: COMPUTER GRAPHICS

Lecture #6 -- Mo: 2/8, 1999.

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT 

Preparation:

Read: A.1 "Vector Spaces and Affine Spaces",  A.2 "Some Standard Constructions in Vector Spaces",
Ch. 5.1-5.5 "Geometrical Transformations", Ch 7.1 "Geometric Modeling", Ch 7.14-7.16 "... Hierarchical Modeling"

Lecture Topics

Multilevel, Dynamic Scene Hierarchies

Remember example with FlowerPot on WindowSil in HouseFacade, on SceneHill ...
Now we want to make dynamic changes in such assemblies,
thus we need a more dynamic secene: Sailor and flag on ship on rolling waves.

Bottom-up Assembly of Scene: Outside-Multiplication

Demonstrate with overlays: Wave - Ship - Mate - Flag
Start with all 4 superposed cellophanes at origin;
  • 1)  position Flag first: ==> matrix ( )F->M;
  • 2)  position [Mate+Flag]: ==> matrix ( )M->S;
  • 3)  position [Ship+Mate+Flag]==> matrix ( )S->W.

  • The arrow in the subscript can be "read" in two different ways:
  • a)  ( )S->W   is the matrix that describes how the ship is positioned in the world coordinate system.
  • a)  ( )S->W   is the matrix that maps ships coordinates into world coordinates.
  • Discuss scene hierarchy with its interspersed matrices.
    Study concatenation of transforms to place a particular object deep in the hierarchy.
    {for row vectors:}  FlagW = FlagF  ( )F->M  ( )M->S  ( )S->W
    {for column vectors:}  FlagW =  ( )W<-S  ( )S<-M  ( )M<-F  FlagF
    In all cases, all the stuff gets moved from where it was with respect to "command post" = WORLD
    Use OUTSIDE multiplication !

    Need to learn more on semantics of such compositions and on inside/outside operations,
    particularly when we make an incremental (dynamic) change in a hierarchical assembly.
    For instance we may want to have the sailor walk along the deck...

    Inside-Multiplication: `Turtle Walk' or 'Robot View'  -- a useful alternative.

    Demo of Turtle-commands using foils:
    Execute commands in CURRENT LOCAL coord syst. --> this corresponds to INSIDE multiplication
    Commands sent to turtle: "Move forward -- turn right -- move forward -- turn left ... "!
    Assembly of a scene from the root: equivalent to sending commands to sub-entities:
    Let's redo our scene with this new paradigm:
    Start again with all 4 overlays at origin;
  • 1)  tell [Ship+Mate+Flag ] to move! ==> matrix ( )S->W  This changes everybody's coordinate system !
  • 2)  tell [Mate+Flag ] to move! ==> matrix ( )M->S   This is an inside mult. in local coord. system  SHIP=MATE:
  • 3)  tell [Flag ] to move ! ==> matrix ( )F->M  This is an inside mult. in local coord. system MATE=FLAG.

  • Always do INSIDE multiplications !

    Comparison of the two approaches:

    If we have a compound matrix that describes the location of an object:
    <Mate_in_world> = <Mate_original> R(-45) T(2,0) R(90)
    we can interpret this in two different ways:
    (-- and gain some more experience and routine in handling these transformation chains.)
  • 1.) Reading them from inside to outside {Command post view}:  sequence of operations applied to Mate to position him in the World.
  • 2.) Reading them outside to inside {Turtle walk}:  sequence of commands sent to the Mate, telling him how to move in his own framework.
  • In all cases, the sequence of operations is important !
    It does not matter how we represent them, as ascii strings, as matrices, or in our classroom shorthand notation. This applies to all transforms covered so far: 2D, 2D-homogeneous, 3D ...)

    To assemble a hierarchical scene, CP seems more natural;
    but TW is important and convenient too, because in your data structure you may only have the top-down link.
    Thus you need to build all the transformation matrices for all the instances (down to the leaves of the tree) top-down !
    All this will be needed in new assignment: Hierarchical Fish 'n' Ships.
    You will have to write the transformation code !
    All the data structure provides is a field to hang a pointer to your own matrix struct.
    You can use either row or column vectors -- just keep it clear in your mind !

    Make a Change in an Existing Assembly:

    After we have established a particular scene, me may want to make a change ...
    Discuss insertion point of new matrices in existing string of matrices.
    Some examples:
  • Wave the Flag{=Turtle} !  Do it in the Flag coordinate system !  ==> INSIDE mult at ( )F->M  .
  • Now move flag to the other hand of Mate (seen from Mate's point of view) ==> OUTSIDE mult at ( )F->M   --  in Mate-system.
  • Position the Mate(+Flag) along Ship {in Ship coordinates)    ==> ( )F->M( )M->S (T1) ( )S->W  {outside of mate}
  • "Go forward, Mate(+Flag)!" in his own {Mate} framework  ==> ( )F->M (T2)  ( )M->S  ( )S->W  {inside of mate}
  • Building Good Logical Hierarchies

    What is the "right" hierarchy ? -- depends on what you want !
    More Complex Examples: "18-Wheeler""Railroad Bridge"
    These hierarchies are much less flexible than the procedural hierarchies you know from programming.
    Very limited parameter passing: only:
  • Position to direct children,
  • One color down a sub-tree to be assumed by all those instances that have not yet been colored.
  • Breaking the Symmetry in a Hierarchy

    Examples: Flat tire in 18-wheeler;    Broken wheel in railroad wagon.
    Show how the "bad" part has to be isolated from its former "good" master,
    and its parent node now becomes also "bad" and must also be decoupled, and so on.

    Hierarchical Bounding Boxes

    Bounding Boxes are:
    A crude abstraction for a piece of the scene hierarchy -- typically a subtree.
    "place-holders", "Imposters"
    Low-LOD (level-of-detail) representations.
    Pessimistic, conservative size estimates.

    Construction of Bounding Boxes:
    Should be easy to construct and easy to use.
    We typically use axis-aligned bounding boxes: a rectangle with diagonal corners (xmin,ymin), (xmax, ymax).
    There may be inefficiencies: e.g., a diagonal needle.
    And with every (rotated) use in a hierarchy, it may grow...

    Alternatives to Bounding Boxes:
    Optimally oriented bounding boxes (OOBB):  are more efficient but more difficult to determine.
    Bounding circles or spheres: have rotation-independent size, but are not so easy to find either.
    Convex hull: can be constructed efficiently, but may have many vertices, loss of efficiency.

    Use of Bounding Boxes:
    Effective culling, reduction of computation that needs to be done, e.g.,
    Visibility Culling: Is something sure to lie completely outside viewing frustum ?
    Collision detection: Are two objects overlapping ? - (Titanic vs Iceberg).
    Clipping: Cut away features outside display rectangle (more next time).

    HANDOUT: Take-Home Quiz #1


    New Homework Assignment:

    DO the TAKE-HOME QUIZ # 1 (handed out in class).
    This is OPEN book -- but must be done strictly individually.
    DUE: Wednesday 2/10/99 at the beginning of class (9:40am).

    ASG#3:  "Hierarchical Fish 'n' Ships"
    DUE: Saturday 2/20/99, 11:59pm.
    TO BE DONE with a NEW PARTNER !


    --> Next Lecture

    <-- Up to CS 184 HomePage


    Page Editor: Carlo H. Séquin