Kesshi Posted May 25, 2016 Share Posted May 25, 2016 Currently we have problems to convert our materials to BabylonJs. The problem is that Texture rotation and scaling is not behaving as expected. Lets say i have a texture (amiga.jpg in my example) and set the uScale to 10 and the rotation to 30°. What i expect is this: What i get with BabylonJs is this: (playground: http://www.babylonjs-playground.com/#1RD35E#3 ) In BabylonJs the rotation is applied first and then the scale. This results in a shearing. I would expect it to be the otherway around. Is this a bug or the intended behavior? If it is not a bug, would it be possible to set a custom texture matrix on the texture? At the moment i modify the internally cached texture matrix directly to get what i want but this seems like a hack. Quote Link to comment Share on other sites More sharing options...
eboo Posted May 25, 2016 Share Posted May 25, 2016 http://www.babylonjs-playground.com/#1RD35E#4 tex.wAng = BABYLON.Tools.ToRadians(30)/tex.uScale; Quote Link to comment Share on other sites More sharing options...
Kesshi Posted May 25, 2016 Author Share Posted May 25, 2016 @eboo that will not help, the result is not identical to my first picture Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted May 25, 2016 Share Posted May 25, 2016 it need correct steps order in default fragment shader i think Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 25, 2016 Share Posted May 25, 2016 Quote In BabylonJs the rotation is applied first and then the scale. Correct https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/Textures/babylon.texture.ts#L137 You can change the default behavior by overloading texture.getTextureMatrix = function(){ } dbawel 1 Quote Link to comment Share on other sites More sharing options...
Kesshi Posted May 25, 2016 Author Share Posted May 25, 2016 So, its not a bug ... its a feature :-) Ok i will create a derived texture class then and implement a custom getTextureMatrix() function. Thx. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.