jerome Posted May 31, 2017 Share Posted May 31, 2017 For any mesh supporting the parameter sideOrientation, we can now pass two extra parameters frontUVs and backUVs both Vector4. These values are taken in account only for double-sided meshes. They allow to declare what part of the image to crop and stick respectively on the mesh front and back faces. // set the rectangle coordinates (u0,v0) and (u1,v1) from where to crop the image as a Vector4(u0,v0,u1,v1) var f = new BABYLON.Vector4(0,0, 0.5, 1); // front image = half the whole image along the width var b = new BABYLON.Vector4(0.5,0, 1, 1); // back image = second half along the width var options = {sideOrientation: BABYLON.Mesh.DOUBLESIDE, frontUVs: f, backUVs: b}; // this plane has half the image on the front side and the next half on the back side var plane = BABYLON.MeshBuilder.CreatePlane("p", options, scene); // this sphere has half the image on the external side and the next half on the inside side var sphere = BABYLON.MeshBuilder.CreateSphere("s", options, scene); A single texture/material but the ability to display different images on each mesh side. Default values if not passed for both : (0,0, 1,1) Sebavan, GameMonetize, adam and 4 others 7 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 1, 2017 Author Share Posted June 1, 2017 First example : http://playground.babylonjs.com/#863W03 The upper plane is the usual one. The other plane and the sphere have a different cropped image on each side (you can enter the sphere to check it). A single material/image is used for all the meshes GameMonetize and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 1, 2017 Author Share Posted June 1, 2017 I just added the support of this to the new JohnK's methods CreatePolygon() and ExtrudePolygon() JohnK and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 1, 2017 Share Posted June 1, 2017 You rock! jerome 1 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.