3ds-model no texture...

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.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

3ds-model no texture...

Post by suliman »

Ive seen some problems with this on the forum but havent found a sollution that seems to work for me. Now i simply have (and the model is completely black):

Code: Select all

IAnimatedMesh * unitMeshes[100];
unitMeshes[1] = myScene->getMesh("gfx/model/plane.3ds");


//setup-craftNode
myCraft.node= smgr->addAnimatedMeshSceneNode( unitMeshes[1]);
myCraft.node->setMaterialFlag(video::EMF_LIGHTING,true);

driver->setAmbientLight(video::SColor(200,200,200,200));
Where my 3ds is done in 3dstudioMAX and the textures look good there and the texture files ar ein the same folder as the 3ds.

Should i use some other format or is 3ds supported? In that case, how to make the texture show?

Thanks a bunch
Erik
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Either add a light to your scene or set lightning to false !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

i set lightning to false and keep the ambientlight =
model is solid grey (same grey no matter the value on ambLight)

lightning true= the model is black

the ambientlight seem to do no difference at all (i try all combination with or without it)

I add a

scene::ILightSceneNode* light1 = smgr->addLightSceneNode(0, vector3df(0.0f,100.0f,0.0f), video::SColorf(1.0f,1.0f,1.0f),20.0f);

And that seem to actually cast light onto the model (if i set the node lightning to true of course) but the model is still untextured (all sides are white when lit).

1. Why isnt the textures showing on my model?
2. The light that actually works, doesnt change if i change its color or radius, shouldnt it?

Thanks
Erik
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should use the ambient light from scenemanager. And try with directx as well, there were some reports with problems regarding specular colors under OpenGL (you might also try to change the specular color to black).
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Hm, strange...
How does the names of the texture files look like ???
3ds supports only DOS file names (8.3) !!!

EDIT: oh, and if this is the case, then you don't have to texture the model new, just rename the files !!!
example: rename thisisatexture.bmp to thisisat.bmp
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

source\main.cpp(371) : error C2039: 'setAmbientLight' : is not a member of 'ISceneManager'

i use DX 9. Also tries DX8 and Open GL. Doesnt change.

stone.jpg
metal.jpg
alu.jpg

Still dont work. Im clueless... If 3ds dont work with irrlicht, should i change to another format? I need textures in my game :) I use 3dstudioMAX
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Hmm, really strange...
3ds is supported by Irrlicht and should work, also the texture names are in DOS format...

There are some exporters for Max, like Panda, for saving the mesh in DX format...

Maybe there's something wrong with the model/mesh ???
Could you please make a download for the mesh, so we can check if the mesh works (for us) ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
BlackCat
Posts: 3
Joined: Sun Dec 03, 2006 4:54 pm
Location: Minsk, Republic of Belarus

Post by BlackCat »

When I use C++ I can add 3ds model with lighting with texture and with working light and smoothing (but under Irrlicht.NET this don't working and under IrrNet CP may be working).

Code: Select all

node->setMaterialFlag(EMF_LIGHTING, true); 
      node->getMaterial(0).Shininess = 0.0f; 
      node->getMaterial(0).DiffuseColor.set (0, 127, 127 , 127);  
      node->getMaterial(0).SpecularColor = 0.0f; 
      node->getMaterial(0).AmbientColor = 127.0f; 
      node->getMaterial(0).EmissiveColor.set (0, 255, 255, 255);  
      node->getMaterial(0).NormalizeNormals = true;  
      ILightSceneNode* light1 = smgr->addLightSceneNode(0, 
            vector3df(1024,1024,1024), SColorf(255.0f, 255.0f, 255.0f)); 
      ILightSceneNode* light2 = smgr->addLightSceneNode(0, 
            vector3df(-1024,-1024,-1024), SColorf(100.0f, 100.0f, 100.0f)); 
Try to use material properties in same configurations. Also you can take any(!!!) texture to your 3ds model. And I don't use 3ds textures (heh, irrlicht report in console about error, but still working :) ), I use any texture, that I set manual (auto texturing is not working, I mean, cause I try many times, and can't to do this).

P.S. Sorry for my bad english, cause I'm russian-speaker. :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

suliman wrote:source\main.cpp(371) : error C2039: 'setAmbientLight' : is not a member of 'ISceneManager'
Then update to a more recent version of Irrlicht, which might also fix your other problems.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

SOLVED!
A two-part problem it was (those are often the trickiest)

It seem i need one of these two lines (or both) , without niether one no textures are showing (sides are all white if i lit them). Why...

myCraft.node->getMaterial(0).Shininess = 0.0f;
myCraft.node->getMaterial(0).SpecularColor = 0.0f;

The other problem WAS the mesh. I made a new one from scratch and on that one (if i use the shininess line) the textures show.

i use ver 1.2, isnt that latest? Still gives me that error and i need ambientLight.

Thanks a lot for clearing this out. (spasiba bolshoe. Ja ponimaju malinki russki.)
Erik
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

But 1.2 has the setAmbientLight in ISceneManager.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Yes, 1.2 is the latest official version !!!
And no, setAmbientLight isn't from ISceneManager, it's from IVideoDriver !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, it's from both, but only the one from ISceneManager works as expected. The ambient light from the scene is set to the driver when the scene is rendered. So the IVideoDriver value is overwritten in each cycle. Please check example 13 and the demo for the correct usage.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

?
Example 13 uses this one:
driver->setAmbientLight(video::SColor(60,60,60,60));

i add it but it doesnt light up my model (normal lights do so i know the model is set up correctly)

So how do i get ambientlight to work? I tried this line and it seem to set some kind of ambient light for the node itslelf, but why is it called emissivecolor? And is it wise to use this for every object in my game or better to try to get ambientlight to work?

node->getMaterial(0).EmissiveColor.set (0, 150, 150, 150);

Thanks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Excerpt from example 13 source code (not the html code which is not always up to date):

Code: Select all

       // set ambient light
        smgr->setAmbientLight(video::SColor(0,60,60,60));
So do it as you're told and it should work.
Post Reply