So I make a model with Blender. A shirt with logos. Then in my Babylon.js file, I want to generate text to be assigned as texture in the logos. No matter what I do the generated texture is upside down.
var tex = new BABYLON.DynamicTexture(generateUUID(), { width: DTWidth, height: DTHeight }, $scope.scene);
I tried these:
tex.invertZ = true not working tex.uScale = -1 the texture becomes so weird, it rotates 90 or -90 degree, I cannot see the rest of the texture tex.vScale = -1 the texture is gone.
So the trick is with setTransform()? Could you help me explain the parameters, because I my dynamic texture size is dynamic {width: dynamicWidth, height: dynamicHeight}. What is the 128 in the parameter?
Yes since dynamic texture is basically just a canvas setTransform() should work.
Oh my bad I copy and pasted that from my code. 128 should be replaced with your texture height.
Give it a try and let me know how it goes!
var trimmedUrl = url.replace('~/', '/');
var tex = new BABYLON.Texture(trimmedUrl, $scope.scene);
tex.hasAlpha = true;
material.albedoTexture = tex;
material.useAlphaFromAlbedoTexture = true;
This is not applying text, but applying texture from URL. It is the same, it is upside down. Using your technique setTransform(), how to deal with this one?
I experience the same problem and none of the initial parameter work, and neither the work around in this thread. The weird part is that I checked (console.log) the value of invertY after draw image and still false and I was confuse about it.
After checking the source code a little bit, I found that sending (invertY = false) during update, will do the job. textureGround.update(false);