views:

183

answers:

3

I want to say “unrestricted frame of reference” or “spatially-related independent sub-environments”, but I don't think those are right.

Imagine two long, cylindrical spaceships floating next to each other on a level plane with the same orientation. Each ship has its own set of rooms and corridors in which players move freely in a first-person environment. Looking through the windows, the crew of each ship can smile and wave to the crew of the other ship.

The first ship fires its thrusters and moves under the second ship. The two ships dock and the airlock opens. The crew of the first ship now needs to climb up into the second ship. The airlock closes and the ships detach.

The first ship moves again, only this time it docks on top of the second ship. The airlock opens and this time the crew of the first ship needs to move down into the second ship.

Each ship is a self-contained 3d environment which is interacting with other self-contained environments inside a larger global environment.

I see two possible implementations.

1) The “mover”. Each ship exerts a force on every object inside of it. As the first ship is moving relative to the second ship, that movement is translated to the crew to change their global spacial position. This seems computationally expensive...

2) The “faker”. Each ship's windows display simulated output from a virtual global space, but the ships and their contents don't really move relative to each other. The connection between ships is a dynamic portal that links both ship “rooms” at the correct orientation.

What is the name of this property and where might I find examples in real-life 3d engines?

+1  A: 

I can't tell you the exact name of this, but I think that it would be very easy to implement with openGL - when you draw each spaceship, you would translate that spaceship to the correct position in the 3d world. Then when you draw all the objects inside that ship, don't reset your world matrix - keep the translation the same, and everything will be drawn relative to the ship's position.

a_m0d
+7  A: 

Many 3D engines handle this by means of a scene graph. In most scene graphs, you'll have parent "nodes" that each contain children, in this case, each ship would be a node, and the people, rooms, furniture, etc inside the ship are children.

The positions of children are specified relative to their parents. This makes it trivial to "move" the ship, since you just move the ship, and it's children move along with it (without changing their position, as far as they're concerned).

In your example, the Up and Down sections would just be a matter of moving locally up or down. At some point, when you pass through the air lock, you'd move the child from one parent (ship) to the next parent (other ship), and change it's position (ie: from the bottom of the ship1 at 0,0,-20 to the "top" of ship 2 at 0,0,20, etc).

The OpenSceneGraph Quick Start Guide has a good discussion of this concept.


Edit:

As a related addition, many game oriented 3D engines, such as Ogre, also provide means of handling custom space partitioning within their scene graphs. For example, Ogre, out of the box, allows you to use Bsp and Octree partitioners for the scene, which is how they'd handle a person in one ship not seeing (and more importantly, not even attempting to render) the second ship if there's a wall in the way, etc. For things like your example, using space paritioning to cull is vital if you want to keep a high framerate with complex scenes.

Reed Copsey
+3  A: 

Extension of Reed's answer. Here's a snippet from an old Unreal Technology Feature list.

Dynamic scene graph technology

Dynamic scene graph (DSG) technology is a natural extension of portal technology. A dynamic scene graph consists of a root node, corresponding to the player's immediate surroundings, and a hierarchical tree of child nodes.

Each DSG node has a coordinate system transformation, clipping volume, and other rendering state associated with it. Unreal's rendering engine constructs a dynamic scene graph on-the-fly as each frame is rendered. New scene graph nodes are generated as the viewer's visibility propagates outward through portals. Scene graph nodes are the basic building blocks of many realistic effects and special effects, such as:

  • Mirror surfaces.
  • Semireflective materials, such as marble surfaces which partially reflect light.
  • Non-euclidean, redirectable "warp" portal effects for seeing through teleporters.
  • Seeing through windows into an infinite sky zone in which a sky, planets, mountains, and other objects are constructed.
  • Skies and backgrounds with independent coordinate systems for independent translation and rotation.

The strength of DSG rendering is that all of the node effects are fully interoperable. For example, once a mirror DSG node is defined, mirrors are automatically supported recursively (for hall-of-mirror type effects); mirrors work with skies; mirrors work with warp portals; warp portals work with skies, etc.

Unreal's dynamic scene graph technology is a basic building block which will be extended in future versions of the technology to incorporate such next-generation effects as seeing between levels, seeing across multiple servers on the Internet, and refractive water.

Ólafur Waage