Skip to content

fix: VOBs, NPCs, the hands and the menu no longer vanish at some places - only the world mesh is occlusion culled - #560

Open
BoroBongo wants to merge 1 commit into
developfrom
fix/dynamic-objects-not-occlusion-culled
Open

BoroBongo wants to merge 1 commit into
developfrom
fix/dynamic-objects-not-occlusion-culled

Conversation

@BoroBongo

Copy link
Copy Markdown
Contributor

What

VOBs, NPCs, the VR hands and the menu no longer vanish at some places. Only the world mesh is occlusion culled now.

  • The world scenes carry Unity's baked occlusion data (Umbra, ~45 MB in G2's world scene, from the binary-dependencies repo). Unity also applies it to renderers created at runtime ("dynamic" ones), and at some spots the baked cells are wrong. In a Khorinis alley the camera stands inside a cell that believes it's inside a wall, so everything spawned at runtime was culled when turning the head: VOBs, NPCs, the hands and even the menu.
  • allowOcclusionWhenDynamic = false for:
    • VOB and NPC meshes (AbstractMeshBuilder.PrepareMeshRenderer);
    • particle effects (VobPfxMeshBuilder);
    • the player's hierarchy (VRPlayer, checked every second for renderers added later: hands, held items, menus).
  • The static world mesh keeps the baked occlusion culling. Its renderers are part of the bake, and that's where the culling pays off.

Why

Found in the playtest: a save in a Khorinis alley where VOBs and NPCs disappeared when turning, and the menu was cut. Proved with A/B screenshots (same save, same rotation): occlusion culling on, objects gone; off, all there; with this fix and the culling on, all there.

How to test manually

  • G2, Khorinis: walk the alleys around the market and turn in place: no VOB, NPC or hand disappears.
  • Open the menu in those alleys and turn slightly left/right: the menu is never cut.
  • Performance in the city stays the same (the world mesh is still culled).

Tested in the editor (the failing save) and in a PC build with the keyboard/mouse VR simulator. Not tested with a headset yet, and nothing on Quest 2 or Quest 3 standalone.

Save/load

Nothing saved.

Known gaps / follow-ups

  • Quest standalone: the occlusion data needs a look, and most likely a rebake. Quest relies on occlusion culling more than PC does. Dynamic objects are no longer culled there either (more draw calls). The wrong cells also still cull the world mesh itself in those spots. The bake lives in the binary-dependencies repo (com.gothic.core.binaries), made with JaXt0r's OcclusionCullingTool. It should be rebaked with the current world scenes and checked on Quest (frame time in Khorinis before/after).
  • No dynamic occlusion culling for VOBs/NPCs at all now (Unity's runtime culling of moving objects would need correct baked data).

…es - only the world mesh is occlusion culled

The worlds' baked occlusion data culls runtime-created renderers as dynamic objects; at some places (a Khorinis alley) its cells put the camera inside a wall and every VOB, NPC, the hands and the menu panels vanished or got cut, flickering with each degree the head turned. Gothic meshes of VOBs and NPCs and VOB particle effects set allowOcclusionWhenDynamic = false (frustum and our distance culling still apply); everything under the player is checked once a second. The world chunks keep occlusion culling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant