Code: Select all
void CreateWorld(void)
{
unsigned int i;
unsigned char nextobject;
camera = smgr->addCameraSceneNodeFPS(0,100.0f,0.5f,-1,keyMap,4,false,0.f);
camera->setFarValue(100000);
camera->setNearValue(1);
camera->setPosition(core::vector3df(16500,100,6000));
smgr->setAmbientLight(SColorf(0.25f, 0.25f, 0.25f, 0));
mainlight=smgr->addLightSceneNode(0, core::vector3df(50000,20000,-50000), video::SColorf(0.5f,0.5f,0.5f,0), 200000.0f);
//Meshes
mesh[0] = smgr->getMesh("media/map070_with_spec_white_diffuse_a.3ds");
mesh[1] = smgr->getMesh("media/car001_a.3ds");
// The objects are created and placed
node[0] = smgr->addAnimatedMeshSceneNode( mesh[0] ); node[0]->setPosition(core::vector3df(0,0,0));
node[1] = smgr->addAnimatedMeshSceneNode( mesh[1] ); node[1]->setPosition(core::vector3df(16300,0,6000)); node[1]->addShadowVolumeSceneNode();
nextobject=2;
smgr->setShadowColor(video::SColor(150,0,0,0));
for (i=0; i<nextobject; i++)
{
node[i]->setScale(core::vector3df(1,1,1));
node[i]->setMaterialFlag(EMF_LIGHTING, true);
node[i]->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
node[i]->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);
node[i]->setMaterialType(video::EMT_LIGHTMAP_LIGHTING );
}
}
However, the flying car is not lit the way I want it to.
First, I'm going to show you the correct look of the model I want to achieve with Irrlicht. This is how the model appears in Deep Exploration (in case you don't know: it's a program used to view models and the properties of their materials, as well as to modify those properties and convert models from one format to another).
Note the two green exhaust ports, at full brightness.
This is because, from Deep Exploration itself, I provided the model with a diffuse texture and a self-illumination texture.
Here is the diffuse texture:
And here is the self-illumination texture.
I know for a fact that Deep Exploration saves the object correctly, because the self-illumination texture is used when I open the object, either with Deep Exploration itself or 3D Studio Max. However, when I load the model in Irrlicht, the self-illumination texture is completely ignored. Here's how it appears in my program:
The diffuse texture is correct. The specular color is correct. But the exhaust ports are NOT at full brightness! Why is the self-illumination texture ignored? I assumed I could force an object to use a self-illumination texture by setting its material type to EMT_LIGHTMAP_LIGHTING, but evidently it's not the case. I also assumed that "lightmap" means the self-illumination texture. Does it? If it does not, what do I need to change in my code?