Threejs / WebGL: The most efficient way for cubes?

In Threejs, the most efficient way to display a large number of cubes on an xyz grid for rendering WebGL, from the point of view of which rendering methods / indicators / parameters / material are used? Cubes should support receiving and casting shadows based on directionLight - or I can pre-calculate the side colors if this helps and is possible, but they do not have texture or special rotation. Thanks!

+4
source share
1 answer

Remember to combine the geometry. It helps LOT. up to 60 times more code. here is a post explaining why. It contains a demo actually showing the difference http://learningthreejs.com/blog/2011/10/05/performance-merging-geometry/

Another thing is to remove duplicate faces, if applicable. For example, dem.js minecraft demo removes faces from geometry. http://mrdoob.github.com/three.js/examples/webgl_geometry_minecraft.html for a demo and https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_minecraft.html#L106 for the source

+9
source

Source: https://habr.com/ru/post/1414985/


All Articles