0

Problem loading .3ds file with texture

Anonymous 6 years ago updated by vester 4 years ago 1
This discussion was imported from CodePlex

bdeldri wrote at 2014-08-13 22:09:

Hi,

I am trying to load a simple .3ds file with a texture that I exported from Blender. It appears to read some garbage into the texture image name here (StudioReader.cs):
                case ChunkID.MAT_MAP:
                    texture = this.ReadMatMap(reader, size - 6);
                    break;
Then when it tries to load the image, it borks with "System.ArgumentException: Illegal characters in path".

I'm not familiar enough with the .3ds format to know if this is a problem with the reader or with the model, but it does seem to load fine in the OpenSceneGraph viewer.

I have the file and texture available if that would help, but I'm not sure how to attach them to this discussion (if that is even possible).

Thanks!

This is an error in their ReadMatMap.

The 3DS format has more capabilities than they import.. Change the function to this, and it will work:

private string ReadMatMap(BinaryReader reader, int size)

{
string cname = "";
while (size > 0) //search for A300
{
var id = this.ReadChunkId(reader);
int siz = this.ReadChunkSize(reader);

if (id == ChunkID.MAT_MAPFILE)
{
size -= 6;
cname = this.ReadString(reader);
size -= cname.Length + 1;
}
else
{
this.ReadData(reader, siz - 6);
size -= siz;
}
}
return cname;
}