Hello,
I am trying to use osgFX::BumpMapping.
For some reason, my diffuse map looks dark. I can only see the normal map.
If I simply apply the diffuse map on my node without bumpmapping, it looks
fine. Here is my code:
osg::Group *root = new osg::Group;
osg::Image* normalMapImage =
osgDB::readImageFile("bricknormal.tga");
osg::Image* diffuseMapImage =
osgDB::readImageFile("brick.tga");
osg::Texture2D* normalMap = new
osg::Texture2D(normalMapImage);
osg::Texture2D* diffuseMap = new
osg::Texture2D(diffuseMapImage);
// create the BumpMapping group
osgFX::BumpMapping *pBump = new osgFX::BumpMapping;
pBump->setLightNumber(0);
// add our node as a child
pBump->addChild(loadedModel.get());
pBump->setEnabled(true);
pBump->setOverrideNormalMapTexture(normalMap);
pBump->setOverrideDiffuseTexture(diffuseMap);
pBump->prepareChildren();
root->addChild(pBump);
osg::Light* myLight2 = new osg::Light;
myLight2->setLightNum(0);
myLight2->setAmbient(osg::Vec4(1.0f,0.0f,0.0f,0.0f));
myLight2->setDiffuse(osg::Vec4(1.0f,0.0f,0.0f,1.0f));
myLight2->setPosition(osg::Vec4(1, 0, 1, 0));
osg::LightSource* lightS2 = new osg::LightSource;
lightS2->setLight(myLight2);
lightS2->setLocalStateSetModes(osg::StateAttribute::ON);
root->addChild(lightS2);
viewerWindow->setSceneData(root);
If no light is present this is the same problem, can anybody help please?
Thanks in advance,
Regards,
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org