Need advice: How to apply PBR for greedy meshed voxel models

You can implement a Vertex and a Fragment shader in PlayCanvas completely custom if you like and your linked article seemed to have a solution for the texturing by using the whole Texture repetition thing and fractional vertex positions - that code looked like it would be possible to implement in PC.

Every new material / mesh is a draw call so you are going to get a performance hit if you use multiple materials or multiple textures. In a simple world you could group by materials and ensure only 1 draw call per material but you’ll run into the limit of the number of vertices per material in any world that is non-trivial - causing you to create multiple meshes by material, this is tending towards the same problem of lots of state changes and no chance of frustum culling either.

Really a Model is a convenient collection of associated meshes - maintaining a low number of models doesn’t help much if you have lots of meshes within them. Then of course there’s the number of triangles which you are already optimising with the greedy algorithm.

If this was to run on mobile you’d be massively trying to reduce the number of draw calls/state changes/material switches in my experience - but the trade off is 4x the memory being used and a more complex Vertex Shader that is doing 4x the texture sampling work and a weighted average. With a low number of textures to apply the multiple mesh approach will be more performant, but as the number of textures rises I’d imagine that all of those switches would cause a problem.

Another thing you could do is have multiple textures in one shader and then use something like the vertex colour or another vertex attribute to switch between textures - not sure if there is a limit on the number of 2d samplers or if the switching of 2d samplers would cause a pipeline glitch - I’d have to leave that to an expert or some experimentation!

I haven’t looked at your code, but I’m presuming you are using vertex colours at the moment. Mixing vertex colour tinting with textures can create a wide array of possibilities without the need for so many textures.

My temptation would be to go with the technique in the article you linked and add vertex colour tinting.