Page 1 of 1

Is it possible to use Moonshine in a canvas?

Posted: Wed Dec 14, 2022 8:52 pm
by Bigfoot71
I'm trying to use a moonshine effect in canvas so that I only have to render once, but I always get a black screen... I've tried in lots of different orders, in using multiple canvases, etc. but still the same result, I wonder then is this possible with Moonshine?

Here is an example and I put the same code in attachments with the library if you want to try it quickly.

Code: Select all

local moonshine = require("moonshine")

local effect = moonshine(moonshine.effects.glow)
effect.glow.min_luma = .7
effect.glow.strength = 8

local canvas = love.graphics.newCanvas()

function love.draw()

    -- RIGHT RECT --

    effect(function()
        love.graphics.rectangle("fill", 650,50,100,100)
    end)

    -- LEFT RECT - not work --

    love.graphics.setCanvas(canvas)

        effect(function()
            love.graphics.rectangle("fill", 50,50,100,100)
        end)

    love.graphics.setCanvas()

    love.graphics.draw(canvas)

end

Re: Is it possible to use Moonshine in a canvas?

Posted: Tue Jun 06, 2023 11:32 am
by Ghosx
moonshine uses double buffering . From what I understand this maybe a issue with the blend mode. Can you check if changing the blend mode in init.lua:75 to this fixes the issue?

Code: Select all

 love.graphics.setBlendMode("screen", "premultiplied")
And when I work with moonshine for my game “ https://ghosx.itch.io/lost” To make vignette, fog and a little bit of glow, I think that this is the problem.

Or you can take the full screen size and transform it to the left and right.

I hope this helps you