I have a conceptual problem. The problems comes with the floor I'm rendering and the count of objects. The idea was to reduce rendering with BSP implementation, but the problem that I hit was that the floor has huge object (triangles that range through the entire scene). Should I put those objects into the parent nodes of the BSP or try to split them into smaller triangles.
Yes, split them.
The concept of BSP trees is almost as old as it's possible for something to be, in terms of graphics programming. Their use dates back to the Quake engine in 1996, and the Quake engine and its tools provide a sample implementation that has since been released under the GNU GPL, although you should be aware that the code isn't quite up to modern standards.
- Quake engine source code: https://github.com/id-Software/Quake
- Quake tools source code: https://github.com/id-Software/Quake-Tools
Michael Abrash's Graphics Programming Black Book also provides some conceptual discussion of BSP trees in its later chapters, as well as some sample code of more generic implementations, and this is also available for free online in multiple places, for example: http://www.jagregory.com/abrash-black-book/ (look from Chapter 59 onwards).
1\$\begingroup\$ BSP in game development is even older than Quake. I've seen a talk by John Carmack a while ago where he said they first used it in DOOM. \$\endgroup\$– PhilippMar 13, 2019 at 12:36
\$\begingroup\$ @Philipp - true, but it was a 2D BSP in Doom. \$\endgroup\$ Mar 13, 2019 at 12:40
\$\begingroup\$ @MaximusMinimus BSPs function the same way regardless of dimension the space though. \$\endgroup\$– PikalekMar 13, 2019 at 13:49
\$\begingroup\$ Thnx for the link to the book. This makes a bit more sens. I need to implement a logic that will split the hug objects to solve the problem at hand. \$\endgroup\$ Mar 14, 2019 at 9:38
I found this lecture quite usefull to understand when to cut objects. http://ksuweb.kennesaw.edu/~plaval//math4490/bsp.pdf