Jump to content
  • Advertisement
Sign in to follow this  
Ionia

Getting texture from problem collada file... non-server-crashing-version

This topic is 2910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm writing a game engine. I'm loading collada files with Collada DOM and I've got geometry loading working already.

It looks like the easiest way to get all the data necessary in most collada files is through <instance_geometry> in <library_visual_scene> (see below for an example). I've got one model from the Collada Test Model Bank (click the links for anonymous access, public section, basic examples, Seymour, Seymour.dae) that doesn't have an instance_geometry element anywhere. There also doesn't appear to be anything outside of excruciating pain linking the geometry to the materials and textures. Am I just missing something obvious or is this a freak file?

For most "normal" collada files, you should be able to do it this way:

-Start at <library_visual_scenes>
-Go through the <node>s
-Find one with <instance_geometry> and use the url attribute there to get to the actual geometry
-Continue through the <node> until you hit <instance_material> and its target attribute, which gives you the material and texture.

Here's a snippet of the "normal" dae to follow along with:

<library_visual_scenes>
<visual_scene id="VisualSceneNode" name="untitled">
<node id="LOD3sp" name="LOD3sp">
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<instance_geometry url="#LOD3spShape-lib">
<bind_material>
<technique_common>
<instance_material symbol="blinn3SG" target="#blinn3">
<bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_geometry>
</node>
<node id="camera1" name="camera1">
<translate sid="translate">400.113 463.264 -431.078</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 -223.2</rotate>
<rotate sid="rotateX">1 0 0 -38.4</rotate>
<instance_camera url="#cameraShape1"/>
</node>
<node id="directionalLight1" name="directionalLight1">
<translate sid="translate">148.654 183.672 -292.179</translate>
<rotate sid="rotateZ">0 0 1 -12.8709</rotate>
<rotate sid="rotateY">0 1 0 -191.679</rotate>
<rotate sid="rotateX">1 0 0 -45.6358</rotate>
<instance_light url="#directionalLightShape1-lib"/>
</node>
</visual_scene>
</library_visual_scenes>




Also, I apologize for totally destroying all life on earth with my first attempt at this...

[Edited by - Ionia on July 3, 2010 5:05:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
After much staring and following nodes jumping around I think I figured it out. Unfortunately, it does follow a different path than the one I'm currently using, but I don't think it'll be as painful as I originally thought. I'll have to go down that path to get animations working anyways, so it won't be wasted effort just to make sure one freakish file loads, at least.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!