I thought I saw this question somewhere else on the forum, and then couldn’t find it when I looked again, so I apologize if this has already been asked.
Is it possible to set different shader properties for individual layers of tilemaps? It seems like something that should be able to be done, as I imagine making a darker background layer is probably not a rare thing. However, according to the API reference, the only way to set a property such as tint is to do it for the entire map:
function init(self)
tilemap.set_constant("#tilemap", "tint", vmath.vector4(1, 0, 0, 1))
end
For anyone’s that’s been watching my devlog, you might have noticed that I mentioned I wasn’t using tilemaps in order to have more flexibility with tiles - after some performance issues, it seems that having a very large number of sprites is quite costly performance-wise. When I ran the profiler a few days ago (sorry, I don’t currently have access to a screenshot) I found that the process that was taking enough time to drop framerate below 60 fps was “game object”. Maybe it’s something related to sorting z values when determining render order so that transparency works properly - I forget the complexity formula for that but I think that sorts tend to take around O(n^2) which could be a problem with 1024+ sprites. Also there’s other processing going on for objects I’m sure, the point is large numbers of sprites don’t work well.
That being said, I am now transitioning to tilemaps to improve performance - in the case that it isn’t natively possible to tint individual tilemap layers different colors, would it be practical for performance to have two tilemaps stacked like layers but with different tints? If not, I’ll look into writing a shader to darken the tilemap’s background.