filbs111 / 3sphere-explorer

visualising a 3-sphere from the inside in webgl
5 stars 0 forks source link

use fewer draw calls #7

Open filbs111 opened 7 years ago

filbs111 commented 7 years ago

currently drawing separate object - at time of writing, for 8-cell and 24-cell. this is inefficient because lots of gl draw calls - gl prefers things to be buffered up in batches allegedly

ability to combine meshes (eg all cells) into one big one would be useful. should include support for projected objects - like the shader which takes 3-vector vertices has, but into a 4-vector shader. expect this can be done by using non unit 4-vector verts, allowing the same 4-vec shader to be used for projected and non-projected objects.

filbs111 commented 4 years ago

instanced rendering using extension (to webgl1) implemented in 684b777d23900cd0cf71238ad09c0e80a1880d03 and subsequent commits. This functionality is standard in webgl2. This allows drawing of many instances eg for different pose matrices with single draw call. Earlier solution was to make a single buffer contain many copies of an object as 1 mesh. See objects enabled by ui switches - eg single buffer towers. This may still be useful. TODO find out whether vertex shader work done to instance variables, and to vertex data before operations that use both, has a per vertex or per instance cost, or if is per vertices*instances. Also, what is performance of editing buffers to move objects in "singlebuffer" implementation (edit all verts for that object), vs instanced (edit only matrix)?