In a Babylon scene, I know that you’re able to view the data using scene.debugLayer.show(). Is there anyway to extract the information on the server and display the information (like polycount, total number of textures, etc?)
Does this require me to use BABYLON.SceneLoader()?
You would have to “load” the file on the server, get the data, then return the info for use by the client.
Loading DOES NOT mean you need to have a webgl context though. If you only want a handful of stats, and your http server had the ability to parse JSON files, you could do something like in JS of:
const data = JSON.parse(rawData);
let polyCount = 0;
for (const mesh of data.meshes) {
polyCount += mesh.indices.length / 3; // index lists all triangles coords, div by 3 gives poly count
}
// now do something with polyCount
You would have to know a little about the format of a .babylon though. Not too tough.
Unless this changed a lot, I would just get the info from debug, and key it into a small file by name.
So if I’m understanding you correctly, I don’t even have to have Babylon to be able to obtain this kind of data? I am using a NodeJS server. Does this also work with Maya and 3ds Max files?
That is correct. A .babylon file is just a text file stored in JSON format. BJS calls JSON.Parse() as well when loading. If you do not wish to actually build with it, just do the same & get the lengths or counts, or whatevers.
Most likely no to anything that is not text or not JSON, like .glb’s, .blends, max or Maya models.