Load Textures in Collada 1.5

#1

I am working on a research project where we run simulations on openrave. I downloaded collada models from 3dwarehouse sketchup site The dae files were in 1.4.1 format and I am trying to convert them to 1.5.0 (since openrave works with 1.5)

I am using xmllint to validate the dae file with the collada specification (schema.xsd) and this is the output I get

$ xmllint --noout --schema schema.xsd floor15.dae
output.dae:130: element sampler2D: Schemas validity error : Element '{collada 2008 03 COLLADASchema}sampler2D': Character content is not allowed, because the content type is empty.
output.dae:130: element sampler2D: Schemas validity error : Element '{collada 2008 03 COLLADASchema}sampler2D': Element content is not allowed, because the content type is empty.
output.dae fails to validate

From what I understand, the element can have either Character or Element content. If both are not allowed what do I even add here??

I’ve tried going through the specification (collada_spec_1_5.pdf) and fixing the sampler2D node but have had no success.

I tried using this converter (github metaleap go-collada tree master conv-1.4.1-to-1.5) written in Go to convert the original collada file I downloaded from 1.4.1 to 1.5 but that gives me the same errors above.

Google drive link to files:
drive folders 1fHyoXQB5vKJMUv_BgoAZC8Ol-vfiFwV9?usp=sharing

#2

I’ve looked at OpenRave before, looking for test files. It used COLLADA-DOM 2.4. It needs 1.5 for kinematics. Its implementation is very crude, so I wouldn’t worry about validating your files. I wouldn’t expect too much either. (That was some time ago, but I imagine its code is unchanged, especially since nothing else implements kinematics.)

I’ve worked on upgrading COLLADA-DOM significantly, and the person who worked on OpenRave I dealt with some in the beginning:

Rosen Diankov (patches for 1.5, cmake support, collada namespaces, github maintenance)

OpenRave has a robots pack, which is why it has COLLADA in the first place. It’s very peculiar to its implementation of COLLADA. I think it has its own model format, and it is converted from that to its COLLADA format.

I can try to help you around your element if you copy/paste some of the XML code. Or I can look at a file at a regular download link. sampler2D has elements in both versions, so your schema setup may be to blame. But I would not worry about validation. COLLADA is not a mature technology. I’m trying to develop it for noncommercial applications, because it seems like the best place to start, but only because there is no real alternative, and it suits me.

This link used to be in my signature, in the old forum:
https://www.khronos.org/collada/wiki/ColladaDOM_3

#3

Thanks. Below is the xml for one of the models i’m working with.
My main concern is just to get the textures working. The validator helped me point out that there is something wrong with the xml elements. Until then it was all a black box for me.

