Weird texture mapping after transferring

Hello everyone on the new forum!

I ran into a problem. In my project users should be able to create their own textures (painting on dynamicTexture). And then upload them to the server. I do this uploading through the base64-string representation of the texture. But after applying and converting back to the texture, something breaks with the texture mapping on the mesh.

I make the playground to show this behavior: https://www.babylonjs-playground.com/#HWGEFQ#2 (It’s hard to see, but after clicking the texture mapping changes. In playground i could not load any more representing image in src attribute, i think because CORS).

Why is this happening? Maybe there is a better solution?

It seems to me better like this:

https://www.babylonjs-playground.com/#HWGEFQ#3

2 Likes

If you want to stick with base64: https://www.babylonjs-playground.com/#HWGEFQ#4
I just updated the new texture constructor to indicate invertY = true (second boolean)

So simple… I found my method in a playground, and did not think that basic creating would work as usual. x)
Thanks!

You’re welcome. Always a pleasure to be able to help

Deltakosh’s solution works well too if you want to stay on a base64

And I tried to turn the context of the canvas, using an additional canvas in memory and transformation, rotation, redrawing … Damn, need to read docs more carefully)

Man I love that we can now flag an answer!!! This makes my year :smiley:

1 Like

I understand you DK. This forum seems to make it easier for you. I begin to the appreciate.

I hope it will be better for everyone :slight_smile:

But what’s mean “stay on base64” if in both ways the data is transmitted in base64 format?

Yes, I am sure of it, and over time it will improve.

I’ll let Deltakosh answer you, I’m not sure of the difference.

Yes you are fine with both

Okay. Then I will use the first method, because it is 3 times shorter) Thanks for the help!

1 Like