### Project 3: Grass Sim

Overview
One of the main problems with rendering lots of primitives, is each one requires its own draw call/position definition.

A solution to this is instanced rendering, where you give opengl a set of vertices and tell it to render it X amount of times. Since it computes everything internally from then on the cost of it is near 0.

Instanced rendering does this (pseudo code):

for 0, X do Set Instance ID DrawArrays/DrawElements.etc

In the form of this:

GL.DrawArraysInstanced(PrimitiveType.Triangles, 0, 3, X);

So now the fun part involves the shaders because each instance cannot be given a unique uniform value (which is what I do normally).

Each instance has an ID from 0->X, utilising this in interesting ways allows you to produce cool effects for practically free.

Here's what I came up with after playing around with it:

Video after adding a time uniform:

Vertex Shader Details To distribute the triangles uniformly given a number from 0 -> 10,000.

int x = int( mod( gl_Instan…

A solution to this is instanced rendering, where you give opengl a set of vertices and tell it to render it X amount of times. Since it computes everything internally from then on the cost of it is near 0.

Instanced rendering does this (pseudo code):

for 0, X do Set Instance ID DrawArrays/DrawElements.etc

In the form of this:

GL.DrawArraysInstanced(PrimitiveType.Triangles, 0, 3, X);

So now the fun part involves the shaders because each instance cannot be given a unique uniform value (which is what I do normally).

Each instance has an ID from 0->X, utilising this in interesting ways allows you to produce cool effects for practically free.

Here's what I came up with after playing around with it:

Video after adding a time uniform:

Vertex Shader Details To distribute the triangles uniformly given a number from 0 -> 10,000.

int x = int( mod( gl_Instan…