Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

Wait but how do you render that many dice without lag?


(5 edits) (+1)

There are two ways, either you gpu instance the dice or you create a combined mesh of dice on the cpu and encode data in the die vertices. I did the latter but I think the former is probably better/easier. If you wanted to do this via gpu instancing look into DrawMeshInstanced in unity or Multimesh in godot.

For my case i also needed the dice to read from a texture so they can display the “virtual” screen. The instance obviously needs a position to draw, but also you gotta pass the pixel position of the die on the virtual screen (basically just the bottom left die gets 0,0 top right die gets 1,1)

Then you also pass in an axis about which to rotate the die. Then you put all this together in a shader. You read from the texture using those coordinates, then you rotate the die using https://en.m.wikipedia.org/wiki/Rodrigues%27_rotation_formula

Also in order to keep the polycount low I took a hi res die model and baked it down onto a simple cube with a normal map.