Masked filters

New releases and general discussions.

Post » Sat Sep 26, 2009 10:58 pm

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


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
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Sat Sep 26, 2009 11:10 pm

i think someone made an effect for this.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Sep 27, 2009 12:16 am

ive thought of this too, it would be useful as you said, for rts applications
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Fri Oct 30, 2009 6:33 pm

[quote="Davioware":36bwnd11]i think someone made an effect for this.[/quote:36bwnd11]
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?
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Fri Oct 30, 2009 7:54 pm

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.
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Sat Oct 31, 2009 9:02 pm

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 :P
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Mon Nov 02, 2009 11:23 pm

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.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Tue Nov 03, 2009 5:47 am

Well there is one work around of simply changing that frame to another pre-processed frame.
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Tue Nov 03, 2009 5:56 pm

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).
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Tue Nov 03, 2009 7:50 pm

[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.[/quote:2mltyyrj]

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.[/quote:2mltyyrj]

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).[/quote:2mltyyrj]

I thought you wanted to do this at runtime?
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests