Pasting objects to Canvas with reduced resolution.

For questions about using Classic.

Post » Wed Jun 20, 2012 8:35 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Wed Jun 20, 2012 8:47 pm

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
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Jun 21, 2012 1:41 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Thu Jun 21, 2012 3:15 pm

No problem, hope it works out =]
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Fri Jun 22, 2012 5:49 pm

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...
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Sun Jun 24, 2012 12:09 pm

Hmm, and "Before Drawing" gets nothing right?
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sun Jun 24, 2012 2:21 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Sun Jun 24, 2012 7:03 pm

Try changing the z order of the canvas. If you use "Before Drawing" you should get everything that is under that canvas.
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Sun Jun 24, 2012 7:45 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests