My favorites | Sign in
o3d
Project Home Downloads Wiki Issues Source
Search
for
ColladaConverter  
This page describes how to use the COLLADA file converter, which allows you to import files created using Google SketchUp, Autodesk 3ds Max, and Autodesk Maya into the WebGL implementation of O3D.
Updated May 7, 2010 by jos...@google.com

Converting and Loading COLLADA Models

The O3D sample COLLADA converter, described in detail in Importing Scene Files, has been extended to support the WebGL implementation of O3D. New command line arguments cause the output assets to be written into a directory containing a set of flat files that can be used directly by a Web browser. This document describes the changes to the converter and the model loading process.

Command syntax

The command to run the converter is o3dConverter, with arguments as specified below.

  • --no-condition
  • --up-axis=x, y, z
  • --/your_path/your_filename.zip
  • --/your_path/your_output_directory.o3dtgz
  • --no-binary
  • --no-archive
  • --convert-dds-to-png
  • --convert-cg-to-glsl

where

--no-condition
Prevents conditioning of the shaders from COLLADA form to the form expected by O3D. Use this option if you know that the shaders have already been conditioned. Otherwise, omit it.

--up-axis=x, y, z
Specifies the x, y, and z values for the up axis in the model file.

--/your_path/your_filename.zip
Specifies the path to the COLLADA file to be converted (or to the .zip archive containing the file).

--/your_path/your_output_directory.o3dtgz
Specifies the output path. If you specify --no-archive, the output is actually written to output_directory rather than to the archive output_directory.o3dtgz.

--no-binary
Puts all vertex and index data directly into the scene.json file

--no-archive
Writes multiple files into one directory instead of producing an .o3dtgz archive. (Note that with this command line argument, the converter takes an .o3dtgz file name as the output path but does not actually write out an archive.)

--convert-dds-to-png
Converts textures in the DirectDraw Surface file format to PNG, a Web standard.

--convert-cg-to-glsl
Converts all Cg shaders to GLSL format, using the cg-to-glsl converter script.

Example invocation

The following command line converts the O3D teapot asset into a format compatible with the WebGL implementation of O3D:

 o3dConverter --no-condition --up-axis=0,1,0 --no-binary
--no-archive --convert-dds-to-png --convert-cg-to-glsl
../o3dassets/samples/convert-assets/teapot.zip
../samples/assets/teapot.o3dtgz

The first two command line arguments, --no-condition and --up-axis, are identical to those used when converting this asset for use with the plug-in implementation of O3D. ../o3dassets/samples/convert-assets/teapot.zip specifies the path to the COLLADA file or, in this case, the .zip archive containing it. ../samples/assets/teapot.o3dtgz specifies the output path. Note that because the --no-archive command line argument is specified, the output is actually written into the directory ../samples/assets/teapot/ rather than to the file teapot.o3dtgz.

Loading the converted model

To load the converted model in the WebGL implementation of O3D, simply pass the URL of the converted scene.json rather than the .o3dtgz file to o3d.ArchiveRequest.open. See the helloworld.html O3D/WebGL sample for a simple example of how to load and display a model.

Comment by kaptk...@kaptkaos.org, May 21, 2010

I cant get this sample page to work in either FireFox? 3.7a5 or the latest Chrome. I am able to view O3D samples in both browsers, but I suspect somethign specific to this page is causing problems. I keep getting a error page that says the following:

'WebGL context unavailable. Make sure you are using a WebGL capable browser and WebGL is enabled. Click here for more information:

http://www.khronos.org/webgl/wiki/Getting_a_WebGL_Implementation'

Any ideas will be greatly appreciated!

Comment by net...@gmail.com, Jul 18, 2010

jeff , did you have the plugin version installed, perhaps you were capable to run only those demos using the plugin version... as for your problem itself, not sure if this will help but i just tried the webgl version demos with chrome on linux and works just fine, the thing is: i had to use this command: google-chrome --enable-webgl otherwise the same error as yours appeared to me. so give it a try!

now, a question of mine: i was just wandering if there is a linux version of the collada converter or i'm stuck on windows for development purposes, meaning linux is just left for testing? ( without neither sketchup nor dazstudio on linux i wouldn't even try setting up a linux development enviroment ... just wandering you see? :) )

Comment by m.recupe...@gmail.com, Jul 25, 2010

the example don't work! I've a javascript error! why?

Comment by m.recupe...@gmail.com, Jul 25, 2010

archive_request.js:162 SyntaxError?: Unable to parse JSON string (browser Safari webkit)

Comment by saied....@gmail.com, Oct 19, 2010

I have the same problem. I have converted a COLLADA Model with the converter and replaced the teapot in helloworld.html with the new model. When I run helloworld.html in Webkit (Nightly Build), the model is not shown.

Comment by preks...@gmail.com, Mar 1, 2011

I am not able to load and display a local .dae file in google chrome 9.0. it works well when loaded through server..

Comment by i...@posh.de, Mar 2, 2011

check if the path definitions in the JSON are corrupted by using "\\" instead of the correct "/".

Comment by dyk...@gmail.com, Jun 23, 2011

the helloworld.html link above is broken, does anyone know where it is supposed to go?

Comment by iqq...@gmail.com, Oct 12, 2011

Will there be a Collada-to-JSON converter for Linux?


Sign in to add a comment
Powered by Google Project Hosting