Overview

Developing Virtual Environment Sets from Stock Object Libraries

One of the best approaches to solving large and complex problems is to break them up into sets of smaller and more manageable problems. This is often known as the divide and conquer approach. Building a virtual environment for any but the very simplest of uses is normally a large and complex problem. Building all of the parts of a virtual environment "from scratch" just adds to the complexity of the problem, as well as adding significantly to the time and human-resource requirements for a project.

Many projects can be completed more rapidly and cheaper by re-using pre-existing libraries of virtual objects, like those in the vrmLab Warehouse. Objects from libraries may be used "as is", or they may be modified like using a template.

Details of the Week: Repeating Textures and Object Transperancy

Using repeatS & repeatT

repeating texture example

Note how repeatS and repeatT can be used in combination with the scale attribute of the Texture node.


<?xml version="1.0" encoding="UTF-8"?>
<World xmlns="http://www.xvrml.net/schemas/core" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.xvrml.net/schemas/core 
                      http://www.xvrml.net/schemas/xVRML.xsd">
  <children>
    <Transform translation="-4.0 -0.05 0.0">
      <children>
        <Shape>
          <appearance>
            <Texture scale="2.0 2.0">
              <ImageTexture repeatS="true" repeatT="true" imageUrl="./redTile.gif"/>
            </Texture>
          </appearance>
          <geometry>
            <Box size="2.0 0.1 2.0"/>
          </geometry>
        </Shape>
        <Transform translation="0.0 1.0 -1.0">
          <children>
            <Shape>
              <appearance>
                <Texture>
                  <ImageTexture imageUrl="./repeatSandT.gif"/>
                </Texture>
              </appearance>
              <geometry>
                <Box size="2.0 2.0 0.1"/>
              </geometry>
            </Shape>
          </children>
        </Transform>
      </children>
    </Transform>
    <Transform translation="-1.5 -0.05 0.0">
      <children>
        <Shape>
          <appearance>
            <Texture scale="2.0 1.0">
              <ImageTexture repeatS="true" imageUrl="./redTile.gif"/>
            </Texture>
          </appearance>
          <geometry>
            <Box size="2.0 0.1 2.0"/>
          </geometry>
        </Shape>
        <Transform translation="0.0 1.0 -1.0">
          <children>
            <Shape>
              <appearance>
                <Texture>
                  <ImageTexture imageUrl="./repeatS.gif"/>
                </Texture>
              </appearance>
              <geometry>
                <Box size="2.0 2.0 0.1"/>
              </geometry>
            </Shape>
          </children>
        </Transform>
      </children>
    </Transform>
    <Transform translation="1.0 -0.05 0.0">
      <children>
        <Shape>
          <appearance>
            <Texture scale="1.0 2.0">
              <ImageTexture repeatT="true" imageUrl="./redTile.gif"/>
            </Texture>
          </appearance>
          <geometry>
            <Box size="2.0 0.1 2.0"/>
          </geometry>
        </Shape>
        <Transform translation="0.0 1.0 -1.0">
          <children>
            <Shape>
              <appearance>
                <Texture>
                  <ImageTexture imageUrl="./repeatT.gif"/>
                </Texture>
              </appearance>
              <geometry>
                <Box size="2.0 2.0 0.1"/>
              </geometry>
            </Shape>
          </children>
        </Transform>
      </children>
    </Transform>
    <Transform translation="3.5 -0.05 0.0">
      <children>
        <Shape>
          <appearance>
            <Texture>
              <ImageTexture imageUrl="./redTile.gif"/>
            </Texture>
          </appearance>
          <geometry>
            <Box size="2.0 0.1 2.0"/>
          </geometry>
        </Shape>
        <Transform translation="0.0 1.0 -1.0">
          <children>
            <Shape>
              <appearance>
                <Texture>
                  <ImageTexture imageUrl="./none.gif"/>
                </Texture>
              </appearance>
              <geometry>
                <Box size="2.0 2.0 0.1"/>
              </geometry>
            </Shape>
          </children>
        </Transform>
      </children>
    </Transform>

    <Transform translation="6.0 -0.05 0.0">
      <children>
        <Shape>
          <appearance>
            <Texture scale="5.0 2.0">
              <ImageTexture repeatS="true" repeatT="true" imageUrl="./redTile.gif"/>
            </Texture>
          </appearance>
          <geometry>
            <Box size="2.0 0.1 2.0"/>
          </geometry>
        </Shape>
        <Transform translation="0.0 1.0 -1.0">
          <children>
            <Shape>
              <appearance>
                <Texture>
                  <ImageTexture imageUrl="./repeatSandT.gif"/>
                </Texture>
              </appearance>
              <geometry>
                <Box size="2.0 2.0 0.1"/>
              </geometry>
            </Shape>
          </children>
        </Transform>
      </children>
    </Transform>
  
  </children>
</World>
    

Using Transparent Materials

Transparent window/wall example

Note how the alpha attribute can be used in a Material color node. What happens with a one-sided oject?


