[topmenu.htm]

 

How to Make a Multi-View VRML 

 

 

Internal Document Only -- Watch Us Work

 

This document describes how to convert your existing VRML worlds to work with the Multi-Screen VRML program in Java on the Onyx2 Portal.

  1. Make a directory on your account that will contain your multi-screen VRML application.

    mkdir mymulti
    cd mymulti

    where mymulti is the name of your new directory.

  2. Copy all the sample programs and templates to your new directory.

    cp /software/apps/multi_screen_vrml/bin/* .
    cp /software/apps/multi_screen_vrml/templates/* .
    cp /software/apps/multi_screen_vrml/src/* .

    Now your directory will contain the following files:

    ButtonBar.class
    java.html
    minmax.pl
    three.class
    three.html
    three.java
    vrml1.html
    vrml1ToVrml2
    vrml_header.wrl

  3. Copy your VRML world files to this new directory. If you already have VRML version 2.0 files, skip the next step.
  4. Convert VRML 1.0 files to VRML 2.0 files.
  5. At the shell prompt, enter: vrml1ToVrml2 V1file.wrl > V2file.wrl

    where:

    If an error occurs, your version 1.0 file may not have the VRML 1.0 header included. In this case, you must add:

    #VRML V1.0 ascii

    in the first line of each VRML version 1.0 file that you convert.

  6. Find minimums, maximums and possible size of the worlds combined.

    At the shell prompt, enter: minmax.pl

    You will be prompted for the names of your VRML files with a message like this:

    Please enter the filename(s) of the VRML file (separated by spaces):

    Along with the output of the minimums and maximums is the possible size. You will use these values in the Java template in the next step.

  7. Template Files

    There are several template files that need to be modified, in addition to your VRML files, for the multi-view program to work:

    java.html
    vrml1.html
    three.html

    All replacements are marked in the template files by the phrase "template.variable" where variable is the name of some identifier like size. For example,

    replace: <PARAM name="size" value="template.size">
    with: <PARAM name="size" value="50">

java.html

There are 9 values that you can or must change in order to make the program work.

The first of these is the size (template.size). This specifies the size of the VRML worlds on average. By looking at the minimum and maximum values produced by the minmax.pl program, derive a size which fairly approximates the average of all axises. You can change this value if you see that the program is panning, scaling, or zooming in too small or too big steps.

Next is the window number (template.windowsize) which specifies the number of VRML worlds you will have on the page. This is usually set to 2 or 3 and this depends on how many worlds you want to see at one time.

Button number is set at 8 but can be changed. This specifies how many buttons are present for each transformation.

<PARAM name="buttonnumber" value="8">

If you feel that you are not moving in small enough increments (in translating and rotating), you can increase this number. This also means you must increase the width of the java applet which is set at 1250 in this file.

<applet code="three.class" mayscript height="132" width="1250">

The other fill-ins are the values of the minimums and maximums that you found through minmax.pl. Simply plug in the values in the correct template location.

<PARAM name="minx" value="template.minx">
<PARAM name="miny" value="template.miny">
<PARAM name="minz" value="template.minz">
<PARAM name="maxx" value="template.maxx">
<PARAM name="maxy" value="template.maxy">
<PARAM name="maxz" value="template.maxz">

vrml1.html

Depending on how many worlds you have, there must be that many files of the format vrml#.html. Create the files by copying this template. For instance, if you have three worlds,

cp vrml1.html vrml2.html
cp vrml1.html vrml3.html

Within each vrml#.html file, you must change the value of the placeholder "template.vrml" to one of the the filenames of the VRML file you wish to use. Each one of these files specifies a particular one of your VRML files.

<embed src="template.vrml" border=10 height="760" width="800">

three.html

Depending on how many vrml#.html files you have, you must add or remove the frame lines which include the vrml#.html files to include the proper number. You must also make proportional divisions in the frameset to accomodate the number of worlds. Example: 50%, 50% for two worlds; 33%, 33%, 33% for three worlds.

<frameset border=0 cols="33%,33%,33%">
<frame scrolling=no name="vrml1" src="vrml1.html">
<frame scrolling=no name="vrml2" src="vrml2.html">
<frame scrolling=no name="vrml3" src="vrml3.html">

vrml_header.wrl

The vrml_header.wrl file contains code which must be included in each of your VRML files. First modify this file as described below, then read this file into the beginning of each of your VRML files right after the "#VRML V2.0 utf8" line.

This is the hardest part of the conversion process. It involves getting your multiple worlds to look good. You will have to make some changes, look at the output, and probably go back and edit each VRML world file to change the values again. Run netscape on three.html to view your application.

  1. If you already have a Viewpoint, plug in the position and orientation values into the vrml_header.wrl file and delete your old Viewpoint section (from { to }).
  2. The template.radius value is the radius of the ball to be used as a center for rotation. You should make it about 1/50 of your VRML world. When you run the program, if the ball is too small or too big, change this value accordingly.
  3. For template.maxxplus1, template.maxyplus1, and template.maxzplus1, put in your maximum values for these axes, but add 1 to them first. For example, if your maxes were 10, 20, and 30 for x, y, and z, respectively, then the inputs you would put would be 11, 21, and 31 for maxxplus1, maxyplus1, and maxzplus1, respectively. These values correspond to the positioning of the labels which specify the maxes of each axis. You can change these if they do not look right when the program runs.
  4. For template.maxx, template.maxy, and template.maxz, fill in the values you received from minmax.pl. There are two places for each value that you must replace (6 places in all -- 3 for the label and 3 for the axis).
  5. For template.numbertimes3x, template.numbertimes3y, and template.numbertimes3z, put the number of digits in the label (decimals included) which you just defined (template.max) and multiply it by three. If number seems too crunched up, increase the number. If number seems too spread out, decrease the number.
  6. For template.sizedividedby30, take the size from minmax.pl, divide it by 30, and place the value into this area. This is for the size of the font. Round up -- this should be an integer. If number looks too small, increase number. If it looks too big, decrease the number.
  7. Now read the edited vrml_header.wrl file into the beginning of each of your VRML world files.

    A line including the word "Shape" should follow right after the end of the header file you have just included. If it has information between the end of the vrml template (children [), delete the lines as you tally the number of [ and { that do not close off before Shape. Go to the end of the file and delete the number of corresponding ]'s and }'s. Place ]}]}]}]} at the very last line. The application will error if you do not do this or if something was not right in changing the templates. Complete this process to all the worlds you expect to use.

Finishing up

After you have completed making your application, you may remove your copies of the following files:

minmax.pl
vrml1ToVrml2
vrml_header.wrl

Run netscape on three.html to view your application. See How to Use the Multi-View VRML/Cosmo Java Applet on the Onyx2 for help on how to navigate your multiple worlds.

[footer.htm]