I have my voxel world represented as 16x16x16 chunk meshes. I am currently working on implementing the lighting for these meshes. I can generate a lightmap (based off of one like what is used in Minecraft) that defines the light intensity for each block in the mesh, but the issue that I am having is this: How do I apply this lightmap data to the mesh? I haven’t worked with shaders before, so nothing is immediately jumping out at me s an easy solution that way, though it is probably the most efficient. The best idea that I can come up with right now is to have a second texture added to my chunks’ render meshes that is basically 16 black textures with varying alpha values to act as masks over the default block texture.
An example of the rendered mesh of an area that should be dark (cave with no light sources) is shown below. I have a feeling that it should be possible to make each triangle tinted, but I don’t know how to do that.
Thanks in advance!