Various Issues with Rendering and Mesh manipulation

I’m experiencing various issues, which seem to be accumulating as my code becomes bigger.
I’m getting an issue where the rendering glitches, and the rendering order seems to flip with meshes that should be in front of another mesh are suddenly behind, and other meshes start flickering.
I was also using two animation helpers to simultaneous move and rotate a mesh. The rotate has just stopped working, to the extent that I can’t even manually rotate the mesh. I’ve even tried re-writing the animations using the standard animation statements, but they just seem to just make the mesh disapear.
Are there any limitations on the amount and complexity of meshes used.
My development site is https://ukcpg.co.uk/scripts/dynamic.php
Posted script on GitHub GitHub - adrianlines67/BabylonJS-Large-Building-Creator

@Adrianlines I had a look at your dev site link, but I’m not seeing any of the “rendering glitches” you describe, except all the textures seem to be missing.

When you say " the rendering order seems to flip with meshes that should be in front of another mesh are suddenly behind, and other meshes start flickering", that sounds like z fighting and alpha blending issues.

Suggest doing a search for z-fighting (it comes up a lot) and also referring to:
https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering

1 Like

Missing textures is another issue I seem to be having. If you refresh the page, they subsequently load ok.

Browser console reports net::ERR_INSUFFICIENT_RESOURCES

It means the browser ran out of memory !! Doesn’t do it in Safari, but performance is poor in Safari.
If you reload the page in Google Chrome, it then loads ok.
Read your link, and you are right about the flickering/display order issue. I used some materials with alpha channels, and I found if I changed them to normal materials the issue lessened. I wasnt sure what used more resources, drawing meshes, or using png’s with transparency.
I’ll remove the doors and windows and draw them as meshes.

Reloading doesn’t work for me in Chrome.

I haven’t seen that error before, but Googling it seems to indicate that Chrome is being overloaded with many AJAX/network requests at the same time, so maybe your requests need to be batched?

When the script initially runs, it reads the building data from a database in a single query and creates an array. Once the script is running, it only writes to the db (using ajax) when a build cell is edited.
So I don’t think its network or ajax requests.
I’ve also removed all materials with alpha, and it’s still glitching.
It all started going wrong when I switched over to the havoc library.
I might try going back to the V1 physics libraries.

I’ve removed the avatars and most havoc physics functions and re-enabled all the alpha materials and everything is working ok again. No glitching and no resource errors.

Finally starting to understand aggregates and transparency. Did a bit of a re-write and removed some of the tranparent materials and everything is starting to come together. Also fixed resources issue.
Demo project is now working (better) :slight_smile:

1 Like