Canvas 3d JS Library

WebGL made easy!
  • rss
  • What is C3DL?
  • Download
  • Tutorials
    • Tutorial #1: WebGL Browsers
    • Tutorial #2: A simple scene
    • Tutorial #3: Callback
    • Tutorial #4: Models
    • Tutorial #5: Light effects
    • Tutorial #6: Picking
    • Tutorial #7: Materials
    • Tutorial #8: Particle Systems
  • Development News
  • Documentation
  • Community
  • Resources
  • Contact
  • About

DAE Scenegraph

Andor Salga | 2 November, 2008 | 14:58
We have code which parses collada/DAE files, but to a limited degree. The parser only extracts the geometry data. Therefore if a file is ‘simple’, it loads correctly since the scene graph has only one transform node. However if the collada file contains many transform nodes, each node with different geometry will be placed at the origin. This happens because we currently don’t have a scene graph which the transform nodes should be placed inside. I have started working on a scene graph and realized some of my earlier code must be reworked.

some general requirements:
  • Collada files must only be parsed once. Once the file is parsed there’s no reason it should be parsed again. Parsing is already slower than having the js arrays already defined, so it should be kept to the absolute minimum. We will know which files are parsed based on the path users provide, such as “models/plane.dae” or “dragon.dae”. It will be up to the user to prevent scenarios such as loading “models/plane.dae” and then loading “plane.dae” where both files are duplicates. In this case our checks will fail and the file will be parsed and loaded twice in memory.
  • Once a collada file is parsed, it will reside in a table as a scene graph uniquely identifiable by a pathname.
  • Loading models from collada files must be at least as easy as loading from JS arrays.
The implementation will resemble:

var plane = new Collada();
plane.init(“models/plane.dae”);

var plane2 = new Collada();
plane2.init(“models/plane.dae”);

It is likely that collada files will structure geometry using the scene graph, however users will probably not care. If they have a plane and want it to give it a linear velocity, they should not have to deal with the scene graph, so the following should be valid:

plane2.setLinearVel(makeVector(0,0,1));

This will be interpreted as giving the root node of the scene graph the linear velocity, so all the objects attached to the plane will move. If the user wants to rotate the plane’s propeller, they will have to deal with the scene graph since the propeller’s transform node is a child of the plane’s transform node.

// collada objects will have a scenegraph
var planesg = plane.getSceneGraph();

// all node’s will have a findNode() which will return the
// first node which matches the string specified by the user.
var propeller = planesg.getRoot().findNode(“propeller”).
propeller.setAngularVel(makeVector(0,0,0.001));

The issue with this is that the user must know the name of the node, but if they are doing things like moving the nodes in the graph, they would have to know at least that much.

The main issue I have implementing the scene graph is using inheritance, not surprisingly . I wanted to place simple methods like get/SetName() into an ‘abstract’ BranchNode class and have TransformNode and GeometryNode inherit it. The angular velocity transformations seemed to work when there was only one TransformNode with one GeometryNode, but when I created two TransformNodes, I had a some sort of infinite recursion as the browser got really busy and nothing was rendered. The TransformNode was supposed to push its matrix on the matrix stack and then call the base class (BranchNode) render(), but then the BranchNode just called transformNode’s render(). Without inheritance everything seems okay, until I resolve this I will have to go on without it.
Categories
c3dl development
Comments rss
Comments rss

« The Matrix Stack Namespaces and const »

4 responses

Where is the model/plane.dae file found? This is really interesting.

Mikl | 27 May, 2009 | 17:04

Where is the model/plane.dae file found? This is really interesting.

I got it from the COLLADA Test Model bank, http://www.collada.org/owl/

Andor | 28 May, 2009 | 9:20

I got it from the COLLADA Test Model bank,
http://www.collada.org/owl/

So I joined the test model bank and the

robert woodbury | 29 October, 2009 | 13:01

So I joined the test model bank and the only model of a plane I could find is really silly looking.
I need this for an educational purpose and so, it should look somewhat normal.

So I am back to trying to export the sketchup DAE of a plane from the library.. error after error.
Well thanks .

Hi Robert, Can you send me a link to the collada

Cathy Leung | 29 October, 2009 | 14:05

Hi Robert,

Can you send me a link to the collada file you are working with?

Cathy

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Videos

Demos

  • Asteroids-3D
  • RTS Prototype
  • Particle Systems Demo
  • Cross-Browser Orbiter
  • Mocap Demo With Spheres
  • Google Maps-3D

C3DL Development News

SceneCreator0.3

SceneCaster is an online application that allows people to create “spaces” which are 3d scenes on the browsers and share them which other.  It is free to sign up and relatively  easy easy to use. The main problems with SceneCaster are the requirements: The operating systems used are Windows XP or Vista and the browser [...]

WWW2010 in Raleigh

Yesterday Andor and I gave a talk at www 2010. It was about how mid level API’s can help web developers who may not wish to do extremely low level programming at the WebGL level achieve the 3D effects they want. The “slides” from our talk can be found here. The [...]

Tutorials

  • Tutorial #1: WebGL Browsers
  • Tutorial #2: A simple scene
  • Tutorial #3: Callback
  • Tutorial #4: Models
  • Tutorial #5: Light effects
  • Tutorial #6: Picking
  • Tutorial #7: Materials
  • Tutorial #8: Particle Systems

Documentation

Archives

Archives

C3DL Development News

Recent Comments

  • July 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • SceneCreator0.3
  • WWW2010 in Raleigh
  • Motionview
  • On the train to Mountainview
  • C3DL 2.0-WebGL and beyond
  • Preliminary WebGL RTS Game
  • Asteroids in 3D… and a bit of 2D
  • Another demo updated
  • Simplifying the Interface
  • Updating Demos
  • I'm encountering sim... - peter
  • I'm having the darnd... - Jeff
  • Excellent, I'm looki... - Some Funky Dude
  • Great demo! I was th... - Some Funky Dude
  • Hey, just wanted to... - Charles
  • keep it coming ve... - gero3
  • congrats on a great... - Paul Brunt
  • c++ not c# actually... - Cathy Leung
  • It's unbelievable ho... - Paul
  • Wow, now that's a co... - Andor Salga



Canvas 3d JS Library

©2007- 2010 Canvas 3d JS Library

Disclaimer: This website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
The Canvas 3d JS Library and Demos found on this website are licenced under the MIT License

Creative Commons License