Problems with textures

Hello! I’m trying to pull the texture on such a platform. The platform is an imported model in fbx format.

Texture in jpg format size 640x480.
When I try to stretch the texture, the platform just changes color, but the picture itself is not visible.
It was played in the console with the parameters: uScale, vScale, vAngle … and so on.
There is no sense - the platform just changes color - but the pattern itself is not visible.
Below is the result of the work and the texture itself.

If I stretch the same texture onto an ordinary box or plane, everything works fine. The feeling that the scales do not converge somewhere.

Tell me what I could do wrong.

Here is an example of how the texture is stretched:

 var material = new BABYLON.StandardMaterial ("sliceColor", Game.Scene);
       material.diffuseTexture = new BABYLON.Texture ('/ img / materials / platforms / platform.jpg', Game.Scene);

Here is platform with texture.

Texture options:

Hi A. It is possible that your platform model has no UV data, so the texture has no instructions about how to “map” onto the platform. Not all models have UV’s. You might need to add them in the modeler… and make sure they are exporting properly. Just an idea. :slight_smile:


Yea. I agree with the Wingnut answer. Had similar problems in the past. improper UVs can do that. So as Wingnut said you should probably check that first inside some 3d software.

You can test it within the code also (maybe xD).

You can do something like this.


If this value is null you have no UV data on your mesh. You can create some UV data, to expand on this (this will not help you a lot, except to see will something happen with your texture on mesh, it should have some effect);

//get position values of the vertices

var positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);

// calculate UVs (i believe this is calculation for plane geometry)

var uvs = [];
for (var p = 0; p<positions.length/3; p++) {
uvs.push((positions[3p] - (-4)), (positions[3p+2] - (-4)))

//create new vertex data and apply it to mesh

let vertexData = new BABYLON.VertexData();
vertexData.positions = positions;
vertexData.uvs = uvs;

//now this should give you some different result than null

Also, you can try adding bump texture on the mesh. If there is not UV data your mesh will become black. (haha)

EDIT: I think that softwares like 3dsMax and Blender always add SOME UV data to the mesh, even if you don’t do anything manually with it. So it shouldn’t give you null value for UVs.

I had issues with .stl format cause it doesn’t carry UV data at all. So in that case it will be null


Yes. Problem with model. I exported from 3dmax with babylon export plugin and after that, i have problems. So i do next:
Export model to .3ds
Import model in blender3D
Export to babylon with export plugin.

And all right! Thanks for answers and help!