Alpha of one texture applied to another?
Posted: Sun Jul 28, 2019 6:37 pm
Hi folks,
Long time Love2d user here.
I'm making an old-school RPG and I'm using two textures to show the world 'map' screen (not the main display).
1) Texture 1 stores data such as the values of various tiles in the 'r' channel, and flags tiles you've seen in the 'g' channel.
2) Texture 2 stores a 'pretty' map using all the rgb values as normal.
Now, I want Texture 2 to be drawn using the 'g' channel of Texture 1 as alpha, so I can draw it over parchment or something, with only the bits you've seen being visible.
What's the most sensible way to combine 2 textures like this? Draw to a canvas, and then draw in some 'black=alpha' mode? Can I send 2 textures to my shader and combine them in there? Any ideas much appreciated.
Long time Love2d user here.
I'm making an old-school RPG and I'm using two textures to show the world 'map' screen (not the main display).
1) Texture 1 stores data such as the values of various tiles in the 'r' channel, and flags tiles you've seen in the 'g' channel.
2) Texture 2 stores a 'pretty' map using all the rgb values as normal.
Now, I want Texture 2 to be drawn using the 'g' channel of Texture 1 as alpha, so I can draw it over parchment or something, with only the bits you've seen being visible.
What's the most sensible way to combine 2 textures like this? Draw to a canvas, and then draw in some 'black=alpha' mode? Can I send 2 textures to my shader and combine them in there? Any ideas much appreciated.