horde3d / Horde3D

Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.
http://horde3d.org/
1.55k stars 308 forks source link

Improved culling performance #160

Closed algts closed 4 years ago

algts commented 4 years ago

Currently Horde3D is a CPU bound engine and, judging by the profiling, on some scenes at least 30% of all time is spent in culling. All scene is culled and sorted multiple times during rendering (for Chicago sample it is at least 9 - 1 for geometry, 1 for light, 7 for shadow mapping).

Now, all culling is performed before rendering. It is divided into three steps. First, it gathers camera and lights views and performs culling for them. Second, it computes crop matrices and frustums for better shadow quality - second culling is performed for new views. Third, final shadow frustums and views are calculated - third culling is performed.

With this scheme, performance in Chicago scene increased by 40-50% (general case) with peaks up to 2 times performance increase. For Knight sample it is around 10-15%. More performance will be gained on scenes with lots of lights and shadows.

It should be pretty stable and reliable, but some small bugs may still be there.