Showing posts with label vrml. Show all posts
Showing posts with label vrml. Show all posts

Saturday, February 14, 2009

IndexedLineSet demo - drawing Cartesian axes

Here are the three Cartesian axes, each perpendicular to the other two:
#VRML V2.0 utf8

Shape {
  appearance Appearance {
    material Material {
      emissiveColor 1 1 1
    }
  }

  geometry IndexedLineSet {
    coord Coordinate {
      point [
        -1 0 0, 1 0 0, 0 0 1,
        0 0 -1, 0 -1 0, 0 1 0
      ]
    }

    coordIndex [ 0 1 -1 2 3 -1 4 5 ]
  }
}

Thursday, January 1, 2009

VRML plugins and viewers

VRML97 (Virtual Reality Modelling Language, aka VRML 2.0) is the ISO standard for displaying 3D data over the web. A browser plugin is required. Here are my experiences with some free plugins and players. See also a NIST page about web 3D plugins.

view3dscene (great)

Displays many formats: VRML, X3D, 3DS, MD3, Wavefront OBJ, Collada. Open source, stable, small, quick, fast even on cheap hardware. Easy to install under recent Linux distros. I'm using SVN version and works under 64 bit linux too. I maintain the Arch Linux package. Only one con: it's not a browser plugin.

FreeWRL and OSX poor support (not recommended)

I downloaded FreeWRL for OS X and installed it for using with Safari. The first simple demo I ran was this grey cone.

At the time I was writing there are some annoying bugs: when I open a WRL file in a tab all other tabs in the same windows became black and are thus unusable. This also happens when a VRML scene is embedded in page. Scrolling doesn't work the way it should as well. Another limitation of FreeWRL is that can only have 1 active window in Safari.

First I lived with it by always opening WRL files in a new window. Then I decided to use the FreeWRL application for all testing and development and return to Safari only for a final test. Fortunately in FreeWRL menu there is a File/Reload option. Also make sure to enable the Console Register under Window. Hope Safari support will be better in the future.

But even the FreeWRL application is unstable and slow. This may be because FreeWRL is Java-based :-P This is also why I don't use it anymore.

PS: When you make a mistake in a WRL file you will hear a female voice from FreeWRL actually speaking (!) the error message. Cool at first, but after a a few repetitions of the same errors I've decided to mute the speakers and read errors using the Utility -> Console OSX application.

OpenVRML under Linux (not recommended)

I maintain the ArchLinux package. A pain to compile from sources. Doesn't load complicated worlds and it's slow.

Octaga Player (not recommended)

Not open source. Unstable plugin. Doesn't work with 64-bit Linux. A pain to install for 32-bit Linux. Easy to install in Mac OS X but not working very well.

Monday, December 29, 2008

PointSet demo

Here are three points. Note they are all on a plane (coords are given as triplets X Y Z and Z is zero for all).
#VRML V2.0 utf8

Shape {
  geometry PointSet {
    color Color {
      color [
        1.0 0.0 0.0,
        0.0 1.0 0.0,
        0.0 0.0 1.0
      ]
    }
coord Coordinate {
      point [
        -1.0 -1.0 0.0,
        1.0 1.0 0.0,
        0.0 0.0 0.0
      ]
    }
  }
}
Three not aligned points in space. Note when no color is specified the default color is the emissive color from this node. Since default emissive color and background are black we need to change one of them or we won't be able to see the points.
#VRML V2.0 utf8

Shape {
  appearance Appearance {
    material Material {
      emissiveColor 1 1 1
    }
  }

  geometry PointSet {
    coord Coordinate {
      point [ -1 -1 0, 0 2 1, 1 0 -1 ]
    }
  }
}

Saturday, December 27, 2008

Grey cone

I took this tutorial which covers the basics of VRML 97. Also this one is useful. In just a few minutes I was able to understand the source for the grey cone demo:
#VRML V2.0 utf8
Comment header. Defines the VRML version and charset used.
Shape {
Shape node. Defines all visible objects.
appearance Appearance {
Appearance field. Specifies an Appearance node that defines the look of the geometry. This field is optional and may be omitted.
material Material {
    }
Material field containing a Material node.
}
  geometry Cone {
  }
Geometry field. Indicates which shape is to be drawn
}