Funky Koval's Forum Posts

  • I know this is more of a shader request, but having taken a look at erase.fx, I thought someone could help me:

    What I need is a shader that works like Erase, but instead of taking the alpha channel and erasing with it, I'd like it to take one of the color channels instead.

    I need it for pasting transparency into a Canvas, where the opacity would be stored in one of the color channels. I already tried the Grayscale To Opacity shader with Erase on top of it, as well as through an intermediate Canvas, but it didn't work.

    Thank you in advance.

  • Thank you for the example file - yes, I know of point/per-pixel overlap tests.

    What I failed to mention is that I'm detecting occlusion in an environment comprising of 3dObjects and Sprites with displacement - overlap tests won't work on these, due to the collision masks not being accurate/updated...

    The Image Manipulator color picking was supposed to allow me to skip the flare drawing routine in case of occlusion, instead of drawing it and masking it over...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • Thanks for the sample file.

    I was affraid it was the GPU-CPU data transfer...

    Unfortunately, I can't delay the color data collection by a tick, as the number of points to be sampled varies and the sampled data is used to construct just a portion of the final rendered frame.

    To give a bit more info, the colors are sampled from a depth pass of a scene and determine if a "light locator" (just a uniformly colored Sprite) is occluded by other objects - if the sample indicates it's not - draw a lens flare, if it is - do nothing and iterate to the next locator.

    Since I've posted, I came up with a more crude way of getting this "occlusion" data - the Capture Canvas still gets a part of the depth pass at the Light Locator coordinates, the lens flare is always drawn, but then the Capture Canvas gets stretched to fit the entire screen and is multiplied over the flare - non-occluded Capture Canvasses will be white, giving no change, while occluded ones will be black - blacking out the flare.

    It's an extra set of drawing and pasting instrucions, but so far performance doesn't suffer. I just waste 2MB of VRAM for the fullscreen flare Canvas.

    Thanks for your help.

  • Slightly related to my previous issue...

    I have a Sprite from which I need to sample four color values from four different locations and paste them into an Array in the same cycle. To do that, I create a very small "capture" Canvas and loop through all the locations, moving the small canvas, pasting the Sprite onto it, copying the Canvas into an Image Manipulator and finally getting the Array value using Get R/G/B form the manipulator...

    The problem is, Image Manipulator only seems to catch the last color value. All the other steps execute properly, except for this particular one... Does anyone have any idea why this is happening? And is there a workaround?

    Here's a .cap that shows the problem:

    sendspace.com/file/b636gt

    Thanks in advance.

  • 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...

  • 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.

  • 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.

  • Thank you for the continuing assistance.

    I see... You're using a rounded off angle from the Rectangle_Tile pivot to the Player_Tile to shift it back... This works, but the more the tile becomes stretched, the more that shift will become, leading to problems.

    In the interim, I had come up with something which similarly avoids making use of the Rectangle_Tile data - basically, Player_Tile.XY is recorded to a PV at every tick and as soon as a collision is detected, Player_Tile is shifted back to the last recorded position, which is always a tick before the overlap.

    This is fullproof in terms of collision testing, but I lose your wall sliding effect, which is what I'm after as well...

    After seeing your file, I seem to have achieved a solution that fully satisfies all my requirements. The pre-requisite is knowing which condition/actions pick which objects ... Based on my testing:

    Conditions - Sprite - Is Overlapping and On Colision always picks only the pair of objects that are currently colliding.

    Conditions - System - Collision/Overlap conditions always pick all the object instances that collide in the whole cycle/tick

    Actions - CustomMovement Bounce always picks all the object instances that collide in the whole cycle/tick.

    So, what I did was to create a Collision_Tile that gets positioned exactly over the Rectangle_Tile once a Rectangle_Tile Overlaps With condition is passed. Then, Player_Tile is bounced off the Collision_Tile with 0 friction, which positions it right outside the collision mask, preserving the sliding motion.

    Sorry for the wall of text. Here's a modified .cap which illustrates all the above. Thanks again for your help.

    sendspace.com/file/kdx70u

  • I have, but it does not seem to make a difference.

    Here's where I managed to get to. The collisions work as I want them to, except when the Player_Tile overlaps a tile that fails the comparison test while colliding with one that passes it. Left and Right arrow keys rotate the Player_Tile. Up, Down to move forward/reverse.

    Thanks.

    sendspace.com/file/u136ti

  • Use negative Width and Height values. Negative Width will flip your tile horizontally and negative Height will flip it vertically.

  • I have a player-controlled Object and a Family of colliders. I need the Object to pass through some Family Members, while sliding around others, the behaviour being chosen using a Private Varable/comparison condition.

    No matter what I do, I'm unable to bounce/slide my object off only select Family members - all the members are always taken as a collider. I have:

    On Object Overlaps Family Member

    Family Member PV is greater than SomeNumber

    ->Object bounce off Family Member

    Now the issue happens when the Object is already overlaping a Family Member that fails the comparison and comes into contact with another that passes it - the failed member is still used as a collider for the bounce.

    How could I rectify this? Any help would be appreciated.

  • Spider_hip

    Are you sure it's not your maths? You can only set absolute values and there's no way to retrieve current parameters... For me, it works flawlessly. Thanks.

  • Great release, however there seems to be a bug with Families and Effect parameters.

    The Action Wizard will not display any parameters on the third screen (setting the actual values) - it will say "There are no parameters for the selected item". 2-state properties will work properly, however.

    For example, screen-by-screen:

    PickFamily->OpacityPlus->ActivateOpacityPlus will work, but

    PickFamily->OpacityPlus->SetIntensity will not, as the third screen will be blank save for "There are no parameters for the selected item".

    Randomly, when clicking Finish on the last blank screen, an "Invalid argument" error appears, but mostly the wizard closes and the Action reads 0%.

    The Effects show properly inside Manage Families.