Advertisement

How to handle lighting maps in a batch renderer

Started by March 26, 2022 02:28 PM
1 comment, last by MJP 2 years, 7 months ago

I want to implement 4 lighting maps(diffuse, specular, normal and emission) for each fragment and I could implement this by using a texture array or a texture atlas(each lighting map will have different texture coords). I don't want to make mandatory all the 4 lighting maps for all textures so I would need to use some default lightning maps. The problem is that in both cases I would need to duplicate the default maps into the texture array/texture atlas. This makes me think to use a different texture per lighting map but isn't this too much for a batch renderer?(since a GPU has generally 32 texture slots)

If you use a texture array where each “channel ” (diffuse/spec/normal/emissive) has an associated index for each material, you could use a special index to indicate that it should use a default value instead of sampling an actual texture. Then in the shader you could just branch on checking for that special index and skip the texture fetch. You could also do this with an atlas approach as well, although arrays are definitely easier to work with if they fit your requirements.

This topic is closed to new replies.

Advertisement