I am not able to add links. This is the trailing url for a google drive link for all files you might need to replicate this issue: /drive/u/1/folders/1fHyoXQB5vKJMUv_BgoAZC8Ol-vfiFwV9

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<COLLADA xmlns="http://www.collada.org/2008/03/COLLADASchema" version="1.5.0">
    <asset>
        <contributor>
            <authoring_tool>SketchUp 19.2.222</authoring_tool>
        </contributor>
        <created>2019-09-24T04:41:12Z</created>
        <modified>2019-09-24T04:41:12Z</modified>
        <unit meter="0.0254" name="inch" />
        <up_axis>Z_UP</up_axis>
    </asset>
    <library_cameras>
        <camera id="ID1" name="skp_camera_Last_Saved_SketchUp_View">
            <optics>
                <technique_common>
                    <perspective>
                        <yfov>35</yfov>
                        <aspect_ratio>0</aspect_ratio>
                        <znear>1</znear>
                        <zfar>1000</zfar>
                    </perspective>
                </technique_common>
            </optics>
        </camera>
    </library_cameras>
    <library_visual_scenes>
        <visual_scene id="ID2">
            <node name="SketchUp">
                <instance_geometry url="#ID3">
                    <bind_material>
                        <technique_common>
                            <instance_material symbol="Material2" target="#ID4">
                                <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                            </instance_material>
                            <instance_material symbol="Material3" target="#ID15">
                                <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                            </instance_material>
                            <instance_material symbol="Material4" target="#ID16">
                                <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                            </instance_material>
                        </technique_common>
                    </bind_material>
                </instance_geometry>
                <node name="skp_camera_Last_Saved_SketchUp_View">
                    <matrix>-0.6130583 -0.2805412 0.7385501 6392.782 0.7900377 -0.217696 0.5731046 6675.334 -5.551115e-17 0.9348289 0.3550984 2700.077 0 0 0 1</matrix>
                    <instance_camera url="#ID1" />
                </node>
            </node>
        </visual_scene>
    </library_visual_scenes>
    <library_geometries>
        <geometry id="ID3">
            <mesh>
                <source id="ID9">
                    <float_array id="ID18" count="36">1853.365 -1076.018 -240.6876 -1823.431 5667.582 -345.2971 -2996.138 -87.91088 -345.2971 3026.072 4679.475 -240.6876 3026.072 4679.475 -240.6876 1853.365 -1076.018 -240.6876 -1823.431 5667.582 -345.2971 -2996.138 -87.91088 -345.2971 -2996.138 -87.91088 -345.2971 1853.365 -1076.018 -240.6876 3026.072 4679.475 -240.6876 -1823.431 5667.582 -345.2971</float_array>
                    <technique_common>
                        <accessor count="12" source="#ID18" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID10">
                    <float_array id="ID19" count="36">-0.02070671 0.004219083 0.9997767 -0.02070671 0.004219083 0.9997767 -0.02070671 0.004219083 0.9997767 -0.02070671 0.004219083 0.9997767 0.02070671 -0.004219083 -0.9997767 0.02070671 -0.004219083 -0.9997767 0.02070671 -0.004219083 -0.9997767 0.02070671 -0.004219083 -0.9997767 0 0 0 0 0 0 0 0 0 0 0 0</float_array>
                    <technique_common>
                        <accessor count="12" source="#ID19" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID11">
                    <Name_array id="ID21" count="0" />
                    <technique_common>
                        <accessor count="0" source="#ID21" stride="1">
                            <param name="skp_material" type="Name" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID13">
                    <float_array id="ID20" count="8">38.01813 112.5189 -288.3013 -162.495 38.01813 -162.495 -288.3013 112.5189</float_array>
                    <technique_common>
                        <accessor count="4" source="#ID20" stride="2">
                            <param name="S" type="float" />
                            <param name="T" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="ID12">
                    <input semantic="POSITION" source="#ID9" />
                    <input semantic="NORMAL" source="#ID10" />
                </vertices>
                <triangles count="2" material="Material2">
                    <input offset="0" semantic="VERTEX" source="#ID12" />
                    <input offset="1" semantic="TEXCOORD" source="#ID13" />
                    <p>0 0 1 1 2 2 1 1 0 0 3 3</p>
                </triangles>
                <triangles count="2" material="Material3">
                    <input offset="0" semantic="VERTEX" source="#ID12" />
                    <p>4 5 6 7 6 5</p>
                </triangles>
                <lines count="4" material="Material4">
                    <input offset="0" semantic="VERTEX" source="#ID12" />
                    <p>8 9 9 10 10 11 11 8</p>
                </lines>
            </mesh>
        </geometry>
    </library_geometries>
    <library_materials>
        <material id="ID4" name="Metal_Seamed">
            <instance_effect url="#ID5" />
        </material>
        <material id="ID15" name="material">
            <instance_effect url="#ID14" />
        </material>
        <material id="ID16" name="edge_color000255">
            <instance_effect url="#ID17" />
        </material>
    </library_materials>
    <library_effects>
        <effect id="ID5">
            <profile_COMMON>
                <newparam sid="ID8">
                    <sampler2D>
                        <instance_image url="#ID6"/>
                    </sampler2D>
                </newparam>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <texture texture="ID8" texcoord="UVSET0" />
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
        <effect id="ID14">
            <profile_COMMON>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <color>0.6705882 0.6901961 0.8 1</color>
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
        <effect id="ID17">
            <profile_COMMON>
                <technique sid="COMMON">
                    <constant>
                        <transparent opaque="A_ONE">
                            <color>0 0 0 1</color>
                        </transparent>
                        <transparency>
                            <float>1</float>
                        </transparency>
                    </constant>
                </technique>
            </profile_COMMON>
        </effect>
    </library_effects>
    <library_images>
        <image id="ID6">
            <init_from><ref>Metal_Seamed.jpg</ref></init_from>
        </image>
    </library_images>
    <scene>
        <instance_visual_scene url="#ID2" />
    </scene>
