UPD: See the latest version somewhere below in the thread.
Debugging, to a great extent, is like a detective story.
And in both cases one needs more evidences to catch a a bad egg
This small utility makes some things more evident (actually, some functions are the same as in the Inspector tool) and helped me a lot with finding memory leakages and optimizing scenes. (If your app runs in real time for several hours even 1 texture/minute leak may result to crashes).
FInally I adopted it to PG. There are a lot of possibilities how to develop it further, including some logging capabilities and visual data presentation.
Here is the simplest version - https://playground.babylonjs.com/#938RNX#8
It is possible to use in almost any Playground example, just copy and paste the relevant part!
Here are some examples how to use it to debug with examples from Documentation:
(screenshots are made on old laptop)
TUNING
While it is extremely funny to press Space to make explosions, one may notice that the number of meshes is increasing with every explosion.
Seems that the problem is that there are conditions when emitter is created but not disposed later.
Well yes, it is JS for the JS playground. However, TS is a superset of JS, all JS is valid TS.
I’m pointing out that the TypeScript definitions may be missing something, to maintainers in the thread, perhaps there is a reason for that (ie. browser support?).
Casting performance to any and it compiles and runs perfectly fine, as expected.
That aside though this is a nice debugging tool for monitoring scene performance.
It really is just a straight copy/paste. The only change needed is casting performance to any so the compiler stops complaining about the lack of memory on the type.
Just in one day my small utility was better adopted to Firefox, ported to Typescript and one bug removed from Babylon source code. Really fascinating speed, community powered!
I added also the possibility to copy camera position to clipboard (this is very useful for quick tuning and better orientation) and lights counter - here is the latest version: https://playground.babylonjs.com/#938RNX#17
Shows camera position x, y, z or arcRotate camera alpha, beta, radius - click the button to copy to clipboard.
Performance Viewer will be a great tool. Actually most parameters from my utility could be seen at Inspector itself, but it is not always convenient.
I found that GUI suits here the best since it doesn’t block the pointer and you always have real time information about the scene.
There are a lot of parameters which could be used for optimization and reporting. For this utility it means additional tabs and functions, which I would gladly discuss
While it is good for PG, it is possible to develop TS/JS standalone extension which could be easily used in almost any Babylon environment.
The length of the function can be significantly reduced by not repeating the same text setup for each counter, and instead calling a function for that.
More than totally agree
I also added the possibility to toggle GUI with ‘g’ button.
Here is the latest JS version - https://playground.babylonjs.com/#938RNX#29
Seems that the left column is completely full now - we need more tabs
Mesh tracking label from @roland is really great helper for animations - https://playground.babylonjs.com/#39CH06#4
Probably the ability to change the Inspector CSS for semitransparent overlay also could help to get more canvas area when debugging.
Here is unfinished demo where I added some GUI buttons at the right side.
(By the way, for all GLBs there is only 1 material and 1 texture 8x8 px) - https://playground.babylonjs.com/#ZRM05R#79