As shown in the project: PlayCanvas | HTML5 Game Engine
Lightmap bake will lose the shadow data when bake again. Is it a bug or some engine updates require me to do something else? All things are fine a while ago, and I notice this change yesterday.
Looks like a bug. cc @mvaligursky
yep definitely a bug
This is fixed and will be deployed with the next engine release, thanks for the report @jack_ma
Hey, here’s another bug related to lightmap. As WebGL conext context lost ramdomly on Apple device. Even if we lower VRAM around 220MB. And after the lost, all baked scene turns black. It takes us a long time to find why this happens. Lightmap will get lost after WebGL context restore. However, when bake it again, the shadow is gone
Project is here: Scene LightTest2
https://playcanvas.com/editor/scene/1970890
- Press ‘G’ to run a graphicsDevice.debugLoseContext.
- Lightmap is missing after restore.
- Bake it again in ‘devicerestored’ callback as temporary workaround
Hi @jack_ma - I’m not sure I see what you describe. In your code you had the lightmap bake commented out. I cloned the project here and enabled it. When I press G, the scene is correctly re-baked with the shadow: PlayCanvas | HTML5 Game Engine
Your solution of re-baking lightmaps when the device is restored is a correct one at the moment. We could automatically bake the scene, but we cannot tell if the user used manual bake with some parameters / excluded meshes and similar to bake, so we cannot restored baked textures automatically.
We have related engine issue on this already, I linked this post there as well: Implement a solution for regenerating content of dynamic resources when the context is lost · Issue #3312 · playcanvas/engine · GitHub
Yeah, I mean, it was quite challenging to figure out that the baking issue was caused by the loss/restoration of context. It also took some time to discover the lightmap restoration solution. Perhaps this should be documented somewhere, like in the lightmap manual, a known issues list, or a QA section.