z.attila Posted July 31, 2015 Share Posted July 31, 2015 Hi there. Is there a way to use a texture on the whole merged mesh? My problem is, if i merge some mesh into one, i can not use a texture on it, the framework apply the texture on every base shape. Here is a sample of code: var meshes = [];for (var i = 0; i < 3; i++) { var mesh = BABYLON.Mesh.CreateTorus('mesh', (i * 2) + 1, 1, 10, scene, false); mesh.position.y = i; meshes.push(mesh);} var mesh = BABYLON.Mesh.MergeMeshes(meshes, true, true); mesh.material = new BABYLON.StandardMaterial('beeHiveMaterial', scene);mesh.diffuseTexture = new BABYLON.Texture('someimage.jpg', scene); Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 1, 2015 Share Posted August 1, 2015 Hello can you create a playground scene to allow us to help you? Thanks Quote Link to comment Share on other sites More sharing options...
z.attila Posted August 1, 2015 Author Share Posted August 1, 2015 Hello, thank you for your quick response, i created a playground scene: http://www.babylonjs-playground.com/#KGUJW Quote Link to comment Share on other sites More sharing options...
jahow Posted August 2, 2015 Share Posted August 2, 2015 Hi, To achieve the effect you're looking for I think you need to either:- manipulate UV values (i.e. texture coordinates) of each vertex in your merged meshes, or- build your mesh in a 3D software, such as Blender, and choose which type of texture projection you want on your object. I made an example of my first suggestion in this PG: http://www.babylonjs-playground.com/#KGUJW#1For each torus, I scaled the texture coordinates to just show a "slice" of the whole texture. The result is not incredibly looking... But you get the idea. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.