Funky Koval's Recent Forum Activity

  • Just a small issue - does anyone know of a way to have a loop that functions like "For Each Object", but is named so I can, for example, check its index from a nested loop?

    Right now I'm using the System\For Each Object condition with a PV which gets incremented at index progression, but I'd rather do without the PV, if possible.

    Thanks.

  • This is mostly an utility effect - it replaces/multiplies the original Alpha channel with/by either the Red, Green or Blue channel.

    Parameters:

    Channel - specifies which color channel is used 1 - Red, 2 - Green, 3 - Blue

    Invert - inverts the channel values before replacement/merging 0 - invert, 1 - do not invert

    Replace/Multiply - 1 - replaces the Alpha with the color channel 2 - multiplies the Alpha by the color channel

    Invalid parameter values will cause the effect to not do anything.

    Color premultiplication is only done if the channel is not inverted and replaces instead of multiplying over Alpha - otherwise, only the Alpha channel is affected resulting in an "additive" look for colors.

    What's it good for? I personally use it combined with Erase/Mask to paste transparency into a Canvas.

    Enjoy:

    sendspace.com/file/jl0zr6

    Thanks go to tulamide for his support.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It does make perfect sense.

    However, blending modes won't help in this case and not because Construct only supports a subset.

    It seems that there are none that blend across channels. Alpha only blends with Alpha, R with R etc.

    Yet I managed to find a solution - I'm in the process of cannibalizing the Color Mask Effect to do what I require - the logic flow is quite clear and easy to replace with a simple channel shifter - I have the basic operation done, but before releasing, I want to add the following:

    -ability to manually select the channel to shift over to alpha

    -a choice of either multiplication by the existing alpha or replacement

    -an option to inverse the incoming channel

    Once done, I'll post it in the Completed addons forum.

    Thank you for pointing me in the right direction.

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

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

Funky Koval's avatar

Funky Koval

Member since 28 Mar, 2010

None one is following Funky Koval yet!

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies