Open dexterdeluxe88 opened 3 years ago
Hi @dexterdeluxe88 ,
The pc.Batcher instance will automatically generate batches once when the pc.Application instance starts rendering.
Loading new scenes, which basically removes and adds entities in the hierarchy won't trigger that again. You can easily do this yourself, after the new scene hierarchy has been appended by running:
this.app.batcher.generate();
https://developer.playcanvas.com/en/api/pc.BatchManager.html#generate
@leonidaspir calling this.app.batcher.generate() doesn't resolve the issue
It seems the issue isn’t with batching, but with the Static model component flag. There is some optimization there that breaks batching. If you disable that flag batching works as expected:
yep, agreed with @leonidaspir - just what I wanted to write. The static flag is not needed for static batching I believe. I'll investigate in due time, but leave it off for now please.
I don't know if this is related or not but I noticed that batching and lightmapping doesn't work together at the moment.. I don't know if it's a normal behavior or not. I tried with static flag both enabled and disabled but it doesn't change anything.
If I just call:
this.app.batcher.generate();
I can see the batching working.
If I call batching then baking:
this.app.batcher.generate();
this.app.lightmapper.bake();
The light baking won't work
and finally if I call baking then batching:
this.app.lightmapper.bake();
this.app.batcher.generate();
Batching won't work. Seems like I cannot have the cake and eat it ^_^
Anyone ran into a similar problem ?
@valentincognito - I don't have the answer to this, but it'd be worth investigating in the future. Could you please create a separate issue for it and link it to this one. If you have some simple test project to test on, that'd be fantastic as well.
yep, agreed with @leonidaspir - just what I wanted to write. The static flag is not needed for static batching I believe. I'll investigate in due time, but leave it off for now please.
@mvaligursky do you have an estimate?
yep, agreed with @leonidaspir - just what I wanted to write. The static flag is not needed for static batching I believe. I'll investigate in due time, but leave it off for now please.
@mvaligursky do you have an estimate?
I don't at the moment - as there seems to be an easy workaround (don't mark the mesh static), this does not sound like urgent at the moment.
Forum Post: https://forum.playcanvas.com/t/static-batching-for-additive-scene-loading/15069 Sample Project: https://playcanvas.com/project/723629/settings
Description
When additive loading a scene, the static batched models in this scene don't get loaded/rendered.
Steps to Reproduce