Texture transformation order

Hello,

Is there any way to control the texture transformations order? I have a texture information which includes rotation and scale.

BabylonJS rotates the texture first and then does the scaling, while I need to do the scaling and then rotating. Is there any way to calculate new transformations or modify the order of BabylonJS texture transformations?

TY!

Hello!

you can overwrite the texture.getTextureMatrix() function to return the matrix you want :wink:

2 Likes

Thank you Deltakosh!

I was looking into this function too (this is actually what can be used). It is just seems a bit complex for me, I had a hope there’s a more flexible solution :slight_smile:

However, it seems that nobody faced with such requirement before (do the texture scale and then rotation). Need to go deeper :expressionless:

technically, you simply have to:

texture.getTextureMatrix = function() {
   return BABYLON.Matrix.Identity; // use your own matrix here ;)
}

Thank you! Marked your first answer as a solution. Will try to override getTextureMatrix both using a class and by replacing the function.