Instancing, potential performance gains and issues?
Posted: Sat Jun 20, 2015 6:40 pm
Okay, I'm not entirely sure what the performance gains of instancing is, since my game is built with a lot of blocks, which method would be faster at runtime:
Generating all blocks that are rendered as unique meshes (those with the same materials should still end up in the same draw call to my understanding) or to have each block of the same type be an instance, say of block.grass
that way I'd have an off sceen master list of all blocks and just use an instance of it whenever it needs to be drawn.
is this faster, equivalent or slower? (it should use less memory and make my material handling logic simpler)
Does this interfere with VBOs? What potential issues could using an instance of each block have? (non animated, mind)
I chose open discussion for this because I'm more interested in it from a conceptual point of view based on Irrlicht's implementation of the various concepts, beginner's help also feels somewhat appropriate but I opted for putting it here since it's not a coding question per se.
Anywho, here's a scenario for you in case you need to know the scale we're talking about:
Each chunk has 64^3 blocks in it, I have 64 loaded at any time, if we assume half are empty and half of the remaining are underground then we can assume that there are 16 chunks that are visible with blocks in them, then we can further assume that only 1/10th of the blocks per chunk are visible at any time (on average, this is actually a lot more than real life but we're assuming terrible case)
that'd yield 1258291.2 cube faces visible (assuming average 3 visible per cube, again worse than real life).
All these cubes are of one of these three types: Grass, Dirt, Stone.
In this case, would instancing improve performance or not? (I don't really understand how it works), if so would it interfere with VBOs? (perhaps one would put all cubes in the master list into a VBO since they won't change?).
This is mostly hypothetical at this point, I have no plans to implement instancing unless there's a significant performance gain over storing the meshes manually (since I could always figure out how to do greedy meshing to optimize out redundant faces)
Generating all blocks that are rendered as unique meshes (those with the same materials should still end up in the same draw call to my understanding) or to have each block of the same type be an instance, say of block.grass
that way I'd have an off sceen master list of all blocks and just use an instance of it whenever it needs to be drawn.
is this faster, equivalent or slower? (it should use less memory and make my material handling logic simpler)
Does this interfere with VBOs? What potential issues could using an instance of each block have? (non animated, mind)
I chose open discussion for this because I'm more interested in it from a conceptual point of view based on Irrlicht's implementation of the various concepts, beginner's help also feels somewhat appropriate but I opted for putting it here since it's not a coding question per se.
Anywho, here's a scenario for you in case you need to know the scale we're talking about:
Each chunk has 64^3 blocks in it, I have 64 loaded at any time, if we assume half are empty and half of the remaining are underground then we can assume that there are 16 chunks that are visible with blocks in them, then we can further assume that only 1/10th of the blocks per chunk are visible at any time (on average, this is actually a lot more than real life but we're assuming terrible case)
that'd yield 1258291.2 cube faces visible (assuming average 3 visible per cube, again worse than real life).
All these cubes are of one of these three types: Grass, Dirt, Stone.
In this case, would instancing improve performance or not? (I don't really understand how it works), if so would it interfere with VBOs? (perhaps one would put all cubes in the master list into a VBO since they won't change?).
This is mostly hypothetical at this point, I have no plans to implement instancing unless there's a significant performance gain over storing the meshes manually (since I could always figure out how to do greedy meshing to optimize out redundant faces)