Hello guys
My engine is currently only capable of rendering using materials that are shared among different meshes. (Change one parameter -> every mesh has it)
So my rendering loop looks like this: for all materials m: upload common matrices (projection etc.). Use the shader. Then for all meshes associated with m: Render it after uploading model matrix.
But what if I want to instance a material (like in UE4)? This would mean that I either have to create a different shaderprogram for all different instances OR use one common shaderprogram. The last option implies that I have to update the uniforms of said shaderprogram each time I render an object with a material instance.
So I don't know whats worse: A State change or high frequency updates of uniforms which decreases my bandwidth? My question: What is the best way to deal with the problem and how would a possible render loop look like?
Thank you.
↧