Masked filters

This forum is currently in read-only mode.
0 favourites
  • Now that collision masks have been added, how about adding masked filters, which you can add to a sprite then specify which area the filter acts in a similar way to collision masks. Would be awesome if you could add multiple filters to different areas of a sprite.

    I think this would have loads of applications, in an RTS for changing the colour of particular areas of units

    for rpgs changing colour of clothes for different items or whatever (but not changing the colour of the entire animation)

    obviously there would be loads more uses

    <img src="http://www.quotecats.com/what/thisisobviouslywhatimean.PNG">

    upper body is what this can do, legs are what current filters can do

    even with bones its still annoying having to use 2 objects for this.

    say you wanted to change a player's eye colour, but didnt want to change the colour of their entire head or use 2 objects.

    EDIT: support for transparency would also be really good

  • i think someone made an effect for this.

  • ive thought of this too, it would be useful as you said, for rts applications

  • i think someone made an effect for this.

    cant find it sorry...

    this has more functionality that just swapping colours as it allows for a range of colours to be changed both more easily and all at once.

    in any case, should this go on the tracker?

  • I don't think it's possible to do the snes type deal without changing alot under the hood.

    construct uses pngs, which I believe store numerical values for red,green,blue, and alpha components to each pixel

    I think the older image formats that make palette swapping easy store numbers which represent the index of a color on a limited palette. Then you can change the palette colors to change the sprite.

  • PNG-8 uses color palettes but Construct uses PNG-32 (RGBA).

    Palette operations are really really legacy operations.

    I wrote a color remap shader that remaps intensities on a grayscale sprite to a 3-color ramp, but never uploaded it. I couldn't figure out how to let people choose the number of colors in the ramp so I had a 3 color and a 5 color version.

    But that doesn't sound like it would do what you want

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Surely it could just take any images named "Filtermask x.png" from the launch explorer dialogue (or when you click add new masked filter it asks you where to get it from/brings up a image editor) then use the transparency (or brightness) as an alpha mask which it can then overlay on the image with a colour specifiable at runtime.

  • Well there is one work around of simply changing that frame to another pre-processed frame.

  • that isn't really a workaround, that only lets you change the colour to as many frames as you can be bothered to add, certainly not 16 million.

    If you want to let a player chose their starting skin/shirt/trouser/eye/etc colour (but not colour their entire body the same colour), and let them choose from a smooth gradient.

    I can think of a workaround which is just cutting out the bits I want to colour of the animation and always setting this new sprite's position on top of it, then using regular colour filters, but doing it this way is very clumsy.

    In the image editor, it could have an "add new channel" option (or just have this in the launch explorer bit like I've suggested before), which creates a new mask which starts out looking like the transparency mask of the image you're editing (in black and white), you can then remove sections, then map this to a new filter (or even effect), so that the filter/effect only acts on this area (with intensity proportional to the brightness of the mask in that area).

    <img src="http://www.quotecats.com/what/maskkkkkk.PNG">

  • [quote:2mltyyrj]that isn't really a workaround, that only lets you change the colour to as many frames as you can be bothered to add, certainly not 16 million.

    If you want to let a player chose their starting skin/shirt/trouser/eye/etc colour (but not colour their entire body the same colour), and let them choose from a smooth gradient.

    True, but keep in mind you can load frames externally.

    [quote:2mltyyrj]I can think of a workaround which is just cutting out the bits I want to colour of the animation and always setting this new sprite's position on top of it, then using regular colour filters, but doing it this way is very clumsy.

    That will work for some things, but you might get into trouble with higher frame rates.

    [quote:2mltyyrj]In the image editor, it could have an "add new channel" option (or just have this in the launch explorer bit like I've suggested before), which creates a new mask which starts out looking like the transparency mask of the image you're editing (in black and white), you can then remove sections, then map this to a new filter (or even effect), so that the filter/effect only acts on this area (with intensity proportional to the brightness of the mask in that area).

    I thought you wanted to do this at runtime?

  • That will work for some things, but you might get into trouble with higher frame rates.

    really? well all the more reason this should be added then heh

    I thought you wanted to do this at runtime?

    I only want to be able to change the colour of the filter at runtime, like with the usual colour filters for the entire sprite. There would obviously end up having to have one of these masks per-frame of the animation.

    I mean say you want to set the colour of your character's shirt:

    <img src="http://www.quotecats.com/what/morefilterimg.png">

  • Yeah, doubt you could get an fx to do this, especially the second part. What you need is a brand new object that supports pallets. something like .spr or kiss .cel's.

    Btw did you know there is corner color filter?

    Then again you could maybe do something with distort maps color filter.

  • Split your sprites up into components - body, shirt, lolpants and turban. You could choose the tone of skin, different color combinations of clothes etc.

    Of course that means you'd have to do exact animations for all parts.

  • Yeah, doubt you could get an fx to do this, especially the second part. What you need is a brand new object that supports pallets. something like .spr or kiss .cel's.

    Btw did you know there is corner color filter?

    Then again you could maybe do something with distort maps color filter.

    Would it just be easier to add the pallet to the sprite object properties and have a set pallet action in the event editor.

    But then this might be some issue with with animation.

    Or maybe there could be a pallets function in the animation properties

    (like pallet 1,pallet 2,pallet 3, etc.)

    then in set animation action in event you set the animation and set and pallet number.

  • Dunno, Sprites can display millions of colors, compared to images with pallets that usually only handle a few. Plus there's alpha transparencies.....

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