I am creating a voxel game (everything is a 10x10x10 cube) but realized quickly that there is no good way to apply a specific texture on ONE side of a cube mesh created by
Code: Select all
sceneManager->addCubeSceneNode(x);
so what I did instead was create a cube out of 6 different plane meshes created by
Code: Select all
irr::scene::IMesh* plane= geomentryCreator->createPlaneMesh(irr::core::dimension2d<irr::f32>(1, 1), irr::core::dimension2d<irr::u32>(10, 10));
sceneManager->addMeshSceneNode(plane);
// I create 5 more planes below in my code and rotate them correctly
Before the change to plane meshes I got an average of 160 FPS with 100 x 100 cubes = 10 000 cubes (10K meshes). Now when I create 40 x 40 cubes using planes = 9 600 faces ( 9.6K Meshes) I get about 4 FPS. I optimized the cube rendering by removing sides that are directly in contact with other meshes, reducing the number of sides to about 3 200, then I further optimized this by removing plane meshes that are below the player, since they are not visible, reducing the number of plane meshes to 1 600. With about 1 600 plane meshes loaded instead of 10 000 cube meshes I get 40 FPS.
Why do I get 40 FPS when loading about 1 600 plane meshes but I get 160 FPS when loading in 10 000 cube meshes?
I am on Windows 8 using Irrlicht 1.8.3
Edit: I remove the plane meshes that are not visible since they are in direct contact with another wall (plane mesh) from another cube by doing this: