Just wondering if the following code make sense when setting up textures for parallax view.
The first method used when a colormap and height map texture is available.
colormap: rockwall.bmp
![Image](http://farm4.static.flickr.com/3210/2591074102_aba42653e6.jpg)
heightmap: rockwall_height.bmp
![Image](http://farm4.static.flickr.com/3073/2591073894_4c898522aa.jpg)
code:
Code: Select all
video::ITexture* colorMap = driver->getTexture("../../media/rockwall.bmp");
video::ITexture* normalMap = driver->getTexture("../../media/rockwall_height.bmp");
driver->makeNormalMapTexture(normalMap, 9.0f);
scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
roomMesh->getMesh(0));
room = smgr->addMeshSceneNode(tangentMesh);
room->setMaterialTexture(0, colorMap);
room->setMaterialTexture(1, normalMap);
room->getMaterial(0).SpecularColor.set(0,0,0,0);
room->setMaterialFlag(video::EMF_FOG_ENABLE, true);
room->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
room->getMaterial(0).MaterialTypeParam = 0.02f; // adjust height for parallax effect
// drop mesh because we created it with a create.. call.
tangentMesh->drop();
parallax:
![Image](http://farm3.static.flickr.com/2294/2591169504_58649e5754.jpg)
bump:
![Image](http://farm3.static.flickr.com/2160/2591195260_231d1a9ca5.jpg)
The second method uses two textures: a colormap and a normal map.
colormap: rockwall.bmp
![Image](http://farm4.static.flickr.com/3210/2591074102_aba42653e6.jpg)
normalmap: rockwall_nomalMapped.bmp
![Image](http://farm4.static.flickr.com/3141/2591081758_fe3f708e4c.jpg)
Code: Select all
video::ITexture* colorMap = driver->getTexture("../../media/rockwall.bmp");
video::ITexture* normalMap = driver->getTexture("../../media/rockwall_nomalMapped.bmp");
scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
roomMesh->getMesh(0));
room = smgr->addMeshSceneNode(tangentMesh);
room->setMaterialTexture(0, colorMap);
room->setMaterialTexture(1, normalMap);
room->getMaterial(0).SpecularColor.set(0,0,0,0);
room->setMaterialFlag(video::EMF_FOG_ENABLE, true);
room->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
room->getMaterial(0).MaterialTypeParam = 0.02f; // adjust height for parallax effect
// drop mesh because we created it with a create.. call.
tangentMesh->drop();
Code: Select all
driver->makeNormalMapTexture(normalMap, 9.0f);
And here's the output...
![Image](http://farm4.static.flickr.com/3221/2590324133_da681bdbfd.jpg)
What do you think? Does that make sense?
Thanks.