Please help me with Normal mapping

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
captainkitteh
Posts: 28
Joined: Sat May 21, 2011 10:49 am
Location: Dhaka, Bangladesh
Contact:

Please help me with Normal mapping

Post by captainkitteh »

Forgive me for my ignorance but I am a true novice when it comes to use of materials. I decided to experiment with normal mapping and parallex mapping technique. After studying the code in example11 I decided to make a cube which would be Normal Mapped or Parallex Mapped. Here is the code I wrote.

Code: Select all


// Lets make a cube
IMeshSceneNode* cube=smgr->addCubeSceneNode();

// Get the mesh from the cube node
smgr->getMeshManipulator()->makePlanarTextureMapping(cube->getMesh(), 0.003f);

// Lets make the tangent from the cubes mesh
IMesh* tangent=smgr->getMeshManipulator()->createMeshWithTangents( cube->getMesh(),true); 

// And now make a clone using the tangent mesh
IMeshSceneNode* cube2= smgr->addMeshSceneNode(tangent);

// put the cube where the camera is so I can find it better :)
cube2->setPosition(camera->getPosition());

// make a normal mapped texture
ITexture* normalMap = driver->getTexture("rockwall_height.bmp");
driver->makeNormalMapTexture(normalMap, 3.0f);

// Now set the first texture 
cube2->setMaterialTexture(0,driver->getTexture("rockwall.jpg"));

// And then the normal map as the second texture
cube2->setMaterialTexture(1, normalMap);


// I dont know what this does, but the tutorial did it so I am copying, monkey see monkey do :)
cube2->getMaterial(0).SpecularColor.set(0,0,0,0);

// I also tried with EMT_PARALLAX_MAP to same dissapointment
cube2->setMaterialType(EMT_NORMAL_MAP_SOLID  );

// Set bumpyness value
cube2->getMaterial(0).MaterialTypeParam = 0.035f;

// And drop the tangent since its no longer needed
tangent->drop();
When I run this code all I get is a white box.
Insert witty saying
captainkitteh
Posts: 28
Joined: Sat May 21, 2011 10:49 am
Location: Dhaka, Bangladesh
Contact:

Post by captainkitteh »

Help anyone ?? Surely someone must know ? :(
Insert witty saying
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Post by mongoose7 »

Usually. a white box means there isn't a texture. Maybe you should check the return values from your driver->getTexture() calls?
Post Reply