Scaling a parallax map texture

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
itsagam
Posts: 10
Joined: Wed Dec 28, 2011 3:39 am

Scaling a parallax map texture

Post by itsagam »

I am using parallax mapping and have a brick texture on the surface of a wall. The problem is it appears simply too large and I cannot scale it down. The way I scale down textures is

Code: Select all

getMaterial(0).getTextureMatrix(0).setScale()/setTextureScale()/setTextureScaleCenter()
But these have no effect at all as long as the material type is EMT_PARALLAX_MAP_SOLID (as soon as I change the material type to EMT_SOLID, the bricks have the size I want).

What I have tried so far:

- Using setScale()/setTextureScale()/setTextureScaleCenter()
- Scaling the mesh itself with mesh->setScale() and smgr->getMeshManipulator()->scale()
- Programatically resizing the texture by ITexture->IImage->copyToScaling->IImage->ITexture
- Manually resizing the texture image to 1/4th of the size

No matter what I do, the texture always has the same size.

Image

Code: Select all

    
        IAnimatedMesh* mesh = smgr->getMesh(data->get<stringc>("world.map.model"));
        IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(mesh->getMesh(0));
        
        mapNode = smgr->addOctreeSceneNode(tangentMesh);
        mapNode->setMaterialFlag(EMF_LIGHTING, false);
        mapNode->setPosition(data->get<vector3df>("world.map.position"));
        mapNode->setRotation(data->get<vector3df>("world.map.rotation"));
        mapNode->setScale(data->get<vector3df>("world.map.scale"));
        
        ITexture* texture = driver->getTexture("Data/textures/bricks/brick.png");
        mapNode->getMaterial(1).setTexture(0, texture);     
        ITexture* normalMap = driver->getTexture("Data/textures/bricks/brick_height.png");
        mapNode->getMaterial(1).getTextureMatrix(0).setScale(6.0f);
        driver->makeNormalMapTexture(normalMap, 9.0f);
        mapNode->getMaterial(1).setTexture(1, normalMap);
        mapNode->getMaterial(1).getTextureMatrix(1).setScale(6.0f);
        mapNode->getMaterial(1).MaterialType = EMT_PARALLAX_MAP_SOLID;
        mapNode->getMaterial(1).MaterialTypeParam = 0.035f;
 
        tangentMesh->drop();
        smgr->addLightSceneNode(0, vector3df(0, 0, 0), SColorf(1.0f, 1.0f, 1.0f), 1800.0f);
 
I am using Irrlicht SVN 4293
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Scaling a parallax map texture

Post by Mel »

Another way you can try is to alter the mapping coordinates of the exported model, if posible.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Scaling a parallax map texture

Post by hybrid »

Yes, unfortunately, the shaders used for the normal and parallax mapping in Irrlicht only support very limited features. Thus, no support for texture matrices. You could try and add this to the shader sources (needs to recompile Irrlicht) or transform the texture coords manually. IIRC, we also have a function in mesh manipulator that scales the texture coords once in the vertex structures.
Post Reply