wgpu-rs brick rendering (10,000)
Working on creating a lego-adjacent physics simulation and learning rust and wgpu on the side. Used instancing to make a naive rendering system for the bricks. Vertex Buffer is just a cube with normals, texcoords and an index matching vertex to side so that the texture repeat can be done with modf in the fragment shader. Each instance has model affine (3x4 over 4x4), normal matrix, color, integer bitmask that sides query to see if they get inlet or outlet studs or not, and size. Scene renders around 10,000 bricks without hiccups through instance buffers. I have not tested dynamically updating the buffers (this will be next demo). Based off of metrics, I plan on dividing bricks into static (instance buffer) and dynamic (uniform buffer). For rendering culling optimizations I am going to look into a bounding-volume hierarchy or compute shaders. After that, physics is the goal.
Download
0 formatsNo download links available.