</COLLADA>
#4

You’ll have to give me straightforward instructions to access your files.

I don’t see anything wrong around your sampler2D element or its surroundings. I think 1.5 is a little different in this regard. It’s mostly unchanged from 1.4.1, which is actually not a good thing, since there are lot of problems and errors in 1.4.1. There is a list of changes in the manual.

I think your validator is mistaken. Anyway, sampler2D is not an empty content-model element.

EDITED: See if you can post links now. I think your account was suspect as a brand new user account.

#5

Can you double check that your XSD (Scehema) is same as the original one (you can grap that from khronos page)

To convert COLLADA 1.4/1.4.1 to 1.5;

  • AFAIK, the <image> is different a bit at 1.5
  • The <surface> doesn’t appears at 1.5

Don’t forget that <init_from> has extra element at 1.5 which is <ref>, so this may cause to get wrong image url which will prevent to load texture. This <ref> element does not present at 1.4.

I’m also converting 1.4 to 1.5 and get expected results. I have just migrated the <surface> element into the new <image> element which is very simple to do, I think.

Just try to follow the changes from 1.4 to 1.5, there is a PDF about release notes.

#6

I am still not able to post links. You can replace the ‘@’ symbols with ‘.’ and the link should work. drive@google@com/drive/u/1/folders/1fHyoXQB5vKJMUv_BgoAZC8Ol-vfiFwV9

I went through the manual but I haven’t been able to figure out what is going wrong in my case. Could it be that the issue with textures is inside openrave and not the dae file?

@recp I got my xsd file from the khronos page itself. I have used the < ref > tag for <init_from>
Would you have an example of the conversion you performed? Might be helpful

#8

Your files work for me, except the UV map has unusual values (38.01813 112.5189 …) so I can’t say if the image is working or not. I don’t get any errors reported from the COLLADA-DOM reference implementation I’m responsible for.

(I deleted an earlier post that had some erroneous findings. I’m hoping making a new post will avoid confusion. The floor_orig file has the JPG in a “floor” folder.)

#9

Would have a sample of UV map values that I could use? I have no clue what they mean.
Are you able to load it in openrave?

I am aware of the floor folder path. I’ve tried various combinations (placing it in the floor folder, placing it along .dae file, providing full file path, file:// uri) but none worked.

#10

Texture coordinate value space is between 0 and 1 if not wrapping. That doesn’t look like how yours work. Unless that floor is gigantic, and the texture repeats over it hundreds of times. In that case you have to scale down to the size of ant to see your texture. Typical viewing software may not be able to get that close.

EDITED: I don’t use OpenRave. But I think it’s for developers right? In which case, debugging it is your best bet.

#11

I gave up on trying to load them in openrave and I am not loading it in gazebo with the 1.4 format dae files. I can see the textures load fine in gazebo but as you said the textures are being repeated over hundreds of times and I need to scale down to view them.

In this case, is changing the scale of the models the only way to fix the texture repetition?

#12

No, the scale is unrelated to texture coordinates. It’s funny. The software that modeled it probably uses pixels instead of 0~1 scale, but in that case the export should have converted it. This isn’t a general help forum… or at least as you can see, there aren’t many people here. I think this forum is more for programmers needing help implementing COLLADA than support for modeling software or even writing COLLADA documents (that is not normally done by hand. I mean, you can’t usually fill out a UV map by hand. You need software. And those software have their own help forums.)

EDITED: I don’t recall seeing any models with textures in OpenRave’s robot pack. It’s possible it doesn’t implement textures. It is is a pretty sketchy library. Takes a lot of work to set up no doubt, and be prepared for tribulations.

1 Like