http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif next up previous contents index
Next: 3.2 Levels of Details Up: 3. Good VRML Style Previous: 3. Good VRML Style

Subsections


    
3.1 Your first ``real'' VRML file

So far you have learned that VRML is a text file format for describing 3-D shapes and interactive environments on the WEB. It basically contains a set of Nodes that contain fields and values. As the examples shown so far demonstrate, you could do ``interesting'' VRMLized web ``pages'', but you need to learn a few more things.

Navigation Information

VRML allows you to specify Navigation Information with the =>NavigationInfo Node. Currently most VRML 2.0 browsers will support the type field which allows you to specify the navigation paradigm to use. You can choose among ``WALK'', ``EXAMINE'', ``FLY'' and ``NONE''. In the following example we tell the browser to be in ``examine mode'', which is useful for displaying 3-D data or single objects.

NavigationInfo { type "EXAMINE"}      # Use the Examine viewer

Note: be careful with this. Some browsers (e.g. Community Place) will not allow the user to switch modes once you defined one in your file. E.g. when you put the browser in ``examination'' (or flip) mode, the user won't be able to turn back into ``walking'' mode. In this case, use:

NavigationInfo { type [ "EXAMINE", "ANY" ] }  # Examine viewer but allow change

Viewpoints

Looking at some examples you wrote, you probably noticed that your ``scene'' (or yourself) is not at the ``right place''.

The most simple thing you can do is to define a single default =>Viewpoint that places the user at the right distance from the object. Per default, browsers are supposed to put you at (0 0 10) which is fine for viewing small objects. In the following example we place the viewpoint 12 ``meters'' in front, 3 ``meters'' up, and 2 ``meters'' to the right.

Viewpoint { position 2 3 12 }

The Viewpoint node is more complex than that. You can also give an orientation to the view (``look into a direction''). It works the same way as rotation does (see section 1.2.4).

Once you have defined a few viewpoints (and DEFed them with a name), it is important to fill in the description field if you want people to be able to use the ``viewpoints'' menu in their browser. Here is an example:

DEF SunView Viewpoint {
   position 2 0 -10
   description "VERY close to the SUN"
   orientation 1 0 0 0.4}

Next, you can use viewpoints to organize ``tour guides''. The next example shows how to organize a simple guided tour.

Example 3.1.1   A simple ugly tour guide  

VRML: ../examples/inter/inter-tour-guide.wrl
Source: ../examples/inter/inter-tour-guide.text

In particular, look at the following details:

Information about your World

Instead of putting information about your world in comments at the beginning of the file, you better should use the =>WorldInfo node. Here is an example:

WorldInfo {
  info  ["A sample home page", "steal it if you like", "Version 1 - Feb 97"]
  title "Ka's kewl home page"
}
The browser may display the contents of the title field!

Finally:

Don't forget to color your objects, without color one can hardly make out anything.


next up previous contents index http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif
Next: 3.2 Levels of Details Up: 3. Good VRML Style Previous: 3. Good VRML Style
D.K.S. - 1998-03-18