When does the isStatic optimization happen?

Hey everyone!

My brother and I have been working on a new PlayCanvas project simultaneously between the editor and the NodeJS version, and the isStatic optimization works fantastic for a level we’re working on in the editor! Unfortunately we’re kinda confused how this same property works in the stand-alone version. Whenever the isStatic boolean is set to true, the light simply disappears. Is it possible for this optimization to occur after app.start() somehow, possibly just before some new dynamic models are added to the scene?

The optimization works fantastic, it’s very smooth and it supports a crazy amount of lights with shadows, so we’d really like to get it working! Any tips would be appreciated!

Hi @ChandlerTwins,

So looking at the engine source code there is a prepareStaticMeshes(meshInstances, lights) method that executes on each layer the moment they get added to the renderer. It parses the scene hierarchy to find all static models and lights and prepare an optimized list of draw calls.

There isn’t an API to call that method again, since my understanding is it will have to run for the full list of your static entities. And that can take a while. But if you are ok with that you could try triggering this in your code. Study how the forward renderer does this here:

3 Likes

Yep! Just needed to run it one extra time, works alright!
That’s perfect, thanks a lot, man!

1 Like