Cannot import 3ds-models into irrlicht

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Cannot import 3ds-models into irrlicht

Post by suliman »

Hi
If i add any material, the mesh doesnt work in irrlicht. Let me explain.

I use 3d studio max 2013. Create a box and export as 3Ds-file
In irrlicht i use

Code: Select all

rrr.unitMeshes[15] = gfx.smgr->getMesh("gfx/model/tank.3ds");
It works fine. I can see the box and it can be detected with collision etc.

HOWEVER
I create a box. AND add any material (such as a color, not even texture, although adding a texture-material also means this problem). Export as 3Ds.
Load it the same way in irrlicht (the pointer does become something, its not zero as when not finding a file)
Now the mesh cannot be seen, nor can it be detected.

(if i open the exported 3ds-file with material everything seems fine, scale is the same etc)

What can be wrong?
Thanks
Erik
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Cannot import 3ds-models into irrlicht

Post by Asimov »

Hi suliman,

I am very new to irrlicht also, and I did start by using the 3ds format exported from 3ds max 2015, but after some help from mongoose I realised that the obj format is better for exporting to.
It makes an mtl file, and obj file and saves the textures in a folder.

When you load it in you don't have to specify the textures either.

So I would try obj if I was you
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Cannot import 3ds-models into irrlicht

Post by Mel »

Keep an eye on the units set up. First, 3DSMAX units use to be inches, which is 2.43 units or so, thus if you create a box, say, 200x200x200 inches it is actually 4860x4860x4860 units long. Irrlicht's unit system is, more or less, 1unit = 1 metter, so your box would be larger than some game's whole world! but in the last instance, it is fully configureable.

Second: Don't use 3DS to export meshes from MAX. Irrlicht doesn't read the smoothing groups (yet...) and i doubt it will ever do. Use the gw::obj exporter instead, it produces very good results, and exports the smoothing groups in a way Irrlicht understands.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Cannot import 3ds-models into irrlicht

Post by suliman »

Thanks!
This works better it seems. Just a question (totally not related to irrlicht but 3d studio max). Do you know why this happens?

http://sv.tinypic.com/view.php?pic=bevn ... Kq2yiuG_Pc

The tank (all objects comprising the tank) and the box has the same material. But the tank just has the general color but not the texture. Is it a different scale problem with the texture on the tank? How do i solve it? (its the same material so i thought the scale that looks good on the box would look the same on the tank).

Thanks again
Erik
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Cannot import 3ds-models into irrlicht

Post by Asimov »

Hi Suliman,

Is this a model you built?

I am only guessing, but have you unwrapped the model uvs?

Perhaps you can show your uv map.

If your model has not been properly unwrapped the pattern or texture could go anywhere, or be stretched or whatever.
If you can answer the first two questions I am sure I can help.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Cannot import 3ds-models into irrlicht

Post by suliman »

nope found the model online. Its probably not unwrapped, i dont know what that is or how to fix it:)

I found the "uwv mapping clear" modifier, is that related? That doesnt seem to change anything though.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Cannot import 3ds-models into irrlicht

Post by Asimov »

Hi Suliman,

Unwrapping a model is something that takes time to learn, and I cannot explain how to do it in a short post like this.
If you select your model then add a modifier. The modifier you want is called Unwrap UVW then click "open uv editor".

If your model has uvs it will be laid out nicely like this for instance
Image

If you do not see this, then it has not been unwrapped.
Once it is unwrapped you can use photoshop or gimp to add your texture.

I have found a beginner unwrapping tutorial for you, and if you get stuck, feel free to ask questions. I have been using 3ds max for 8 years now.
https://www.youtube.com/watch?v=9j47MS5arg0
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Cannot import 3ds-models into irrlicht

Post by suliman »

I guess so, but the video explains how to texture all sides individually and tricks like that. But all i need is each face textured like the surface of a box (or whatever) so the textures doesnt get stretched or rescaled. Is that not possible?

I found the UVW map modifier that i remembered using a long time ago. It solves some simple shapes (see image below). The left shape has the map applied and looks much better. I want something like this but for my tank obviously:)

http://postimg.org/image/7otow17ar/

Doing it with the tank does work to some extent though i have to apply it seperately to each shape. Or any other way to do it?

Isnt this what i need?
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Cannot import 3ds-models into irrlicht

Post by Asimov »

Hi Suliman,

You can select each face separately and apply a uvw map, and do it one face at a time.
That is a method I used to use a long time ago before I did uvw unwrapping.
Basically select a face, select uvw map and keep playing with the coordinates until the map fits.
Then collapse to editable poly and then move onto the next section.

When I first started I just applied a uvw map as you have tried, but using this method will always produce stretching on the opposing face.

Sometimes once I have completed a model, making the uvw map can take as long as building the model, but it is the only proper way to do it.
For instance if you just applied a texture to the whole tank, how do you add ambient occlusion to your texture?

Ambient occlusion is where you have dirty edges and darkness in hollows and gaps.

Also to make your tank realistic looking you will want to add wear in place where it would be scratched and stuff.

This uvw unwrapping is important if you want to get your texture looking nice.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Cannot import 3ds-models into irrlicht

Post by suliman »

Ok thanks for all the info, that makes sense!
Erik
Post Reply