How to handle lighting maps in a batch renderer

Started by
1 comment, last by MJP 2 years, 1 month 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)

Advertisement

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