So I’m building Yet Another Voxel Engine. In my last post, JWollen pointed me in the right direction to use vertex colors. So I now get lighting and shadow maps working. My shader is pretty basic:
mixin ParadoxDefaultDeferredShader;
mixin compose albedoDiffuse = ComputerColorStream;
Every “chunk” is an Entity with a Model and two Meshes (one for solid vertices and one for transparent vertices). So one problem is that the transparent vertices are ignoring the alpha channel. I am flagging the transparent meshes with UseTransparent = true (and using deferred renderer), so I assumed the system was rendering solids first then transparents second, with the second time using an appropriate blend state. Is this not the case?
Second problem is that it seems like Paradox creates a new instance of a shader for every chunk, which slows things down dramatically. So if I have 10 chunks on screen, it seems to create 10 different shaders, and then a new shader every time a new chunk is created… My fears are confirmed in Graphics Diagnostics where I see a whole slew of setup commands run before every Draw of a chunk. Is there any way to batch models under a single effect? Or do I have to manage that by having a single Entity and Model and swapping in meshes on the fly?