How to stop shader erasing background (moonshine library)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
wheelsofsteel
Prole
Posts: 2
Joined: Tue May 09, 2017 5:26 pm

How to stop shader erasing background (moonshine library)

Post by wheelsofsteel »

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:

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
Post Reply

Who is online

Users browsing this forum: No registered users and 155 guests