Is it possible to color/tint a tile layer?

(Darkhog) #1

I would like it so I can have several collision tile layers each holding different kind of collision map marked with different colors, but all using a common collision tileset so I can save space on what are essentially duplicates of tileset graphics, just with different color and also have an easier time adding new collision shapes as needed by just editing a single file.

(Thorbjørn Lindeijer) #2

It would be a nice feature, but it is currently not possible. The reason this isn’t trivial to implement is that QPainter does not support color multiplication, so in order to implement this we’d need to manually generate colored copies of the tiles, which would need to be cached for performance reasons.

I’ve personally been putting off implementing such a system, with the assumption that eventually we’d anyway port the whole thing over to more modern graphics API (either OpenGL directly or using the Qt Scene Graph), where fragment shaders are available for doing this stuff.

(Darkhog) #3

I see what you’re getting at. Though I’ve thought it’s already using openGL since sometimes (mainly when opening file or showing layer for a first time) I see some weirdly warped quads for a split second (nothing major really, so didn’t feel the need to report it).

(Thorbjørn Lindeijer) #4

Yes, you can turn on OpenGL mode (though it has some bugs and performance issues, so I generally don’t recommend it). However, it doesn’t help with this feature since the OpenGL rendering engine is in Qt and accessed through QPainter, which does not offer color multiplication in its API.