I'd like to display decal on the mesh using texture coordinate. Could you provide a method to convert texture coordinate to world coordinate?

let decalSize = new Vector3(4, 4, 4);
let texturePT = new Vector2(0.002, 0.7554);
let decal =MeshBuilder.CreateDecal(“decal”, mapMesh, {position: decalPt, normal: decalNl, size: decalSize, localMode: true});
decal.material = decalMaterial;

I already know a texture coordinate displaying decal
But for the above function, It needs a world coordinate of decal
How can I get a world coordinate from this texture coordinate.
Thank you in advance.

1 Like

Hello! You’re kind of going to do the inverse of uv unwrapping, you can see some videos (Unit 9) Colour and Shading 5: Inverse Texture Mapping - YouTube. Another alternative could be using a node material instead of decals: Babylon.js Node Material Editor (babylonjs.com)

5 Likes

Thanks for your always good answer

1 Like

Hello
I am trying to know node material editor and texture mapping.
I have some question and want your good hint
First, If I use Node Material Editor or Shaders,
Is it possible texture mapping on to UV’s range?
Second, If it is right, could you possibly provide me refer video link to understand this topic?
thank you

You can manipulate uvs in any way you want in NME :slight_smile: We have many videos about NME on the official youtube: Babylon js - YouTube, I don’t know if there is any specific about textures through.