HELP! Why the model is white ?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

HELP! Why the model is white ?

Post by michael520 »

I make a model in 3ds max using a red color as its diffuse and ambient color, then export the model by Panda-X exporter to a x format file.
Then I load this model in irrlicht, with no light, and set:
node->setMaterialFlag(video::EMF_LIGHTING, false); //means the model do not use lighting.
then the model looks white(not red).

I wonder why this happen.

Won't the vertexs of the model be render with color?

Please help, thanks!
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

Anyone know why?

I've try to give a jpg as its texture, and it works fine.

But why can't I just use a color to render vertexes?? We know that, DX and GL basically render vertexes with color. But why irrlicht engine make this unusable?
hybrid

Post by hybrid »

It is possible with Irrlicht (the ambient light, not the solid colors) but you have to set it on your own. It's not imported from the files.
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

hybrid:

I use the mesh viewer in directx sdk and the color is correct.
So I think it's the problem of irrlicht, too.

But how to solve? I am still not very familiar with this engine.
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

The following is my code:

Code: Select all

	IrrlichtDevice* device = 0;

	device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640,480), 32, false, false, false);

	scene::ISceneManager* sm = device->getSceneManager();
	video::IVideoDriver* driver = device->getVideoDriver();

	//add camera and light:
	scene::ICameraSceneNode* camera = sm->addCameraSceneNodeFPS(0,20,400);
	scene::ILightSceneNode* light = sm->addLightSceneNode(camera);
	camera->setPosition(core::vector3df(100,150,100));
	camera->setTarget(core::vector3df(0,0,0));

	//hide the mouse cursor:
	device->getCursorControl()->setVisible(false);

	//load scene objects:
	scene::IMesh* mesh = sm->getMesh("box1.x")->getMesh(0);
	scene::ISceneNode* node = sm->addMeshSceneNode(mesh);
	node->setMaterialFlag(video::EMF_LIGHTING, false); //no lighting on this node.

	//main loop:
	int fps = 0;
	while(device->run())
	{
		if(device->isWindowActive())
		{
			driver->beginScene(true, true, video::SColor(0,0,0,100));
			sm->drawAll();
			driver->endScene();
		}
		if(fps!=driver->getFPS())
		{
			fps = driver->getFPS();
			core::stringw str("FPS");
			str += driver->getFPS();
			device->setWindowCaption(str.c_str());
		}
	}

hybrid

Post by hybrid »

michael520 wrote: I use the mesh viewer in directx sdk and the color is correct.
So I think it's the problem of irrlicht, too.

But how to solve? I am still not very familiar with this engine.
Yes, both are problems related to Irrlicht, but ambient light is solvable within current version of Irrlicht, while solid colors would need changes of the code.
Check the API for scene nodes, there are possibilities to change the different lights. There had been at least two threads on this topic as well in the last days, so searching the forum should also help.
hybrid

Post by hybrid »

It's this thread with little useful subject: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10071
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

you set a color in the difuse texture of max's material editor. Irrlicht won't recognize such materials. Instead, add a 256x256 or 512x512 jpg texture with the color you want as difuse texture and apply it to your mesh. Export to 3ds or the format you require and place the jpg in the same folder as your model. It should load its material properly then.

:wink:
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Mike its a problem with Irrlicht, what you were doing was right.

But its pretty easy to get around, so no probs there.
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

afecelis wrote:you set a color in the difuse texture of max's material editor. Irrlicht won't recognize such materials. Instead, add a 256x256 or 512x512 jpg texture with the color you want as difuse texture and apply it to your mesh. Export to 3ds or the format you require and place the jpg in the same folder as your model. It should load its material properly then.

:wink:
I think the x file already contains the color of the vertexes, but why irrlicht ignore it??
I think it should display the color of vertexes if the model has no texture on.

I didn't know why Niko ignore the color defination of vertexes while it won't do anything bad to irrlicht.

I think many people need this function so I hope Niko would see this problem.

And, I still don't know what should I do to solve this problem.
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

NEWS NEWS NEWS~~~~~~~

If I use the My3D export plugin for 3ds max, the models with color-material can be viewed correctly !

So, I would think that the problem is that the x format file loader have some bugs, which ignore the color of vertexes!!!!!!!

I would check the code of the loader later.
Bridgebuilder

Post by Bridgebuilder »

Yes, i can't load vertex colors at all. I tried to import a bridge which i modelled with FEviaduct.
Its quite nice that i can export is as a VRML/X3D file with the force stress as vertex colors.
But i had no luck importing this into Irrlicht. How do i import vertex colors correctly?

Cheers
Myth
Posts: 81
Joined: Wed Apr 13, 2005 5:48 pm

Post by Myth »

michael520 wrote:NEWS NEWS NEWS~~~~~~~

If I use the My3D export plugin for 3ds max, the models with color-material can be viewed correctly !

So, I would think that the problem is that the x format file loader have some bugs, which ignore the color of vertexes!!!!!!!

I would check the code of the loader later.
My3D exporter uses render to texture so basiclly it puts the diffuse color onto a texture and then draws it. Nothing new or am I mistaken?
independentCreations
Posts: 24
Joined: Fri Oct 28, 2005 10:05 am
Location: Gold Coast, QLD, Australia

Post by independentCreations »

you have to actually have a texture file, if its constant colour or use a small image size, like 16x16. load it in max, on the material add a map for diffuse colour, bitmap load image and export textures with it
"do it, do it now"
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: HELP! Why the model is white ?

Post by Asimov »

Hi all,

I have just found this thread in 2015 because I am having a similar problem. I spent 3 days trying to work out why my model was coming out white.
It is now 10 years later, and the problem is still there. I wonder if anyone is going to put this bug right?

Surely to change all the vertexes to one colour shouldn't take more than a few extra lines of code.

Has anyone ever reported this bug?
Post Reply