Using 3ds files

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.
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Using 3ds files

Post by luckymutt »

Hi. I am new to IRRLICHT. I did some of the tutorials and I want to use 3dsmax for my buildings. In the tutorials they told how to use a quake map but is there any how tos for putting in a 3ds file?
In the MESHVIEWER.EXE, I could open a 3ds file, but it was all white.

thank you.
Jedive
Posts: 146
Joined: Wed Apr 28, 2004 5:51 pm

Post by Jedive »

Texture names must b ein old DOS 8.3 format, this is, a maximum of 8 characters for the filename and 3 characters for the extension.
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

So, when I make my structure in 3DS, I need to make sure everything, is in the 8char limit, save as a *.3ds, then when I want to implement it, i use something like:

Code: Select all

scene::IAnimatedMesh* mesh = smgr->getMesh("mymodel.3ds");
will this keep lighting effects, or is that what the other exporters are for.

Anyone know of any 3ds-specific documentation? 'cause I'm bound to have other questions that I can't find already in threads.

thanks,
Rober

Post by Rober »

I have the problem with 3ds-files, that the normals seem not to be imported to the irrlicht engine. Is this the same problem that you have, luckymutt? So the point light shades every polygon in a different brightness without blending between faces, which looks very "flat-shaded". Does anyone know how I can fix this?

Thank you

Robert
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

Well, I haven't exactly had a "problem" yet. I'm still trying to see exactly how to drop a 3ds model in.
I'm very new to this engine (about 6 hours now)
I was playing around with torque, but there is no direct way to go from 3ds into that engine.

What is the code you are using for importing your 3ds files?

If you are using 3ds's textures, you may have to rename them to keep with the DOS naming convention, as Jedive was explaining.
I'm gonna start a new folder just for the purpose of copying and renaming maps and textures, plus I make a lot of my own textures anyway.

I'm gong to stay up late tonight just working on getting the 3ds into IrrLicht they way i want them too.

@Rober: I'll take a close look at using normals and see what happens.
also, could this be a lighting issue with the normals?
Robert

Normals, Lighting Issue and Code for importing 3ds

Post by Robert »

Hi Luckymutt, I used the code from the tut, that is explaining how to import 3ds-files. I am not using textures yet, as I tried first shadows and lighting with a dynamic point light.

The code for importing 3ds-files is:

IAnimatedMesh* mesh = smgr->getMesh("../media/model.3ds");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);

I think that the imported 3ds-file is missing normals but I am not sure :o). But my rendering looks as if it is flatshaded, because normals are missing. If I import a obj-file created from Maya all is fine and smooth shaded, but I want to use Max :o). The exported obj-file from Max causes errors.

Maybe you find out how to solve this. I have read that version 0.8 of Irrlicht supports this code:

irr::scene::IMeshManipulator::createMeshWithTangents(mesh);

that means he makes a copy and creates normals. but it works not on an animatedmesh.

maybe you find something out. I will go sleep now 3 a.m. Middle European Time ;o).
Robert

Code

Post by Robert »

Forgot to place this two lines of code above, so that the other pointer smgr makes sense:

IrrlichtDevice *device = createDevice(EDT_DIRECTX9, dimension2d<s32>(512, 384), 16, false, true, false, 0);
ISceneManager* smgr = device->getSceneManager();

Additionally, I am a bloody beginner in C++ :( . Only worked with Java and Lingo before :D
Robert

Screenshot Flat Shaded Model

Post by Robert »

Image[/img]

Remark: Used no ambient light here on purpose.
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

I'm a little lost. I haven't found mcuh documentation on using 3ds format for IrrLicht.
I've been using 3dsmax for a while now, and can do quite a bit with it.
However, I've never had the need to Render to Texture, or "baking texture".

I made a box and cylinder similar to how you have yours, added a red texture to it, added an omni light, rendered to texture, exported as a *.3ds.
When I go to use it, all I get is white. I moved the *.tga files into the media folder with the model.3ds, recompiled, and still nothing but white.
What am I doing wrong?

I'd love to try and help you with the normals, but I'm having a tough enough time getting to where you are at.

Browsing the forums, I saw that afecelis had posted a link to a "how to" pdf last June, but the link is dead now.
Anyone know if that is still available anywhere?
Guest

Post by Guest »

Take a look at the Special FX example, it uses a 3ds for the room
and you can see how it's brought into the engine. If you are
using the viewer included with the engine be sure to select solid
in the materials selection under view menu, right next to help.
or your mesh will appear white, because it starts up in transparent
mode.
Guest

Post by Guest »

luckymutt, do you choose to "preserve max's textuer coordinates" when you go to export?
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

luckymutt, do you choose to "preserve max's textuer coordinates" when you go to export?
yeah, I do.
I got things showing up now.
I;ve never had to mess with the *.3ds format before, only done work with *.max scenes, animating within 3dsMax.

I now understand Roberts problem that he posted above in this thread.

When I Render to Texture before exporting the *.3ds file, I'm finding that I have to do some renaming to keep it all within the Old DOS convention the way Jedive was describing. Even still the *tga files seem to leave much to be desired.

So, now I'm trying to figure out how to get the texturing to come out better. Everything is quite flat. I think I need to try and work with the MY3D tool to get it to look any good. I need to try and compile it for max v.7
Also for things like windows and such.
Oh, and I need to be able to animate the doors. Nothing fancy, just opening when you walk up to them.

How about a new forum just for the modeling/creation aspect of things?
Guest

Post by Guest »

Maybe it is the same with the texture, that it looks flat? If the mesh is missing normal information for every vertex, than the light cannot be smoothed across the mesh and so you see every single face flat. So the texture will look like patchworked. In Max the mesh is smooth, but the import to irrlicht is losing this information.
That's my impression that I got on a textured character. Maybe I am wrong.

Robert
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

OK, either I'm very mistaken or I'm doing something very wrong.
I thought that after going through the Render to Texture baking in3dsMax, after it makes the *tga files for the baked textures, and then exporting as a *.3ds file, that everything would show up. That is, that the *.tga files just needed to be in the same location as the *.3ds...???
All I'm getting is a flat, muted color of my objects. Do I need to call up each and every tga file? I somehow thought that they went along for a ride with the 3ds file.
I'm getting the different colors, but I thought more info was baked into those tga's.

Is this more reason to use the MY3D exporter?
I use version 7 of max, but the machine I use doesn't have the sdk on it, so can't compile it myself.
Guest

Post by Guest »

Maybe post a picture, it may help.

3ds does work, see these shots.

http://legion.gibbering.net/mankind/Red.jpg
http://legion.gibbering.net/mankind/city.jpg

It may also help to know how you are loading them.
It can get frustrating when you want to do something and
no matter what you do it doesn't work. Been there too many times
myself.
Post Reply