Currently my scene has 222 visible objects (1,296 faces). 37 of the objects (216 faces out of the 1,296) are unique, the rest are copies from the original, but translated 10 points to the left. In each group of 37 objects, 24 of the faces are using transparent textures.
The world has 2 lights (ambient + 1 light with low intensity) right now, and I don't yet see a need to add any more lights
= Object breakdown
- 12 objects (2 faces each), transparency enabled
- 12 objects (12 faces each), no transparency
- 12 objects (2 faces each), no transparency
- 1 object (24 faces), no transparency
When running the game, I get an average of 10 fps. The sections of the program which use the most cpu are:
World.renderScene (@ 57.1%)
- Object3D.transformVerticies (@ 46.8%)
- Object3D.render (@ 41.3%)
- VisList.sort (@ 10.1%)
World.draw (@40.5%)
- GLRender.drawVertexArray (@ 100%)
note: All of those classes are from the engine
My question is, instead of creating all 222 objects, I just create the 37 objects. Then each time the scene needs to be rendered, it's moved to the leftmost visible object spot, textures are applied, render to framebuffer, move 10 to the right, re-texture, render again, and repeat till the object is out of the camera view. Or would this just lower the memory requirement and keep the cpu still at a high (or higher) amount?
I can not merge the objects into 1 whole object, because I would lose the object names (assumed). The names are needed so the 3 groups of 12 objects can have their textures changed dynamically during game play.
Attached is an image of what the objects look like. All of the per-object details have been stripped for the example image, the framerate is still the same though.