Topic: Unable to scale Textures

According to this site … dMaterials it should be possible to scale the texture in the following code sample:

Local snowTex:ITexture ="tex.png")
ter.terrainMeshSceneNode.setMaterialTexture(0, snowTex)
ter.terrainMeshSceneNode.getMaterial(0).getTextureMatrix(0).setTextureScale(1, 10)

The problem: It doesn't matter which scale-factors I use, the result is always the same 1:1 unscaled texture. I possibly have to show more code but it seems not to be my fault (sadly sad ).

It would be nice if there is any solution or sth. else. Getting the Matrix to set it after the manipulation again doesn't work, too.

Re: Unable to scale Textures

greetings smile  my apologies on the delayed response.  i scanned through the code and all seems to be setup correctly. 

i did a search on the Irrlicht forums for setTextureScale and found a few examples.  both use the same setting back the value technique so i think this is where you probably need to update the code. … xturescale


so updated code for your example would be:

ter.terrainMeshSceneNode.getMaterial(0).setTextureMatrix(0, ter.terrainMeshSceneNode.getMaterial(0).getTextureMatrix(0).setTextureScale(1, 10))

here is a second example (essentially doing the same thing): … xturescale

      core::matrix4 matrix = material.getTextureMatrix(0); 
      material.setTextureMatrix(0, matrix );

so updating your code sample:

Local snowTex:ITexture ="tex.png")
ter.terrainMeshSceneNode.setMaterialTexture(0, snowTex)
Local matrix:Matrix4 = ter.terrainMeshSceneNode.getMaterial(0).getTextureMatrix(0)
matrix.setTextureScale(1, 10)
ter.terrainMeshSceneNode.getMaterial(0).setTextureMatrix(0, matrix)

again my apologies on the delay.  hope this gets you on the right track!

Re: Unable to scale Textures

Thank you for your answer, but also this code seems not to work. The scale factor doesn't affect the Texture in any way...

Local mat:Matrix4 = ter.terrainMeshSceneNode.getMaterial(0).getTextureMatrix(0)
mat.setTextureScale(0.1, 10)
ter.terrainMeshSceneNode.getMaterial(0).setTextureMatrix(0, mat)

If needed I'll upload you an example code to test it yourself wink