<?xml version="1.0" encoding="UTF-8"?>
<World xmlns="http://www.xvrml.net/schemas/core" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.xvrml.net/schemas/core 
                      http://www.xvrml.net/schemas/xVRML.xsd">
  <children>
    <Viewpoint name="first" position="0.0 0.0 20.0"/>
    <Viewpoint name="second" position="-20.0 0.0 0.0" rotation="0.0 -1.0 0.0 1.57"/>
    <Transform translation="0.0 0.0 -2.0">
      <children>
        <Shape name="baseSphere">
          <appearance>
            <Material>
              <diffuseColor red="0.0" green="1.0" blue="1.0"/>
            </Material>
          </appearance>
          <geometry>
            <Sphere/>
          </geometry>
        </Shape>
      </children>
    </Transform>
    <Transform translation="10.0 0.0 0.0">
      <children>
        <Use target="baseSphere"/>
      </children>
    </Transform>
    <Transform translation="0.0 0.0 5.0">
      <children>
        <Shape name="baseWindow">
          <appearance>
            <Material>
              <diffuseColor red="1.0" green="1.0" blue="0.0" alpha="0.4"/>
            </Material>
          </appearance>
          <geometry>
            <Box size="10.0 10.0 0.1"/>
          </geometry>
        </Shape>
      </children>
    </Transform>
    <Transform translation="5.0 0.0 0.0" rotation="0.0 1.0 0.0 1.57">
      <children>
        <Use target="baseWindow"/>
      </children>
    </Transform>
    
  </children>
</World>
    

Using the vrmLab Object Warehouse

Some vrmLab Warehouse History

I set up a virtual space I called the vrmLab in 1995, as a "virtual space for VR[...] experiments and demonstrations" on the Web. That site included the vrmLab Warehouse, which I established to serve as a public repository of open-source and shared VR objects. I have converted most of those objects to the newer xVRML format.

How to Use the vrmLab Warehouse?

Your machine and Web browser can be set up to understand that the MIME type model/xvrml+xml should be associated with the Carina application. If you do that, then clicking on a model in the Warehouse directory display in your Web browser will result in that model opening in Carina. If you drag-and-drop a model from that display onto Carina, then that should also result in the model opening in Carina. Carina understands that the MIME type model/xvrml+xml is associated with xVRML files. Carina that the filename extentions which are associated with xVRML (and that MIME type) are .xwrl (for normal text files) and .xwrlz (for gzipped text files). You can also open models from your local directory display by dragging-and-dropping the models onto Carina.

How to submit objects to the vrmLab Warehouse?

Contact your instructor, please. The Warehouse accepts valid and well-formed models in xVRML format for inclusion under the Creative Commons licenses.

Carina Browser Application

Current Carina Implementation Limitations

The Carina viewer application is not yet complete. It currently supports a majority of the specification, but not all. You should use the chart on the Carina xVRML Support page to plan which nodes and what attributes to use. Note that most of the static nodes are completed, and that we have just started to implement the dynamic nodes. As of 22 MAR 2006, the following nodes and atributes are supported by Carina:

NodeSupportedSupported AttributesNotes
AnchorXAll
AudioClip
AvatarXspeed, cameraOffset, bboxCenter, bboxSize
Background
Billboard
BoxXAll
Collision
ColorInterpolator
ConeXAll
CoordinateInterpolator
CylinderXAll
CylinderSensor
DirectionalLightXAll
ElevationGrid
Extrusion
Fog
GroupXAll
ImageTextureXAll
IndexedFaceSetXAll
IndexedLineSetXAll
InlineXAll
LOD
MaterialXAllAlpha of material colors is currently broken
MovieTexture
NormalInterpolator
OrientationInterpolator
PixelTextureXAllTransparency does not work when using 2 or 4 components
PlaneSensor
PointLightXAll but radius
PointSetXAll
PositionInterpolator
ProximitySensor
Route
ScalarInterpolator
Script
ShapeXAll
Sound
SphereXAll
SphereSensor
SpotLightXAll but radius
Switch
Text
TextureXAllDoes not support MovieTexture Nodes
TimeSensor
TouchSensor
TransformXAll
UseXAll
ViewpointXrotation, position, description, fieldOfView
VisibilitySensor
WorldXAll
WorldInfoXAll

In-Class Exercise

Developing a Virtual Environment Set from a Stock Object Library

Plan and Design

Pair up with someone in the class. Look at the objects in the vrmLab Warehouse and get familiar with how they are grouped and what is available there. I will select one team-of-two to build/locate and assemble infrastructure objects, like stairwells and hallway lighting and vending machines and so on.

Design on paper a floor of an office building consisting of identical offices lining both sides of a hallway or set of hallways. Be sure to map out where all the floors and ceilings and walls and doors and lighting fixures and stairs and so on should go. Show your design to the instructor for an okay. The outside dimensions of your plan for your office building floor should be exactly 80 meters wide by 80 meters deep by 4 meters tall.

Be sure to build the corner offices as easily-replaceable groups. We are going to stack these floors up together to form a building when we are done. All groups will have to negotiate with the infrastructure group about such things as where the stairs should go and the details of the hallways.

Readings

Synthetic Environments