S2PLOT:S2web

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:06, 14 October 2008
Dbarnes (Talk | contribs)
(s2web: Embedding S2PLOT Content in Web Pages (using Flash))
← Previous diff
Current revision
Dbarnes (Talk | contribs)
(s2web: Embedding S2PLOT Content in Web Pages (using Flash))
Line 3: Line 3:
Since version 2.02, S2PLOT has been able to write the displayed geometry to a VRML 97 format file. This format was selected as it can be read in by Adobe Acrobat 3D and embedded in Portable Document Format (PDF) files. See [[S2PLOT:3dPDF | the section on 3-d PDF]] for more information. Since version 2.02, S2PLOT has been able to write the displayed geometry to a VRML 97 format file. This format was selected as it can be read in by Adobe Acrobat 3D and embedded in Portable Document Format (PDF) files. See [[S2PLOT:3dPDF | the section on 3-d PDF]] for more information.
-We also use the VRML export capability of S2PLOT to produce content for the freely available S2PLOT Flash player, '''s2web'''. A syntax-only translation using the NIST-provided [ | v2x3d] yields an X3D file from the S2PLOT-exported VRML, and the 3-d scene in the X3D file can be read and displayed by s2web. Camera control and interaction with the scene in the s2web application is almost identical to that in a native S2PLOT program. Volume rendering, billboards, handles and frame-based animation are all supported.+We also use the VRML export capability of S2PLOT to produce content for the freely available S2PLOT Flash player, '''s2web'''. A syntax-only translation using the [http://ovrt.nist.gov/v2_x3d.html NIST-provided Vrml97ToX3dNist] yields an X3D file from the S2PLOT-exported VRML, and the 3-d scene in the X3D file can be read and displayed by s2web. Camera control and interaction with the scene in the s2web application is almost identical to that in a native S2PLOT program. Volume rendering, billboards, handles and frame-based animation are all supported.
-The s2web functionality of S2PLOT is documented in the following paper. <font color=red>'''If you use s2web to embed S2PLOT content in a web page, please cite or acknowledge this source:'''</font>+The s2web functionality of S2PLOT is documented in the first paper below. <font color=red>'''If you use s2web to embed S2PLOT content in a web page, please cite or acknowledge one of these sources:'''</font>
-* +* Fluke, C.J., Barnes, D.G., Jones, N.T., 2008, "Interchanging Interactive 3-d graphics for Cosmology", submitted to PASA, Oct 2008
 +* Barnes, D.G., Fluke, C.J., Bourke, P.D., Parry, O.T., 2006, '''An Advanced, Three-Dimensional Plotting Library for Astronomy''', PASA, 23, 82 - [http://ads.grangenet.net/abs/2006PASA...23...82B (ADS)] [http://au.arxiv.org/abs/astro-ph/0608245 (astro-ph/0608245)]
===Requirements=== ===Requirements===
Line 14: Line 15:
** version 2.4 or higher recommended ** version 2.4 or higher recommended
** <font color=green>S2PLOT is freely available for non-commercial and educational use</font> ** <font color=green>S2PLOT is freely available for non-commercial and educational use</font>
-* Adobe Acrobat 3D version 8.1.2+* A program for converting TGA image files to PNG image files
-** Adobe Acrobat Pro 9 Extended expected to work but not yet tested and interface may be different to that described below+** ImageMagick's <code>convert</code> is recommended; <font color=green>[http://www.imagemagick.org ImageMagick] is free software.</font>
-** <font color=green>Acrobat 3D and Acrobat Pro 9 Extended are commercial software but frequently are available at special academic and education prices</font>+* s2web version 0.1 or higher
 +** <font color=green>s2web is freely available for non-commercial and educational use</font>
 +* The VRML97 to X3D converter (Vrml97ToX3dNist) from the National Institute of Standards and Technology
 +** <font color=green>Vrml97ToX3dNist is freely available</font>
 +* The perl script <code>s2plot-vrml2x3d.pl</code> for post-processing S2PLOT-exported VRML and converting to X3D using Vrml97ToX3dNist
 +** <font color=green><code>s2plot-vrml2x3d.pl</code> is freely available and included with S2PLOT versions after (not including) 2.4. It is also available from the [[S2PLOT:PeripheralDownload | peripheral downloads]] section of the S2PLOT website</font>
===VRML export from S2PLOT=== ===VRML export from S2PLOT===
Line 22: Line 28:
Most S2PLOT geometry can be written to VRML format. While running an S2PLOT program, simply press Shift-W and a file called "test.wrl" will be written. It will overwrite any pre-existing "test.wrl" file in the current working directory. Most S2PLOT geometry can be written to VRML format. While running an S2PLOT program, simply press Shift-W and a file called "test.wrl" will be written. It will overwrite any pre-existing "test.wrl" file in the current working directory.
-When writing an S2PLOT program whose output may be captured to VRML, keep the following points in mind:+Please see [[S2PLOT:3dPDF | the section on 3-d PDF]] for specific hints about VRML export.
-* screen-coordinate geometry is not saved to VRML+ 
-* line thickness is not properly supported in VRML+===Texture conversion===
-* textured spheres are not presently written to VRML (next version of S2PLOT)+ 
-* transparent dots are not presently written to VRML (next version of S2PLOT)+S2PLOT writes textures in TGA image format, with the name convention <code>vrml-texNNN.tga</code>. It is necessary to convert these textures to PNG format prior to use of the S2PLOT-exported VRML. Textures are named in the output VRML file so that the necessary conversion is from <code>vrml-texNNN.tga</code> to <code>vrml-texNNN.tga.png</code>. This conversion can be accomplished with ImageMagick's <code>convert</code> program or almost any other image editor or converter.
-* disks are not presently written to VRML (next version of S2PLOT)+ 
-* both static and dynamic S2PLOT geometry is saved to the VRML file+===Creating X3D and the ZIP archive===
-* you can organise parts of your geometry into named sections of the VRML file (model tree) by using the S2PLOT function pushVRMLname+ 
-* correct volume rendering requires special attention (see below)+The <code>s2web</code> Flash program expects to be provided with a ZIP file that contains one X3D file, plus required textures in PNG image format.
-* frame animation is possible (see below)+ 
-* billboards can be used but require special attention (see below)+X3D is a syntactic variant for VRML 97 for the purposes of this document. The National Institute of Standards and Technology provides a free VRML to X3D converter: [http://ovrt.nist.gov/v2_x3d.html NIST-provided Vrml97ToX3dNist]. A script (<code>s2plot-vrml2x3d.pl</code>) is [[S2PLOT:PeripheralDownload | available]] that post-processes the S2PLOT-exported VRML and then executes the conversion to X3D using Vrml97ToX3dNist. Typical usage of this script would be as follows, '''after conversion of textures from TGA to PNG format''':
-* handles are written and can be used for particular types of interaction (see below)+* <code>s2plot-vrml2x3d.pl test.wrl</code>
-* Acrobat Reader generally struggles with more than say 5000 pieces of geometry (whether points, lines or facets)+ 
-* you can programmatically export the VRML file by declaring the function "void writeVRML20(void)" and calling it from a dynamic S2PLOT callback function+The <code>s2plot-vrml2x3d.pl</code> script does three important tasks at this stage:
 +# it removes any <code>lineProperties</code> tags from the VRML (these tags [rightly] offend Vrml97ToX3dNist)
 +# it duplicates any textures that are used more than once in different colours (eg. as is frequently done for splats)
 +# it converts the post-processed VRML to X3D format
 + 
 +The output X3D file and textures (which are now named by convention <code>duptexNNNNN.png</code>) are now simply zipped up into a single compressed bundle. '''By convention, it is recommended that the X3D file have the same base name as the zipped archive.''' For example, the X3D file <code>mys2plot.x3d</code> should be placed in a ZIP file (with any required textures) named <code>mys2plot.zip</code>.
 + 
 +===Deploying on the Web===
 + 
 +Deployment of the <code>s2web</code> application on a web page with your custom S2PLOT visualisation is relatively straightforward. Download the template web files from the [[S2PLOT:PeripheralDownload | peripheral download area]], and extract them to a directory on your webserver. Add your ZIP file created above to the same directory, and optionally, a preview image in PNG format. The preview image will be shown blurred and dimmed when the s2web application is inactive.
 + 
 +Modify the provided <code>index.html</code> file according to the instructions within. This entails substituting occurrences of "s2test" with the name of your zip file and/or preview image. Once you have done this you should be able to navigate to the directory and view the visualisation in a Flash-enabled browser.
 + 
 +===Flash Support in Browsers===
 + 
 +The s2web application requires Flash Player version 9 or greater, and appears to work well on Windows, Macintosh and 32-bit Linux computers. To view Flash content on a 64-bit Linux computer requires you install a 32-bit browser, and then the 32-bit Flash Player within that browser, as there is no 64-bit Flash Player for Linux at the time of writing.

Current revision

Contents

s2web: Embedding S2PLOT Content in Web Pages (using Flash)

Since version 2.02, S2PLOT has been able to write the displayed geometry to a VRML 97 format file. This format was selected as it can be read in by Adobe Acrobat 3D and embedded in Portable Document Format (PDF) files. See the section on 3-d PDF for more information.

We also use the VRML export capability of S2PLOT to produce content for the freely available S2PLOT Flash player, s2web. A syntax-only translation using the NIST-provided Vrml97ToX3dNist yields an X3D file from the S2PLOT-exported VRML, and the 3-d scene in the X3D file can be read and displayed by s2web. Camera control and interaction with the scene in the s2web application is almost identical to that in a native S2PLOT program. Volume rendering, billboards, handles and frame-based animation are all supported.

The s2web functionality of S2PLOT is documented in the first paper below. If you use s2web to embed S2PLOT content in a web page, please cite or acknowledge one of these sources:

  • Fluke, C.J., Barnes, D.G., Jones, N.T., 2008, "Interchanging Interactive 3-d graphics for Cosmology", submitted to PASA, Oct 2008
  • Barnes, D.G., Fluke, C.J., Bourke, P.D., Parry, O.T., 2006, An Advanced, Three-Dimensional Plotting Library for Astronomy, PASA, 23, 82 - (ADS) (astro-ph/0608245)

Requirements

  • S2PLOT version 2.02 or higher
    • version 2.4 or higher recommended
    • S2PLOT is freely available for non-commercial and educational use
  • A program for converting TGA image files to PNG image files
    • ImageMagick's convert is recommended; ImageMagick is free software.
  • s2web version 0.1 or higher
    • s2web is freely available for non-commercial and educational use
  • The VRML97 to X3D converter (Vrml97ToX3dNist) from the National Institute of Standards and Technology
    • Vrml97ToX3dNist is freely available
  • The perl script s2plot-vrml2x3d.pl for post-processing S2PLOT-exported VRML and converting to X3D using Vrml97ToX3dNist
    • s2plot-vrml2x3d.pl is freely available and included with S2PLOT versions after (not including) 2.4. It is also available from the peripheral downloads section of the S2PLOT website

VRML export from S2PLOT

Most S2PLOT geometry can be written to VRML format. While running an S2PLOT program, simply press Shift-W and a file called "test.wrl" will be written. It will overwrite any pre-existing "test.wrl" file in the current working directory.

Please see the section on 3-d PDF for specific hints about VRML export.

Texture conversion

S2PLOT writes textures in TGA image format, with the name convention vrml-texNNN.tga. It is necessary to convert these textures to PNG format prior to use of the S2PLOT-exported VRML. Textures are named in the output VRML file so that the necessary conversion is from vrml-texNNN.tga to vrml-texNNN.tga.png. This conversion can be accomplished with ImageMagick's convert program or almost any other image editor or converter.

Creating X3D and the ZIP archive

The s2web Flash program expects to be provided with a ZIP file that contains one X3D file, plus required textures in PNG image format.

X3D is a syntactic variant for VRML 97 for the purposes of this document. The National Institute of Standards and Technology provides a free VRML to X3D converter: NIST-provided Vrml97ToX3dNist. A script (s2plot-vrml2x3d.pl) is available that post-processes the S2PLOT-exported VRML and then executes the conversion to X3D using Vrml97ToX3dNist. Typical usage of this script would be as follows, after conversion of textures from TGA to PNG format:

  • s2plot-vrml2x3d.pl test.wrl

The s2plot-vrml2x3d.pl script does three important tasks at this stage:

  1. it removes any lineProperties tags from the VRML (these tags [rightly] offend Vrml97ToX3dNist)
  2. it duplicates any textures that are used more than once in different colours (eg. as is frequently done for splats)
  3. it converts the post-processed VRML to X3D format

The output X3D file and textures (which are now named by convention duptexNNNNN.png) are now simply zipped up into a single compressed bundle. By convention, it is recommended that the X3D file have the same base name as the zipped archive. For example, the X3D file mys2plot.x3d should be placed in a ZIP file (with any required textures) named mys2plot.zip.

Deploying on the Web

Deployment of the s2web application on a web page with your custom S2PLOT visualisation is relatively straightforward. Download the template web files from the peripheral download area, and extract them to a directory on your webserver. Add your ZIP file created above to the same directory, and optionally, a preview image in PNG format. The preview image will be shown blurred and dimmed when the s2web application is inactive.

Modify the provided index.html file according to the instructions within. This entails substituting occurrences of "s2test" with the name of your zip file and/or preview image. Once you have done this you should be able to navigate to the directory and view the visualisation in a Flash-enabled browser.

Flash Support in Browsers

The s2web application requires Flash Player version 9 or greater, and appears to work well on Windows, Macintosh and 32-bit Linux computers. To view Flash content on a 64-bit Linux computer requires you install a 32-bit browser, and then the 32-bit Flash Player within that browser, as there is no 64-bit Flash Player for Linux at the time of writing.

Personal tools