Changing a texture's height map value in realtime?

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
JJJohan
Posts: 7
Joined: Thu Dec 18, 2008 11:49 am
Location: Brisbane, Australia
Contact:

Changing a texture's height map value in realtime?

Post by JJJohan »

I've really liked the SpecialFX tutorial example and what it does with parallax mapping, and i was wondering if it was possible to change the height map value in realtime?

Here's the particular bit of code I'm looking at:

Code: Select all

        if (roomMesh)
        {
                smgr->getMeshManipulator()->makePlanarTextureMapping(
                                roomMesh->getMesh(0), 0.003f);

                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);
                // adjust height for parallax effect
                room->getMaterial(0).MaterialTypeParam = 0.035f;

                // drop mesh because we created it with a create.. call.
                tangentMesh->drop();
        }
Now I want to be able to change the following:

Code: Select all

                driver->makeNormalMapTexture(normalMap, 9.0f);
Is this at all possible, if I added a slider in the program to change this value from 1.0f to 10.0f? Or is this not possible with shaders/height maps/etc.?

Edit:
Thanks Bitplane, I've done something along the lines of changing that. I've got a really nice demo available too but I'm sure no one will really be interested in it anyway.
Last edited by JJJohan on Fri Dec 19, 2008 3:49 am, edited 2 times in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Re: Changing a texture's height map value in realtime?

Post by bitplane »

Code: Select all

                // adjust height for parallax effect
                room->getMaterial(0).MaterialTypeParam = 0.035f;
How about adjusting the material type param like in the comment?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply