supertuxkart / stk-code

The code base of supertuxkart
Other
4.52k stars 1.06k forks source link

Scene manager improvement #2778

Closed MatthewsSam closed 2 years ago

MatthewsSam commented 7 years ago

Our render engine uses currently a scene manage which stores all objects in lists. While it was acceptable a few years ago, now due to the complexity of tracks the system needs something better.

To reduce the amount of polygon rendered we can separate the scene in objects and then compute the visibility of each objects. However, the current system must iterate the whole list at each frame in order to determine the visibility of an object which slows down when the scene have a lot of objects.

I talked about this issue in the opengl chan on freenode and a dev kindly wrote a roadmap describing what would need to be changed.

An overview of different systems of managing the scene

Space partitioning, multiple possibilities (pick one!)

MatthewsSam commented 7 years ago

Preprocessing, step #1 (any space partitioning technique)

Preprocessing, step #2 (any space partitioning technique)

Drawing algorithm

Object management function/methods

AddObjectToScene()

RemoveObjectFromScene()

MoveObjectInScene()

Benau commented 7 years ago

It is now in branch sp

Benau commented 7 years ago

Now I'm able to export animated mesh in a way usable in my engine now, so you only need to keep 1 exporter, also this new format features a "keyframe-only" mode exporting, useful for .blend without inverse kinetic or constraints.

@deveee assumed Xue is your favourite kart, which do you prefer (keyframed xue is 153k, all-framed is 518k, though compared to b3d 918k it is still smaller), a smaller mesh or better animated:

https://github.com/Benau/stk-code/blob/sp/allframed_xue.webm?raw=true https://github.com/Benau/stk-code/blob/sp/keyframed_xue.webm?raw=true

Mainly left-right kart moving and the flying differ.

deveee commented 7 years ago

@Benau 153k looks much better than 518k :-P The allframed_xue is a bit more smooth, but I'm not sure if it will be noticeable during playing.

Benau commented 2 years ago

I've tried intel https://github.com/GameTechDev/MaskedOcclusionCulling with https://github.com/Benau/stk-code/commit/2bfa37ee6fd6c7d5df85f370d8dbbe459e8476cf, but it turns out all devices have the same performance despite drawing few 20k tris in cocoa temple, so sorry won't bloat stk-code for little to no gain for now

Anyone is welcomed to try that commit btw