Moonshine drawing shaders inside canvas = black screen
Posted: Sat Sep 09, 2023 5:26 pm
Hello fellow readers, i'm posting this question because I can't seem to get the following to work after trying different stuff all day.
My game has a fixed 16:9 aspect ratio, you can resize the window, and you can see a backdrop, but the game itself renders in a canvas that auto adjusts based on your screen (main canvas that is always 16:9) (see the orientation pictures). My idea was to also make it possible to have the game screen be a blurred backdrop behind the main canvas to make it more clean looking. Of course when applying a gaussian fast shader behind the screen (see attached gaussian picture) and drawing the main canvas inside it, it works as expected, but all the space behind the main canvas is wasted computation (since you don't see it). I wanted to split it up in 2 parts. So 2 shaders that render above and underneeth the main canvas, or left and right (depending on the letterboxing) that have the canvas size needed. I tested this method and it was wayyy faster, but I couldn't get 2 different shaders to work since I discovered that Moonshine already uses a canvas (actually a buffer and active one) itself. This means I can't move them to the desired location, so I tried drawing the Backdrop.CanvasBlur.draw() functions (Moonshine chain.draw() function) on canvasses that I could then cast to a specific location with love.draw (above and under the main canvas). When doing that I get a black screen. That's the issue here. Does anyone know why that happens? Is there another way to do it? I also tried writing my own shader, but couldn't get it to look right.
My game has a fixed 16:9 aspect ratio, you can resize the window, and you can see a backdrop, but the game itself renders in a canvas that auto adjusts based on your screen (main canvas that is always 16:9) (see the orientation pictures). My idea was to also make it possible to have the game screen be a blurred backdrop behind the main canvas to make it more clean looking. Of course when applying a gaussian fast shader behind the screen (see attached gaussian picture) and drawing the main canvas inside it, it works as expected, but all the space behind the main canvas is wasted computation (since you don't see it). I wanted to split it up in 2 parts. So 2 shaders that render above and underneeth the main canvas, or left and right (depending on the letterboxing) that have the canvas size needed. I tested this method and it was wayyy faster, but I couldn't get 2 different shaders to work since I discovered that Moonshine already uses a canvas (actually a buffer and active one) itself. This means I can't move them to the desired location, so I tried drawing the Backdrop.CanvasBlur.draw() functions (Moonshine chain.draw() function) on canvasses that I could then cast to a specific location with love.draw (above and under the main canvas). When doing that I get a black screen. That's the issue here. Does anyone know why that happens? Is there another way to do it? I also tried writing my own shader, but couldn't get it to look right.