Hazardus Posted October 29, 2015 Share Posted October 29, 2015 I'm trying to wrap my head around submeshes so that I can built something similar to BABYLON.Mesh.MergeMeshes, but maintain separation via sub-meshes and materials via mutlimaterial In this PG, http://www.babylonjs-playground.com/#28EUMN#21, I cannot seem to comprehend the relationship of indexStart and indexCount The same goes for this PG, http://www.babylonjs-playground.com/#1FSS3J - how do I color both faces of the Y axis? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 29, 2015 Share Posted October 29, 2015 Let's imagine you have 30 indices (10 faces).IndexStart for the global object = 0IndexCount for the gobal object = 30 Now let's say you want to create a submesh for face 1 to 3:indexStart = 3 (index 0, 1 and 2 are for the first face)indexCount = 3 * 3 (3 faces) Does it makes sense? Quote Link to comment Share on other sites More sharing options...
Hazardus Posted October 29, 2015 Author Share Posted October 29, 2015 Somewhat. In the 2nd PG example, how would I go about making the positive Y face(s) green as well? I think this would help clear it up for me. I expected this to work:var submesh1 = new BABYLON.SubMesh(0, 0, verticesCount, 0, 12, box);var submesh2 = new BABYLON.SubMesh(1, 0, verticesCount, 12, 12, box);var submesh3 = new BABYLON.SubMesh(2, 0, verticesCount, 24, 12, box);24 vertices & 36 indices total Scratch that, I copied from another PG example and didn't notice it was using emissiveColor. It does show it working as expected now that it's diffuseColor: http://www.babylonjs-playground.com/#1FSS3J#1 The sphere one was tricky to me because of the numbers it used. I understand now the numbers depend on the segments used in the sphere. Here's a PG with even numbers! http://www.babylonjs-playground.com/#28EUMN#22 Thanks for helping me clear this up! Quote Link to comment Share on other sites More sharing options...
jerome Posted October 30, 2015 Share Posted October 30, 2015 if it's only for a box, check this also : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors I guess that I will implement it then for the cylinder and the sphere (property "hasRings" up to come) 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.