VRML, Java and Math: The Future of the Internet

Department of Mathematical Sciences
Rensselaer Polytechnic Institute
Troy, NY
March 22, 1996


Adrian Scott, Ph.D.
CEO, Aereal Inc.
These notes are on the Web at http://www.aereal.com/talks/rpi.

Three concepts today:

  1. Use VRML to graph / visualize / experientiate

  2. Use Java to calculate

  3. Use the Web to share


Details:

What is VRML?

VRML is Virtual Reality Modeling Language, a file format that is the open standard for virtual reality on the Internet.

Virtual Reality is an immersive, computer-generated environment that can include 3-D graphics, sound and more. You can access VRML worlds using a VRML browser, which can be a stand-alone or a plug-in to a regular WWW browser.

Examples:

Perhaps you have a home page on the Web; now it's time for a home WORLD!

Your First VRML World:

#VRML V1.0 ascii
Separator {
 Material { diffuseColor 0 .7 0 }
 Sphere { radius 5 }
 Translation { translation 0 10 0 }
 AsciiText { string "Hello Virtual World" }
}
Instant VRML Home World


What is Java?

Java can exist in two forms, applets and applications. VRML 2.0 will introduce a new form, based on "Script Nodes".

Currently, Java applets let you do things like calculate mortgages or play Pac-Man within your Web browser.

VRML, Java and Math

When you combine VRML and Java, you can get very exciting virtual worlds and accompanying applications.

Applications to mathematics:

As VRML moves into its 2.0 specification, VRML and Java will become linked. VRML will describe the environment of the virtual world, such as geometry and sound placement. Java will describe change.

So, VRML is like a surface, and Java is like its derivative! :)

Teaching Mathematics

Examples

JavaScript and VRML

Adrian's Grapher

CGI & VRML

Another Grapher

Java and VRML

VRML Fighter

VRML 2.0

What capabilities will VRML 2.0 provide:

ProximitySensor, ClickSensor, Extension nodes defined with Java code.

Imagine surfing a derivative.

Seamless cyberspace.

Mechanism for integrating Java and VRML

In VRML, you define extension nodes by giving the basic syntax, initial VRML, and a reference to Java code that defines the node using calls to a Java VRML API.

You can also have Script nodes and then route between events.

Here's a look at a sample VRML reference to Java:

--script node

Script {
  field SFColor currentColor 0 0 0
  eventIn SFColor colorIn
  eventOut SFBool isRed

  scriptType "javabc"
  behavior "ExampleScript.java"
}


--java

import vrml;


class ExampleScript extends Script {

  // Declare field(s)
  private SFColor currentColor = (SFColor) getField("currentColor");

  // Declare eventOut field(s)
  private SFBool isRed = (SFBool) getEventOut("isRed");

  public void colorIn(ConstSFColor newColor, ConstSFTime ts) {
    // This method is called when a colorIn event is received
    currentColor.setValue(newColor.getValue());
  }

  public void eventsProcessed() {
    if (currentColor.getValue()[0] >= 0.5) // if red is at or above 50%
      isRed.setValue(TRUE);
  }

}

Where Do We Go From Here?

Grow Cyberspace! Create a seamless cyberspace that creates a topography over the existing web, and then add layers of artificial life and objects with behaviors.

Virtual Reality provides us with an environment to do artificial life.

Again, Three concepts:

  1. Use VRML to graph and visualize

  2. Use Java to calculate

  3. Use the Web to share






more examples:

DEF OpenVault Script {
  # Declarations of what's in this Script node:
  eventIn SFBool vaultClosed
  eventIn SFString combinationEntered
  eventOut SFBool openVault
  field SFString correctCombination "43-22-9"
  field SFBool currentlyOpen FALSE

  # Implementation of the logic:
  scriptType "java"
  behavior "java.class"
}



   The "java.class" file will contain a compiled version of the following
   Java source code:

import vrml;

class VaultScript extends Script {

  // Declare fields
  private SFBool currentlyOpen = (SFBool) getField("currentlyOpen");
  private SFString correctCombination = (SFString) getField("correctCombination
");

  // Declare eventOuts
  private SFBool openVault = (SFBool) getEventOut("openVault");

  // Handle eventIns
  public void vaultClosed(ConstSFBool value, SFTime ts) {
    currentlyOpen.setValue(FALSE);
  }

  public void combinationEntered(ConstSFString combo, SFTime ts) {
    if (currentlyOpen.getValue() == FALSE &&
        combo.getValue() == correctCombination) {
      currentlyOpen.setValue(TRUE);
      openVault.setValue(TRUE);
    }
  }
}