Pasting objects to Canvas with reduced resolution.

This forum is currently in read-only mode.
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • I'm trying to paste a Canvas which is capturing a layout into another Canvas, but with halved/quartered/reduced resolution.

    The reason for this is that I need to apply several layers of PS blur and that causes a major slowdown at full res.

    Using the Resize Canvas options even before the Paste action cause the capture to be either zoomed in or distorted making this approach seemingly pointless.

    A workaround I've managed to use is creating an itermediary Canvas, which captures the source at full res, gets shrunk to the lesser res and gets pasted into the final Canvas, which has to be at the lower res since game start. Lastly that Canvas gets upscaled to the proper res.

    I seem to get a performance increase which more or less scales with the downresing factor, but this solution is very cumbersome - does anyone know of a better way to directly paste stuff into Canvas, but with a lower resoltion?

    Thanks.

  • If you're just using the final canvas to display and scale the image, you might be able to paste it into a sprite using the Texture Setter plugin by R0j0hound

  • I thought about it, but since Texture Setter does not actually copy pixel data, but texture memory location (as far as I know), the "given" texture will be of the same resolution as the source...

    You have given me a different idea however, I could replace my initial fullres Canvas with a Sprite with Texture Setter... Since Texture Setter is so much lighter on resources than actually pasting pixels, that would be (in theory) a performace boost.

    I'll post back when I actually try this out - thank you for your help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • No problem, hope it works out =]

  • Sadly, that solution did not work. There's a timing mismatch between TextureSetter and Canvas, I believe, when Canvas grabs the layout "After Drawing" - I simply get my original texture...

  • Hmm, and "Before Drawing" gets nothing right?

  • Yes, but that's because the base canvas from which I'm pasting the data is itself capturing elements drawn on a per-tick basis - "Before Drawing" simply gets me a blanks slate, since the data hasn't been drawn yet.

  • Try changing the z order of the canvas. If you use "Before Drawing" you should get everything that is under that canvas.

  • I've tried that.

    The Canvas that's capturing the layout is in its own layer, above everything it's supposed to capture.

    Additionally, I had to put a pixel shader on one of the lower layers (Offset, since it doesn't do anything on default values), so that the Canvas would capture at all - a trick I learned on the forum.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)