jerome Posted June 17, 2016 Share Posted June 17, 2016 Hi people, I just added a new optional parameter, called invertUV (boolean, default false) to every ribbon based shapes : ribbon, tube, lathe, standard and custom extrusion. var rib = BABYLON.MeshBuilder.CreateRibbon("r", {pathArray: paths, invertUV: true}, scene); This swaps the U and V coordinates at geometry construction time. What is this for ? Imagine you've got two different meshes, say, a tube and a sphere and they share, for performance reasons, the same material/texture. You notice then that the texture is applied on to the tube the wrong way (horizontally, for instance) compared to what you expected, but the right way on the sphere. If you build your texture by rotating the image for 90°, you will have then a right textured tube but a wrong textured sphere. So instead of making two different images and to use then two different textures/materials to solve your problem, you can now just invert the UV on the tube and its texture will switched horizontally/vertically. [EDIT] : 2 tubes, one material/texture, 2 different orientations http://www.babylonjs-playground.com/#G6DG0#8 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 17, 2016 Share Posted June 17, 2016 coooooooool! thx J! jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 17, 2016 Author Share Posted June 17, 2016 I guess I could maybe code this little feature, what is really light in terms of LOC, for any other CreateXXX() methods (not ribbon based) : sphere, cylinder, etc. And also I may code some uScale, vScale for the geometry, the same way. Need to study this. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 17, 2016 Share Posted June 17, 2016 Hi Jerome! Off-topic a bit, but i had a thought about materials on tube INSIDES, and if your new invert parameter would work fine, there, too. Then I realized I had never-ever textured the inside of a tube... and I started thinking about side-orientation and mat.backFaceCulling and junk like that. *shrug* They are things that need thinking-about sometimes, as you know. http://www.babylonjs-playground.com/#G6DG0#9 Should we be seeing textures on the outside of 2 tubes that are backside-oriented? I said to myself... "Self, that is the backFaceCulling on the material set false"... so I set it true. It did nothing. One could ask one's self... what IS the back-side of a back-side-oriented tube? I came to a conclusion. I need more coffee. Quote Link to comment Share on other sites More sharing options...
jerome Posted June 17, 2016 Author Share Posted June 17, 2016 actually, you made a mistake in the MeshBuilder way of calling : http://www.babylonjs-playground.com/#G6DG0#10 the parameter sideOrientation must be inside the options parameter : {} [EDIT] same souble-sided http://www.babylonjs-playground.com/#G6DG0#12 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 17, 2016 Share Posted June 17, 2016 ahh... hahah... DUH Wingy. hehe. thx J! 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.