Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

perf(gi): a scene with no GI yet is built 12 ms a frame instead of 3 - on a phone the first light comes in about 2 s, not 10; a moving camera keeps 3 ms

yhhec610af22c1b
diff --git a/sdk/src/gi/dynamicGISystem.ts b/sdk/src/gi/dynamicGISystem.ts
index 888c0e3ae..12970bd7f 100644
--- a/sdk/src/gi/dynamicGISystem.ts
+++ b/sdk/src/gi/dynamicGISystem.ts
@@ -279,7 +279,8 @@ export function dynamicGISystem(app: App) {
// the engine traces the field as it was, which is a window a little behind the eye and nothing worse.
if (field && waiting) {
const ts = performance.now();
- const finished = field.sdf.step(3);
+ // A scene with no GI yet is worth a few slow frames (about 2 s on a phone instead of 10); a camera that moves is not.
+ const finished = field.sdf.step(waiting.full ? 12 : 3);
waiting.work += performance.now() - ts;
if (finished) {
const w = waiting;