JackFalcon Posted May 16, 2018 Share Posted May 16, 2018 I see a plane can be created as {sideOrientation: BABYLON.Mesh.DOUBLESIDE}, But is it possible to make a plane which is FRONTSIDE by default... and then DOUBLESIDE dynamically at runtime? CONTEXT: a plane is imported by blender (as a complex shape), it is DEFAULT FRONTSIDE. After many user interactions the plane then can become DOUBLESIDE . How to do this? Without it being DOUBLESIDE on the blender import. Feeble attempts in this playground: https://www.babylonjs-playground.com/#LXZPJK#53 There is a delay, and then tries to: 1) convert directly plane.sideOrientation = BABYLON.Mesh.DOUBLESIDE (no change) 2) and it seems possible to clone the mesh and re-create it with DOUBLESIDE (but complications with height,width, rotation, performance overhead, etc) So, curious: Is there a way to dynamically apply DOUBLESIDE to a plane? 3) if not, will probably blenderfix...etc. : ) Thanks, Quote Link to comment Share on other sites More sharing options...
Gijs Posted May 16, 2018 Share Posted May 16, 2018 This function gets called in the end of the creation function when you create a BJS mesh like a plane: https://github.com/BabylonJS/Babylon.js/blob/67e5c07c225f02fc3a880ea7ccb1fa8332687595/src/Mesh/babylon.mesh.vertexData.ts#L2729 So that's how meshes get their sides changed from the initial front side; their vertex data get changed. That's my 2 cents. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted May 16, 2018 Share Posted May 16, 2018 This is not possible because a newly created double-sided mesh has different geometry than a single sided one : twice more vertices and facets actually. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted May 24, 2018 Author Share Posted May 24, 2018 ! @Gijs and @jerome, didn't see you respond. Tips are excellent! Thank you for confirming variation on geometry, had no clue. : ) Makes sense. SOLUTION: Because the context involved blender-import, as usual, solution involves a BLENDERFIX. Tried 3 things: 1) checkbox for BackFaceCulling (unchecked) === seemed to have no effect. 2) Add Modifier -> SOLIDIFY -> Apply (for each plane) in edit mode === it works, but changed rendering, because geometries changed.... 3) Found Vertex Data Object -> checkbox -> DOUBLESIDED trying that... === seemed to have no effect. SOLUTION: going with solidify. : ) Gijs 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted May 24, 2018 Author Share Posted May 24, 2018 Nice option, tried it, and failed. But reading your steps carefully... I didn't clone the indices, and then update vertex data. Makes sense. Will try someday. Thx. Out of likes for the day.... The variation I tried was to create a new plane DOUBLESIDED, maybe that would work to do that then update vertex data? Worth a try. Not sure if it needed reverse or not. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted May 24, 2018 Share Posted May 24, 2018 whoops sorry aFalcon, I hid my answer cause I thought this was solved for some reason. Yeah after you manipulate the vertex data you need to apply it to the mesh. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted May 25, 2018 Author Share Posted May 25, 2018 @Pryme8, for use in the future... "take your indices clone it to a new array, reverse the array, and concat it to the original indices array, then update vertex data." ? Pryme8 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.