i playing around with the engine a little and i have a problem with realtime shadows.
Here are two sample screeners:
http://yfrog.com/nfshadows1j (a green box as object)
http://yfrog.com/n8shadows3j (a white torus as object)
I created the model with blender, all normals are pointing to the outside and exported is as '.x' file and '.obj' file.
here the code i use:
Code: Select all
// create render device 1024x600x32,fullscreen_flag,stencil,no_vsync
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(1024, 600), 32, b_fullscreen, true, false, &receiver );
// if creation failed for any reason
if( !device )
return 1;
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *scmgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
IAnimatedMeshSceneNode *node = 0;
IAnimatedMesh *tank = scmgr->getMesh( "tank.x" );
ILightSceneNode *light = 0;
if( tank ) {
node = scmgr->addAnimatedMeshSceneNode( tank );
}
if( node ) {
node->setMaterialFlag( EMF_LIGHTING, false );
node->setPosition( vector3df( 1000.0f, 1050.0f, 3000.0f ) );
node->setScale( vector3df( 70.0f, 70.0f, 70.0f ) );
node->addShadowVolumeSceneNode();
node->setMaterialFlag( video::EMF_NORMALIZE_NORMALS, true );
}
// create light
light = scmgr->addLightSceneNode( 0, vector3df( 900.0f, 1400.0f, 3000.0f , SColorf( 1.0f, 0.0f, 0.8f, 0.0f ), 800.0f );
if( light ) {
light->setDebugDataVisible( EDS_BBOX );
light->enableCastShadow( true );
light->setVisible( true );
ISceneNode *bill = scmgr->addBillboardSceneNode( light, imension2d<f32>( 30, 30 ) );
if( bill ) {
bill->setMaterialFlag( EMF_LIGHTING, false );
bill->setMaterialFlag( EMF_ZWRITE_ENABLE, false );
bill-setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bill->setMaterialTexture( 0, driver->getTexture( img/particlered.bmp" ) );
}
}
scmgr->setShadowColor( SColor( 150, 0, 0, 0 ) );