1
$\begingroup$

I'd like to create some game assets that need to be exported in the Collada file format. I want to be able to create diffuse, normal and specular maps on my models and then export them to a single .dae file. Unfortunately, if I put multiple maps onto a single material, the Collada exporter does weird things.

If I put both a diffuse and a normal texture on a model, the collada exporter only exports the normal map (but connects it to the diffuse channel for some reason). I'm trying to figure out a way to configure my materials/images so that the diffuse map is exported in the diffuse channel, the normal map is in the normal channel, and so on.

Has anyone found a good way to do this?

Here's a blender scene that I've been using to test the exporter.

And here's the result:

<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor>
      <author>Blender User</author>
      <authoring_tool>Blender 2.72.0 commit date:2014-10-21, commit time:11:38, hash:9e963ae</authoring_tool>
    </contributor>
    <created>2014-12-30T15:05:37</created>
    <modified>2014-12-30T15:05:37</modified>
    <unit name="meter" meter="1"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_images>
    <image id="PresentBump" name="PresentBump">
      <init_from>PresentBump.png</init_from>
    </image>
  </library_images>
  <library_effects>
    <effect id="PresentMat-effect">
      <profile_COMMON>
        <newparam sid="PresentBump-surface">
          <surface type="2D">
            <init_from>PresentBump</init_from>
          </surface>
        </newparam>
        <newparam sid="PresentBump-sampler">
          <sampler2D>
            <source>PresentBump-surface</source>
          </sampler2D>
        </newparam>
        <technique sid="common">
          <phong>
            <emission>
              <color sid="emission">0 0 0 1</color>
            </emission>
            <ambient>
              <color sid="ambient">0 0 0 1</color>
            </ambient>
            <diffuse>
              <texture texture="PresentBump-sampler" texcoord="UVMap"/>
            </diffuse>
            <specular>
              <color sid="specular">0.5 0.5 0.5 1</color>
            </specular>
            <shininess>
              <float sid="shininess">50</float>
            </shininess>
            <index_of_refraction>
              <float sid="index_of_refraction">1</float>
            </index_of_refraction>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
  </library_effects>
  <library_materials>
    <material id="PresentMat-material" name="PresentMat">
      <instance_effect url="#PresentMat-effect"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="Cube-mesh" name="Cube">
      <mesh>
        <source id="Cube-mesh-positions">
          <float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-positions-array" count="8" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Cube-mesh-normals">
          <float_array id="Cube-mesh-normals-array" count="36">0 0 -1 0 0 1 1 -5.66244e-7 3.27825e-7 -4.76837e-7 -1 0 -1 2.08616e-7 -1.19209e-7 2.08616e-7 1 2.38419e-7 0 0 -1 0 0 1 1 0 -2.38419e-7 0 -1 -2.98023e-7 -1 2.38419e-7 -1.49012e-7 2.68221e-7 1 1.78814e-7</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-normals-array" count="12" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Cube-mesh-map">
          <float_array id="Cube-mesh-map-array" count="72">0.4999998 0.4999998 0.5 0.7499566 0.2500432 0.7499566 0.2500431 0.2500433 0.250043 8.67365e-5 0.4999996 8.65875e-5 0.7499566 0.4999998 0.7499567 0.7499566 0.5 0.7499566 0.5 0.9999132 0.2500433 0.9999134 0.2500432 0.7499566 0.2500432 0.7499566 8.65875e-5 0.7499566 8.65875e-5 0.5 0.4999998 0.2500432 0.4999998 0.4999998 0.2500432 0.5 0.2500432 0.5 0.4999998 0.4999998 0.2500432 0.7499566 0.4999998 0.2500432 0.2500431 0.2500433 0.4999996 8.65875e-5 0.4999998 0.4999998 0.7499566 0.4999998 0.5 0.7499566 0.5 0.7499566 0.5 0.9999132 0.2500432 0.7499566 0.2500432 0.5 0.2500432 0.7499566 8.65875e-5 0.5 0.2500431 0.2500433 0.4999998 0.2500432 0.2500432 0.5</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-map-array" count="36" stride="2">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="Cube-mesh-vertices">
          <input semantic="POSITION" source="#Cube-mesh-positions"/>
        </vertices>
        <polylist material="PresentMat-material" count="12">
          <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#Cube-mesh-map" offset="2" set="0"/>
          <vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
          <p>0 0 0 1 0 1 2 0 2 7 1 3 6 1 4 5 1 5 4 2 6 5 2 7 1 2 8 5 3 9 6 3 10 2 3 11 2 4 12 6 4 13 7 4 14 4 5 15 0 5 16 3 5 17 3 6 18 0 6 19 2 6 20 4 7 21 7 7 22 5 7 23 0 8 24 4 8 25 1 8 26 1 9 27 5 9 28 2 9 29 3 10 30 2 10 31 7 10 32 7 11 33 4 11 34 3 11 35</p>
        </polylist>
      </mesh>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="Scene" name="Scene">
      <node id="Cube" name="Cube" type="NODE">
        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
        <instance_geometry url="#Cube-mesh">
          <bind_material>
            <technique_common>
              <instance_material symbol="PresentMat-material" target="#PresentMat-material">
                <bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
              </instance_material>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#Scene"/>
  </scene>
</COLLADA>
$\endgroup$
  • $\begingroup$ Check the Texture Options section of this page. If it helps, or even if it doesn't, let us know! $\endgroup$ – VRM Dec 30 '14 at 19:00
  • $\begingroup$ I checked the page, but is isn't helping. (I've tried both of the second life export presets, along with checking some of the other texture export options.) It only exports the normal map in the diffuse channel. $\endgroup$ – kitfox Dec 30 '14 at 20:08
  • $\begingroup$ I'm not use how to do it myself, let me see if I can get someone else to help out. Go here. $\endgroup$ – VRM Dec 30 '14 at 20:15
1
$\begingroup$

Okay, I think I've solved it.

First of all, make sure all your textures have been assigned to a specific UV map under the Texture/Mapping/Map. If the map is a normal map, also check Texture/Image Sampling/Normal Map. Under Texture/Influence, make sure that one of these is checked (depending on the texture type):

  • diffuse map -> Diffuse/Color
  • normal map -> Geometry/Normal
  • specular map -> Specular/Intensity

Finally, when you export to Collada, make sure Texture Options/Include Material Textures is checked.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.