How to stop shader erasing background (moonshine library)
Posted: Sat Jan 26, 2019 10:45 am
Hi all!
So I've recently started to become interested in shaders and I found the moonshine library which seems a very interesting project. I am still learning how to write and incorporate my own shaders so this library really helps me out. I especially love the godsray effect (it scatters light) and it works perfect with my game's concept.
However, the only issue I have is that whatever I try to draw underneath while using 'godsray' (and outside the moonshine wrapper - effect(function()end)) get's drawn over by the shader. Is there a way to avoid this, a workaround or another light scattering shader that someone could point me to?
I have tried putting the background inside the wrapper function and temporarily disabling the "godsray" effect but to no avail.
I am using love 11.1.
If it helps to demonstrate my code - I have a game class (using middleclass) and in it's draw function I do this:
So I've recently started to become interested in shaders and I found the moonshine library which seems a very interesting project. I am still learning how to write and incorporate my own shaders so this library really helps me out. I especially love the godsray effect (it scatters light) and it works perfect with my game's concept.
However, the only issue I have is that whatever I try to draw underneath while using 'godsray' (and outside the moonshine wrapper - effect(function()end)) get's drawn over by the shader. Is there a way to avoid this, a workaround or another light scattering shader that someone could point me to?
I have tried putting the background inside the wrapper function and temporarily disabling the "godsray" effect but to no avail.
I am using love 11.1.
If it helps to demonstrate my code - I have a game class (using middleclass) and in it's draw function I do this:
Code: Select all
function Game:draw()
love.graphics.draw(self.bg)
effect(function()
self:drawTable(player.bullets)
self:drawTable(self.bullets)
end)
self:drawTable(self.explosions)
self:drawTable(self.enemies)
end