Is it possible to use Moonshine in a canvas?

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
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Is it possible to use Moonshine in a canvas?

Post 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
Attachments
example.love
(24.31 KiB) Downloaded 171 times
My avatar code for the curious :D V1, V2, V3.
User avatar
Ghosx
Prole
Posts: 25
Joined: Mon Jun 05, 2023 5:53 pm
Location: Earth
Contact:

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

Post 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
My Itch.io profile page: https://ghosx.itch.io/ see ya :3
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests