Using a single dynamic texture on two different meshes positioned differently?

So I have created a dynamic texture, I have two planes

I wanted to place the first half of the texture to on one plane (i.e. top text) and second half of the texture (i.e. bottom text) on the second plane

So on bender we used to do this by of moving the UV wrap
is it possible to do that in babylon js?

I tried to do the same here

but it’s working

how can I do?

Live example:

You can use the u/vOffset and u/vScale of the Texture object:

However, for this to work in your case, you need both textures to point to the same underlying internal texture (the one of the dynamic texture). To do this, I have cloned the dynamic texture and changed the _texture property of the clones to point to the internal texture held by the dynamic texture. _texture is not meant to be used by end user, but it is still a public property, so it’s only half a hack…

As I can see it, there’s no way to create a texture by passing an existing internal texture… So, changing the _texture property is the way to do it, after all (+ also incrementing the reference count of the internal texture)? @Deltakosh?

Also, I’m not quite sure why:

this._texture = this._getFromCache(this.url, noMipmap, samplingMode, invertY);

in the Texture constructor does not retrieve the existing internal texture created by the dynamic texture… If it would work, the .clone() call would be enough to make it work as it would create a texture instance with the same internal texture than the dynamic texture.



Works perfectly!