Tyrahell Posted July 16, 2014 Share Posted July 16, 2014 Hi there, Im looking for a property to draw a triangle mesh on both side. Atm my code only draw the face coolinear to the normal. Any tips ?function drawTriangle(scene) { //Let's create a mesh for our element: var triangle = new BABYLON.Mesh('triangle', scene); //Then, the points for the triangle element: var positions = [ 0, 1, 0, -1, -1, 0, 1, -1, 0 ]; //Next, we create the normals (orientation): var normals = [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; //And the indices, for the points order: var indices = []; indices.push(0); indices.push(1); indices.push(2); //Finally, we load everything in our mesh: triangle.setVerticesData(positions, BABYLON.VertexBuffer.PositionKind, true); triangle.setVerticesData(normals, BABYLON.VertexBuffer.NormalKind, true); triangle.setIndices(indices); return triangle;}++Tyrahell Quote Link to comment Share on other sites More sharing options...
celian-garcia Posted July 16, 2014 Share Posted July 16, 2014 Hi !If you want to see both faces of your triangle. You need to apply it a material and set the bacFaceCulling to false.http://www.babylonjs.com/playground/#19LRMI Quote Link to comment Share on other sites More sharing options...
Tyrahell Posted July 16, 2014 Author Share Posted July 16, 2014 Thanks a lot, did the tricks =) Quote Link to comment Share on other sites More sharing options...
reddozen Posted July 16, 2014 Share Posted July 16, 2014 Hi !If you want to see both faces of your triangle. You need to apply it a material and set the bacFaceCulling to false.http://www.babylonjs.com/playground/#19LRMI I didn't think that Babylon supported support double sided meshes. Did this change? Quote Link to comment Share on other sites More sharing options...
Temechon Posted July 16, 2014 Share Posted July 16, 2014 I don't think so, the backfaceculling attribute exists since the beginning... But I may be wrong :/ Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 16, 2014 Share Posted July 16, 2014 I confirm, backfaceculling exists since the beginning. Quote Link to comment Share on other sites More sharing options...
reddozen Posted July 16, 2014 Share Posted July 16, 2014 Yes, backfaceculling has been in Babylon for the year or so that I've been messing with it, but I thought DK told me that double sided meshes weren't supported and no plans to support it. Pretty sure that setting BFC to false just made my face black instead of transparent, and didn't show the texture. That was... months ago from blender exports though. I would love it if double sided meshes were supported. I have a lot of meshes that are like... the sail of a ship that I will have to duplicate the faces for just to show the texture on both sides. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 16, 2014 Share Posted July 16, 2014 Ah, ok, Yes this would be actually interesting to sail a boat. I also have a boat with sails. It is not possible this DK? My boat : (backfaceculling for models becomes useful in the case of the sails) celian-garcia 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 16, 2014 Share Posted July 16, 2014 This is something that requires a lot of modification in the shaders alongside unsupported webgl features Quote Link to comment Share on other sites More sharing options...
reddozen Posted July 17, 2014 Share Posted July 17, 2014 yea... looks like three.js is playing some tricks to support it. Looks like there's a "simple" fix for this in 3DS Max... Just use shell on the surface that you want to make double sided, then set the thickness down to 0.http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-Help/index.html?url=files/GUID-E38BD284-3283-4311-AC29-3F699B2F04AA.htm,topicNumber=d30e96227 Inner/Outer AmountDistance in 3ds Max generic units by which the inner surface is moved inward and the outer surface is moved outward from their original positions. Defaults=0.0 / 1.0. The sum of the two Amount settings determines the thickness of the object's shell, as well as the default width of the edges. If you set both to 0, the resultant shell has no thickness, and resembles an object set to display as 2-sided. Maybe an option in the exporter to "make 2 sided" for 3DS Max which just applies a shell to the object and sets the inner/outer to 0? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 17, 2014 Share Posted July 17, 2014 It seems is a good solution. 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.