PDA

View Full Version : Blender 2.42a problem


Anodos
8th Nov 2006, 06:29 PM
Hallo,

I cannot export .OBJ Files with Blender. I've tried out every option but everytime I import the .obj into SimPe I get the following error:

"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

Please help me. I made such a cool skull and want to import it into the game.

Anodos

WesHowe
8th Nov 2006, 11:33 PM
Well, I can't help a lot with Blender, but .obj files are text-based, meaning that you can open them in Notepad (or Wordpad or Word or ...) and look at them.

Not that editing them by hand is easy to do (or even easy to explain), But looking at the error message, the reason may be obvious after looking at it. There are a lot of variations and extensions people have added to the original .obj format, perhaps one was added in the last version that is not recognized by SimPE.

<* Wes *>

Lethe_s
9th Nov 2006, 08:40 AM
Anodos,
hm, I can't seem to find the screenshot I did for exporting objects with the newer blender
but the most important option, to avoid index out of range, is to click the 'normals' button
you should include uv (if you've made the map), normals and it might help to triangulate as well
the rest of the buttons can be left alone
here's some screenies from the latest blender, these are the settings I use, and I find they work well

Import (it's mostly important to stop undo the rotating, I don't know *what* they were thinking when they implemented that)

http://thumbs.modthesims2.com/getimage.php?file=405005

Export

http://thumbs.modthesims2.com/getimage.php?file=405007

Anodos
9th Nov 2006, 07:47 PM
Thanx for your answers but they didn't help.

I put the blender File and the obj file into my post.
Perhaps you can find out anything that could be wrong with the files.

Anodos

Sowee
10th Nov 2006, 02:44 PM
i think, the files aren't wrong, because i can open on Wings3D, possible its a bug of the blender3D

Numenor
10th Nov 2006, 09:53 PM
People usually think that the OBJ format is a standard, adopted by all the 3D editors. Well, this is not true; at least, there are many options that you can activate or deactivate in your 3d program that can make your OBJ file compatible or not with SimPE.

For instance, OBJ files created by Wings3D can't be imported directly into SimPe, because of the different file format. I use Wings, and every time I load my OBJ into UVmapper, then export them and lastly I import the OBJ into SimPE (UVmapper creates OBJ files perfectly compatible with SimPE).

I don't know if blender is affected by the same problem as wings...

PS: Your mesh is not UV-mapped, the OBJ file lacks completely the UVmap section.

MaryLou
11th Nov 2006, 11:32 AM
Anotos, your file doesn't work because, as explained by Numenor, it doesn't contain the UV-map, and also doesn't adopt the same OBJ format expected by SimPE.
If you open the OBJ file with Notepad (or any text editor), you will see:
http://thumbs.modthesims2.com/getimage.php?file=405973

As you can see, there is an "o" (object) at the beginning of the line, where a "g" (group) is expected; and also the name of the mesh is "duplicated" (Plane_Plane).

As for the duplicated name, so far I've never found a solution; but it's not important because when you import the OBJ in simPE you can Replace an existing mesh (keeping the name of the existing mesh), or you can anyway rename it in the Groups tab of the GMDC.
Sometimes, I manually edit the OBJ file, using the Notepad, and I delete the "_Plane" part of the name.

As for the "o" instead of the "g", this can be changed by modifying the Export options of Blender.

Here are the Import and Export options that I always use, and I've never had problems with them.

IMPORT OPTIONS

http://thumbs.modthesims2.com/getimage.php?file=405971

Be sure that are *deselected* the following options:

1) Import *.mtl - There is no need to import the materials for the mesh (they are stored in the separated *.mtl file, if it exists: SimPe doesn't create a .mtl file anyway)
2) Re-Use Existing - If the option 1 is deactivated, this one is of no use.
3) Rotate X90 - If selected, it will rotate your mesh along the X axis: useless and misleading :)
4) Edges - basically, this doubles the vertices for each edge: we don't need duplicated vertices.
5) Smooth all faces - This applies the standard smoothing to the whole mesh; it doesn't give accurate results, it's way better to apply the smoothing using UVmapper.
6) Create FGons - this option, too, increases the number of vertices.


EXPORT OPTIONS

http://thumbs.modthesims2.com/getimage.php?file=405972

While exporting, I activate/deactivate the options as follows:

1) Triangulate: OFF. there's no need to automatically triangulate the *whole* mesh while exporting. You should triangulate only the visible faces before exporting.
2) Normals: ON. You must activate this, because SimPE expects to find the Normals stored in the OBJ file (otherwise, it gives error).
3) Materials: YOU CHOOSE. I set it to ON because this way Blender exports the materials, that I cna then import in UVmapper. But SimPE ignores the exported materials, so you can safely set this option to OFF.
4) OBJECTS and OBJECT GROUPS: these are the options that set the "o" and the "g" in the OBJ file, as explained above. In order to create a OBJ file compliant with SimPE, you have to set OBJECTS to OFF (i.e. no "o" in the .obj file), and OBJECT GROUPS to ON (i.e. use the "g" instead).



UV-MAPPING
As said, your file lack completely the UVmap data, because no UVmap has been created for your mesh.
The best way to UV-map your mesh is to use UVmapper, also because the OBJ files exported by UVmapper are perfectly compliant with SimPE (it uses the "g" and not the "o", and will fix your files, even if you exported it with the wrong options selected).
Anyway, Blender *has* a UV-mapping feature; I won't explain it here, because it would bee too long. But it's easy to include, in the exported OBJ file, at least a very basic uvmapping.
By default, Blender is in "Object Mode" (look at the selector located between the main preview window and the control panels below).
Set the selector to "UV Face select", and then look below, for a tab named "UV calculation": click it and be sure that the button "Draw Faces" is activated.
Then, go back to "Object Mode" and export the OBJ file activating/deactivating the options as explained above.

Anodos
11th Nov 2006, 01:52 PM
Thanx a lot to all of you.
I get the file to work but it has to many vertices and faces.
I try an easier Object like a table (because a table has less details).