ocarlos Posted May 29, 2016 Share Posted May 29, 2016 Hi, Does Babylon.js provide a quick and easy way of programatically inverting the face of an imported object ? That is, what is inside becomes outside and vice-versa. Thanks Quote Link to comment Share on other sites More sharing options...
ecv Posted May 30, 2016 Share Posted May 30, 2016 It looks like the Mesh class has the method getVerticesData(kind, copyWhenShared). IIUC it's supposed to return an array of whatever vertex data you specify in "kind", so I guess you could ask for the normals and reverse them. As long as you don't ask for a copy the changes should apply to the mesh automatically, IIUC. Although I have no idea how to specify the kind for a normal, as BABYLON.VertexBuffer.NormalKind can't be used there... There's also getVertexBuffer(kind). Maybe wait for more help or search, but hopefully I hinted you closer to your goal and didn't introduce more confusion. Edit: Looks like this is what you're looking for: flipFaces(flipNormals) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 31, 2016 Share Posted May 31, 2016 Hey, you already found the flipFaces function Quote Link to comment Share on other sites More sharing options...
ocarlos Posted June 1, 2016 Author Share Posted June 1, 2016 Thanks, missed the function when reading the documentation... :S Quote Link to comment Share on other sites More sharing options...
ocarlos Posted June 1, 2016 Author Share Posted June 1, 2016 Hmm... the texture does not seem to get applied after I flip a face... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 1, 2016 Share Posted June 1, 2016 Can you provide a sample on the repo? Quote Link to comment Share on other sites More sharing options...
ocarlos Posted June 2, 2016 Author Share Posted June 2, 2016 Afraid not... what I can try to do is replicate this in a new project. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
ocarlos Posted June 3, 2016 Author Share Posted June 3, 2016 Made a project just focusing on the issue I am having. Just some context, the origin of my need to flip faces is some quirk in the blender model that I am using. When exported the face gets inverted (this happens in multiple export formats so I am assuming this is more of a blender issue). So quite simply I figured flipping the faces programmatically after import would fix it. quickndirty.zip EDIT: Nevermind... checking this more closely the exported model does not simply have its faces flipped, there is something more... if I turn off backface culling the model is more correctly displayed... Will try to fix this at the source, that is at blender level. Thanks for the help. GameMonetize 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.