[FIXED]How do i apply bump map?

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.
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

[FIXED]How do i apply bump map?

Post by MasterM »

Hey all, i wanted to test bump map but i could not find out how...i searched the forum but did not get much useful topics...Does anyone know how to apply a bump map texture to the model?
Thanks in advance.
Last edited by MasterM on Mon Dec 08, 2008 8:12 pm, edited 1 time in total.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
jontan6
Posts: 278
Joined: Fri Jun 13, 2008 5:29 pm

Post by jontan6 »

there is example in the tutorials
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

Hmmm i don't see it, wich one of the examples?
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
jontan6
Posts: 278
Joined: Fri Jun 13, 2008 5:29 pm

Post by jontan6 »

the one with the wall thingy... with rotating particle light and a dwarf.... seems it has bump....
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh no, example 8 with the dwarf is for particles and shadows. Example 11 is for parallax and normal map rendering.
jontan6
Posts: 278
Joined: Fri Jun 13, 2008 5:29 pm

Post by jontan6 »

o yes that should be it....
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

I checked the tutorial and if i am not mistaking to make a bump map i need the following code

Code: Select all

ISceneNode *sars=smgr->addSphereSceneNode();
 ITexture*bumpt=driver->getTexture("textures/sarsbump.jpg");
 driver->makeNormalMapTexture(bumpt, 9.0f);
    if (sars)
    {
        sars->setMaterialTexture(0,driver->getTexture("textures/sars.jpg"));
       sars->setMaterialTexture(1,bumpt);
        sars->setMaterialFlag(video::EMF_LIGHTING,true);
}
But i dont notice any difference in the model :S...am i doing something wrong here?
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you need tangents in your mesh. Go check the tutorial again :wink:
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

Hmmm i red the tutorial again and if i am not mistaking bump mapping can only be done to IAnimatedMesh or can it also be done with ISceneNodes?
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

It's not "OR", it's "AND"

Code: Select all

scene::IAnimatedMesh* roomMesh = smgr->getMesh("../models/mymodel.b3d");

scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
			roomMesh->getMesh(0));
room = smgr->addMeshSceneNode(tangentMesh);


See tutorial #11 for mo' info, brotha.

Got to go, see my homies.
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, you need an IMeshSceneNode at least, because you have to work with the mesh. But besides that there should be no other restriction.
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

Thanks guys :) but i did what the tutorial did and what you guys sayed but it isnt showing the bump map :S...
here is my code

Code: Select all

 ITexture* colorMap = driver->getTexture("textures/sars.jpg");
     ITexture* normalMap = driver->getTexture("textures/sarsbump.jpg");

   driver->makeNormalMapTexture(normalMap, 90.0f);

    IMeshSceneNode* sar;
    IAnimatedMesh* sarsmesh=smgr->getMesh("sars.3ds");
    IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
         sarsmesh->getMesh(0));
    sar = smgr->addMeshSceneNode(tangentMesh);

    sar->setMaterialTexture(0, colorMap);
               sar->setMaterialTexture(1, normalMap);

                sar->getMaterial(0).SpecularColor.set(0,0,0,0);
               sar->getMaterial(0).MaterialTypeParam = 5.1f;

                tangentMesh->drop();
So what am i doing wrong in this code that the bump map doesnt show :S ?
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

What about the material type? Should be changed to EMT_PARALLAX_MAP or something like that.
gogo
Posts: 65
Joined: Tue Apr 15, 2008 1:04 am

Post by gogo »

Maybe you want to do like my sample, don't you?

Code: Select all

IAnimatedMesh *bmesh = smgr->getMesh("ground.x");
IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(bmesh->getMesh(0));
ISceneNode *bnode = smgr->addMeshSceneNode(tangentMesh); 
bnode->setPosition(vector3df(x,y,z));
bnode->setScale(vector3df(2,1,2));
Btw, this sample is about bumpmapping of ISceneNode. Can I also do about IAnimatedSceneNode?

http://www.mediafire.com/?sharekey=16dc ... b9a8902bda
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

What about the material type? Should be changed to EMT_PARALLAX_MAP or something like that.
when i do that the model color changes :S so i letted it out :/


Maybe you want to do like my sample, don't you?
yes i do but for some reason it just doesnt work for me.
the only part i dont have in my code is
bnode->setPosition(vector3df(x,y,z));
bnode->setScale(vector3df(2,1,2));
but i dont see how it effects the bump mapping and yea pleas do about IAnimatedSceneNode.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Post Reply