The PNG Guide is an eBook based on Greg Roelofs' book, originally published by O'Reilly.



VRML Browsers and Other 3D Apps

VRML, the Virtual Reality Modeling Language, is a file format and a language for defining three-dimensional virtual objects, their appearances and their behaviors. As of early 1999, it has seen two major versions, and the design of a third is currently underway. Version 1.0 included little more than static geometry and never saw wide use. Version 2.0, released in August 1996 and approved as an ISO/IEC international standard in December 1997, added animation, scripting, and a much more rigorous specification of all aspects of the format. It also mandated PNG as one of two image formats required for minimal conformance. (JPEG was the other.) No doubt due to PNG's rampant popularity,[39] VRML 2.0--or VRML97, as the ISO standard is known--achieved dramatically greater recognition and acceptance than VRML 1.0, with shipments of VRML97 browsers reaching levels of between 25 million and 75 million units by the autumn of 1998.

[39] Well, in part, anyway...

How is PNG actually used in a 3D, text-based file format? A complete answer would require considerable discussion of 3D rendering engines, CPU and memory performance, Moore's Law, and so forth. But in a nutshell, VRML is designed for interactive 3D--particularly Web-based, immersive, interactive 3D. A truly realistic animated object, such as the dinosaurs in the movie ''Jurassic Park'' or the flying cow in "Twister," would require far more computational power to render in ``real time'' at reasonable frame rates (say, more than 15 frames per second) than even today's fastest processors can manage. And that's just one object; imagine every rock, tree, bug, cloud, and blade of grass rendered at the same level of realism, responding to dynamic effects like wind, sunlight, and other moving objects. Doing all of that is likely to remain out of reach of typical personal computers for a decade or more.

As a result, VRML is all about trickery, and one of the most efficient forms of 3D trickery is known as texture-mapping. Instead of creating a highly detailed 3D object out of many tiny polygons, it is often possible to create a very realistic approximation of it out of just a few polygons, with an appropriate image (or texture) drawn over them. Anyone who has studied a 3D game like Quake or Descent is probably familiar with the concept; the buildings and even the characters are actually quite crude, but with stone or metal textures and lighting effects applied, the world suddenly becomes a realistically gloomy dungeon or sewer system or a bright and shiny high-tech laboratory.[40]

[40] In the case of characters, animation and sound effects also aid the illusion tremendously.

PNG's role in this is as a format for the textures. VRML references PNG images in much the same way that HTML pages do, via a URL that points at the PNG file. A VRML viewer then fetches the PNG image, applies it to the polygons of the relevant object according to the rules in the VRML specification, and displays the result within the 3D scene.

Because both raw VRML objects and PNG textures support not only colors but also transparency and partial transparency (loosely, ``translucency''), a number of interesting effects are possible. On the other hand, the potential number of interactions and combinations is immense, so the VRML97 spec defines some basic rules regarding VRML materials and how textures modify them:

  • A one-component texture--i.e., grayscale--absorbs and modulates the underlying polygon's color and transparency. For example, an opaque yellow triangle with a gray, gradient texture applied to it will turn into an opaque triangle with a yellow gradient. The orientation of the gradient depends on how the author specified the coordinates of the texture.

  • A two-component texture (grayscale plus an alpha channel) absorbs the underlying polygon's color, but any transparency in the base polygon is replaced by the transparency of the texture.

  • A three-component texture (RGB color) replaces the underlying polygon's color but inherits its transparency (if any); a blue texture applied to a red polygon with 50% transparency turn its into a 50% transparent blue polygon.

  • A four-component texture (RGB plus an alpha channel, or RGBA) completely overrides the color and transparency of the underlying polygon.

What about palette-based images? If every color in the palette is pure gray (that is, if the values for red, green, and blue are equal for each entry), then the image is treated as grayscale. If even one palette entry is not gray, the image is treated as RGB color. And if the image includes a transparency chunk (more on that in PNG Image Types), it is treated as though it has a full alpha channel.[41]

[41] The transparency chunk rule also applies to true RGB or grayscale PNGs, in which such a chunk indicates that a single color or shade of gray is to be considered fully transparent.

These rules are worth keeping in mind because, alas, full support for PNG in VRML browsers is Not Quite There Yet. Just as there are two main web browsers, prior to August 1998 there were just three main VRML browsers: Cosmo Player, WorldView, and blaxxun CC3D.[42] Although PNG support in each of them was better than that in either of the Big Two web browsers, VRML applications are necessarily subject to quite a few more variables: different rendering engines, a myriad of third-party hardware and even more versions of device drivers, various browser performance options, and, of course, the list presented earlier of ways in which a PNG texture can interact with the objects to which it is applied. And texture support is just one small part of a VRML browser! In other words, because so many things can go wrong, quite a few things do go wrong...at least in some situations.

[42] Platinum Technology bought Intervista (maker of WorldView) in June 1998 and most of Cosmo Software (maker of Cosmo Player) in August. In September, they publicly announced their intention to merge the two browsers within a relatively short period, so for a brief period the VRML world appeared to be heading toward an even greater similarity to the world of HTML. Alas, the best-laid plans sometimes go awry; in February 1999, Platinum restructured and, among other things, shed its entire 3D team. As of mid-March, it appeared that Platinum was well on it way to releasing the source code to Cosmo Player under a completely open license (with somewhat more restrictive licenses for other 3D tools, such as WorldView for Developers and Cosmo Worlds). But in yet another unexpected twist, Computer Associates announced in late March that it was acquiring Platinum. As of early April 1999, no one yet knew the fate of any of the WorldView/Cosmo suite.

Despite that somewhat bleak disclaimer, PNG support in older VRML browsers has improved with each new release, and several new browsers are under development as this is being written. Most of the major ones are listed in the following sections, with known problems indicated. Unless otherwise noted, all are plug-ins to web browsers, which they typically use not only to enable the downloading of files over the Web but also to provide support for Java, and JavaScript (the standardized variant of which is known ECMAscript).




Last Update: 2010-Nov-26