[3.x] Add occlusion via rooms & portals #142
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed @Calinou had just added a version with poly occluders, and I figured that the level would run better with the central core area as an internal room.
RoomManager
to the level.tscn, and put the Lights, Structure, Props and Core within aRoomList
spatial.Room_Structure
is the outer room, and theRoom_Core
is an internal room (using theRoomGroup
to set the roomgroup priority to 1, which is higher than the 0 default outer room priority). This means that the camera will be in the outer room unless inside the core room.rooms_convert()
is called in the level_ready()
through acall_deferred()
so there is time for setting the portal mode of dynamic objects before the conversion.Portal mode for dynamic objects
Portals.change_portal_mode_recursive()
in aPortals
autoload, which sets allMeshInstance
,Particles
andCPUParticles
.This leads to quite a performance increase for me, depending where you are in the level and what you are looking at. It varies from about 20% fps increase outside to as much as 100% increase when in the core area. Of course this depends what you are looking at, what your settings are (and hence your bottlenecks).
Occluder
s, but set them to invisible so they won't be active. Useful for comparison purposes.P
key action on the keyboard for turning on and off portals at runtime, to compare fps.PERFORMANCE UPDATE:
In combination with godotengine/godot#33340 and using small screen, with everything else low but shadows on:
Core, just to left of door, looking back (best case)
Starting position, looking at core (worst case)