Batching Unique value for Geom

I have a 16x16 grid game using Quads. I batch quads together that use the same material. I found out that set Override Parameter for the material doesn’t work since they become one mesh, so the override is for the overall mesh not for the individual.

Is there a way if I need to get a Dynamic Variable to basically each Grid. It is used for lighting control a value of 0 - 1. I actually only need 3 bits for my light levels.
Each grid can have a N/S/E/W/Ceiling/Floor

The lighting is Dynamic and can change so it needs to be Dynamic.

I can’t figure a way on how to do this.

Thanks for you help.

Depends how it gonna look.

Well there is Texture Atlas and batch for it, but each time batching would be too slow if it gonna be dynamic.

  1. You can use Shader UV coords 1/2/3 to determine what provided material the grid should be.

But it require you to just create mesh based grid where you provide that data, not just “batching” Quads. (and update mesh data each time grid change). I would say similar to Voxel system.

Anyway in voxel systems and in Mythruna game lightning is made similar way like you say.

  1. Use existing voxel systems for this? (well it sounds like you do a voxel kind of, because quads, not boxes, tho voxel are quads in reality, but grid is boxes)

  2. You can use Texture MASK for all grid, and just change its pixels, you can copy Terrain material for thios use-case, but then you need make sure it blend between grids like you want (idk if you want smooth texture change or not) - but it will work only for 2d space(floor/ceiling), not walls

There are probably much more ways, but what i gonna show you, is that we need to know more to provide better solution for your case. For example some image how it gonna look.

My guess is that you gonna do DOOM similar look game, but im not sure.

I’m not really sure I understand the question so my answers might be off.

  1. batch by grid so that the grid is addressable with a parameter override (or a material parameter)
  2. bake an extra VertexBuffer into the grid and somehow reset the portion representing that grid.

To me, without additional information, batching by grid seems to give the best options. If you were hand-batching your own custom meshes then there might be some tricks with an instanced buffer… but then just addressing portions of a buffer are not onerous either in that case.