HELP! Why the model is white ?
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
HELP! Why the model is white ?
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!
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!
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
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());
}
}
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.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.
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.
It's this thread with little useful subject: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10071
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.
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
I think the x file already contains the color of the vertexes, but why irrlicht ignore it??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.
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.
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
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?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.
-
- Posts: 24
- Joined: Fri Oct 28, 2005 10:05 am
- Location: Gold Coast, QLD, Australia
Re: HELP! Why the model is white ?
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?
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?