gamefan Posted January 6, 2016 Share Posted January 6, 2016 Greetings, This is my first post here but I have been using babylon.js for a while. As the subject explains I am not sure if this is intended. My designer colleague creates a simple cube and exports the babylon file. When I open the file in the browser I get 24 vertices when the mesh is "optimized" and 36 when not. A cube when created in blender and exported creates 8 vertices which is the expected number. The general idea is to reduce the number of vertices for performance. Can anyone throw some light on this? Thanks In Advance Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 6, 2016 Share Posted January 6, 2016 Hello, A vertex is composed of a position and a normal vector. If normal are different, then there is two vertex. Apply this behaviour to a cube and you have 36 vertex (24 when optimized). Quote Link to comment Share on other sites More sharing options...
gamefan Posted January 6, 2016 Author Share Posted January 6, 2016 Thank you for your reply. So each vertex contains 3 vectors. But why the difference in blender and max? Could I be missing something on blender? I have a mesh that is supposed to contain 10 position vertices. Querying this returns array of 90 length:App.scene.getMeshByName('roofing3').getVerticesData('position').length;which explains 30 vectors[x,y,z](1position and 2 normals) Querying this also returns array of 90 length:App.scene.getMeshByName('roofing3').getVerticesData('normal').length; Shouldn't they have returned different lengths? Please master, enlighten me Quote Link to comment Share on other sites More sharing options...
chg Posted January 6, 2016 Share Posted January 6, 2016 So each vertex contains 3 vectors.What? The information you export for a vertices is variable, though position, normal and color are usual I guess... that's 3 vectors, is that what you are confirming? If you are asking about the reason there are 24 verts... it's nothing to do with that. it's because normals are per vertex not per face. So for an object with flat shaded faces the normals for the edges of the faces can't be shared; and even though the vertices for the edges/corners of each face occupy the same position for as the vertices for neighbouring faces they must be duplicated for the adjacent faces because the normals point in different directions (if your still having trouble with this Google it for a pic or possibly ask your modeller to show you) TLDR: creases/hard edges in models need duplicated vertices, as does any discontinuity in a property you are exporting (eg. could be a crease in UV wrapping in a textured model) But why the difference in blender and max? Could I be missing something on blender?There should be 24 verts from Blender too... sounds like you messed up smoothing or normals or merging verts or something (ie. the shading on a cube with only 8 verts will look quite wrong) I have a mesh that is supposed to contain 10 position vertices.What do you mean by a "position vertex"? Quote Link to comment Share on other sites More sharing options...
gamefan Posted January 6, 2016 Author Share Posted January 6, 2016 Now I understand. Thanks a lot. There should be 24 verts from Blender too... sounds like you messed up smoothing or normals or merging verts or something (ie. the shading on a cube with only 8 verts will look quite wrong)I does look wrong. Never gave a thought to that, was too concerned with the numbers. What do you mean by a "position vertex"? I meant points. 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.