I’m using instancing to render millions of quads in opengl, and it works okay. The base quad has 6 vertices, and each instance has a vec3 for its position. However, for each instance I need to calculate some vectors based on the instance’s position. If I do this in the vertex shader, I would calculate these vectors 6 times for each instance. Is there a way to calculate them only once per instance?
Before anyone mentions the geometry shader, I used the geometry shader before but I switched to instancing because it was slow. Perhaps there’s a way to use both? And is it beneficial?