Hi.
I have a problem with osgFX::BumpMapping
I use object from .osg file. Loading via osgDB::readNodeFile is OK.
I do something like this:
osgFX::BumpMapping* bumping = new osgFX::BumpMapping();
bumping->setLightNumber(1);
osg::Image* normalMapImage = new osg::Image();
osg::Image* diffuseMapImage = new osg::Image();
normalMapImage->setFileName(*normalMapFile);
diffuseMapImage->setFileName("./texture/torch.tga");
osg::Texture2D* normalMap = new osg::Texture2D(normalMapImage);
osg::Texture2D* diffuseMap = new
osg::Texture2D(diffuseMapImage);
bumping->setOverrideNormalMapTexture(normalMap);
bumping->setOverrideDiffuseTexture(diffuseMap);
osg::Node* pomNode = new osg::Node();
// Load models from files and assign to nodes:
pomNode = osgDB::readNodeFile(filename);
bumping->addChild(pomNode);
bumping->prepareChildren();
modelNode = bumping;
modelNode is added to root node. My torch looks only like siluete (light set to
0). I have created light like this:
osg::Light* myLight2 = new osg::Light;
myLight2->setLightNum(1);
myLight2->setAmbient(osg::Vec4(1.0f,0.0f,0.0f,1.0f));
myLight2->setDiffuse(osg::Vec4(1.0f,0.0f,0.0f,1.0f));
myLight2->setPosition(osg::Vec4(1, 1, 1, 0));
osg::LightSource* lightS2 = new osg::LightSource;
lightS2->setLight(myLight2);
lightS2->setLocalStateSetModes(osg::StateAttribute::ON);
lightS2->setStateSetModes(*rootStateSet,osg::StateAttribute::ON);
root->addChild(lightS2);
Torch is at position (0,0,2). Why is my torch black? Where is the problem? I
created it in Blender and use export and it has UV coordinates. If I do't use
bumpmapping it looks normal. Can anybody help me?
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/