Getting texture from problem collada file...

Started by
-1 comments, last by Ionia 13 years, 9 months ago
So I'm writing a game engine and I'm using Collada DOM to load collada files. I've already got the geometry data loading. My problem is I have one model I'm using to test that doesn't seem to have a clear association between the geometry and it's materials or textures.

Most of the models I'm testing with look like I can go through <library_visual_scenes>'s nodes, find ones with <instance_geometry> which will get me geometry data and below that they have <instance_material> with a target I can use to get the material and texture.

The problem child doesn't have <instance_geometry> anywhere. Is there some other method of getting the information I need that I'm just not seeing? I was thinking maybe I could look at the material attribute in <triangles>, but it doesn't match anything useful. I might be able to use the <instance_controller> url attribute and take a dozen steps through the animation data to find the damn geometry, but that looks way more painful than it should be. Is this just a freak occurrence? Am I on the right track with my idea up above with the working example?

I wanted to post examples, but it choked and died. Good thing I cut and pasted it before hitting show preview...

Here's an example of a "good" file:
<?xml version="1.0"?><COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">    <asset>        <contributor>            <author>gcorson</author>            <authoring_tool>Maya 8.0 | ColladaMaya v3.02 | FCollada v3.2</authoring_tool>            <comments>Collada Maya Export Options: bakeTransforms=0;exportPolygonMeshes=1;bakeLighting=0;isSampling=0;curveConstrainSampling=0;exportCameraAsLookat=0;exportLights=1;exportCameras=1;exportJointsAndSkin=1;exportAnimations=1;exportTriangles=0;exportInvisibleNodes=0;exportNormals=1;exportTexCoords=1;exportVertexColors=1;exportTangents=0;exportTexTangents=0;exportConstraints=1;exportPhysics=0;exportXRefs=1;dereferenceXRefs=0;cameraXFov=0;cameraYFov=1</comments>            <copyright>Copyright 2006 Sony Computer Entertainment Inc.Licensed under the SCEA Shared Source License, Version 1.0 (the&quot;License&quot;); you may not use this file except in compliance with theLicense. You may obtain a copy of the License at:http://research.scea.com/scea_shared_source_license.html Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an &quot;AS IS&quot; BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.</copyright>            <source_data>file:///C:/vs2005/sample_data/Complete_Packages/SCEA_Private/Maya_MoonLander/Moonlander/untitled</source_data>        </contributor>        <created>2006-08-23T22:29:59Z</created>        <modified>2007-02-21T22:47:42Z</modified>        <unit meter="0.01" name="centimeter"/>        <up_axis>Y_UP</up_axis>    </asset>    <library_cameras>        <camera id="cameraShape1" name="cameraShape1">            <optics>                <technique_common>                    <perspective>                        <yfov>37.8492</yfov>                        <aspect_ratio>1.5</aspect_ratio>                        <znear>1</znear>                        <zfar>10000</zfar>                    </perspective>                </technique_common>            </optics>        </camera>    </library_cameras>    <library_lights>        <light id="directionalLightShape1-lib" name="directionalLightShape1">            <technique_common>                <directional>                    <color>1 1 1</color>                </directional>            </technique_common>        </light>    </library_lights>    <library_images>        <image id="file2" name="file2">            <init_from>./duckCM.tga</init_from>        </image>    </library_images>    <library_materials>        <material id="blinn3" name="blinn3">            <instance_effect url="#blinn3-fx"/>        </material>    </library_materials>    <library_effects>        <effect id="blinn3-fx">            <profile_COMMON>                <newparam sid="file2-surface">                    <surface type="2D">                        <init_from>file2</init_from>                        <format>A8R8G8B8</format>                    </surface>                </newparam>                <newparam sid="file2-sampler">                    <sampler2D>                        <source>file2-surface</source>                        <minfilter>LINEAR_MIPMAP_LINEAR</minfilter>                        <magfilter>LINEAR</magfilter>                    </sampler2D>                </newparam>                <technique sid="common">                    <blinn>                        <emission>                            <color>0 0 0 1</color>            

This topic is closed to new replies.

Advertisement