Game Development Community

Collada Models From Sketchup--No textures

by Robert Rice · in Torque 3D Professional · 07/01/2009 (9:40 pm) · 7 replies

Trying to load some Collada models from Google Sketchup; getting grey models in engine instead of textured. This is in the console for all of the missing textures.

"Material - model_material_22_39_8(3532) - Failed to load diffuse map ../images/texture38 for stage 0"

Does the power of 2 rule still apply for torque textures? I think that is what the problem is.

#1
07/01/2009 (10:11 pm)
Robert,

What I did to fix that for my testing was to copy the textures into the same directory as the Collada (DAE) file. Then I edited the materials.cs file and removed the "../images/" from every line that has it.

After restarting, all my materials showed up.

Craig
#2
07/01/2009 (10:24 pm)
Strange...I swear I had tried that before. But, I did it at your advice and and worked. Thanks!
#3
07/02/2009 (1:30 am)
Hi Robert,

It looks like you can't use relative paths for textures in Material object definitions. I'll make sure that the Collada loader does not generate these sort of paths in the future.
#4
07/02/2009 (2:14 am)
No its how sketchup exported collada files work. When you extract them from their locations in the KZM file you have to modify the collada .dae file to show their new location. If you take out the ../images/ then you are telling the collada file to look in the current directory for its images. If you tell it /images/ then you tell it to look in a directory one up called images from where you currently are. I personally just moved the collada files into their own folder appropriately names and took out the ../images/ and changes the image name. For example,

My Collada Shape was named "Tester"
so Tester.dae

It had 3 material files
Material0

Material1

Material2

I renamed those to follow my convention

Tester0.png

Tester1.png

Tester2.png

I opened the Collada file Tester.dae

I took out the ../images/Material and left the number
I then put in just before the number Tester
So it looked like Tester0, etc.
#5
07/02/2009 (6:40 pm)
Actually, there are 2 quite separate issues here:

1. When you unzip a Sketchup model, you get the following layout:

shapes
+-my_shape
  +-doc.kml
  +-textures.txt
  +-images
    +-my_texture1.jpg
    +-my_texture2.jpg
    +-....
  +-models
    +-my_shape.dae

There's no reason you can't leave the texture files where they are. It is not a requirement that they be in the same folder as the model itself.

When the Collada loader generates the materials.cs script, it tries to be clever and use the relative (to the shape file) path "../images/my_texture1". This is not right. It should set the absolute path "shapes/my_shape/images/my_texture1". This will become more important when the ResourceManager once again supports loading models directly from inside ZIP/KMZ files.


2. Quite separately, Sketchup exports its materials with generic names like Material0, Material1 etc. It makes sense to rename these in the DAE file to something more unique so you don't get name clashes with other Sketchup shapes.
#6
07/20/2009 (8:54 pm)
Huum wish i had read this before i spent all that time to find it out my self :) Ok so Does anybody have a problem with collision with the models exported from sketchup 6? My actor is getting stuck in the models.

Thanks
#7
07/20/2009 (9:01 pm)
Yes. It's happening for me in Beta 3 & 4. I was told that there are too many triangles in a small area.

I haven't been able to determine how to fix this.

Craig