[Suggestions] Color Replace Shader & GetRGB

Discussion and feedback on Construct 2

Post » Thu Aug 23, 2012 1:44 am

So the 74 shaders we got in r100 are totally awesome and so forth (no, really, I've been messing with them for like 2 hours straight ^^;) but there is no color replace shader as seen in CC. There were 6 paramaters; old RGB and new RGB. It was perfect for changing certain colors on a sprite, and palette shifting (think NES Megaman / NES Megaman charging).

Is anyone else in need of / willing to write such a shader?

(To my knowledge "set color" is the closest effect so far, but it affects the entire sprite. Cloning the sprite numerous times, erasing 1 color each, stacking them, and applying the set color effect seems to be the only option right now, but that's pretty inefficient.)

Also, the Image Manipulator object in CC allowed you to retrieve the RGB value of a point on an image. Like if the color was solid blue on the x,y coordinates (5,10) it would return 0,0,255. It was great for using actual palette images instead of entering the RGB values by hand. Is that possible in C2? I haven't really kept up with the 3rd party plugins so..Tokinsom2012-08-23 03:35:50
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Thu Aug 23, 2012 1:46 am

Ah yeah, I used that for my Mario World clone when you transform into Fire Mario. Very useful for pixel games. I don't have a need for one anymore, but the idea's got my support at least!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Thu Aug 23, 2012 1:43 pm

I'll see if I can port CC's replace color shader. Getting pixels is generally not a good idea since it involves a very slow process of halting rendering and copying data from the GPU back to the CPU. Do you absolutely have to have it? I prefer not to implement features like this, because if mis-used it absolutely kills the performance (and probably means people coming to the forum wondering why their game is slow).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Aug 23, 2012 3:33 pm

Hmm well in CC I used it for swapping palettes and even rapid palette shifting on 3+ objects at once without any noticeable performance hits. Didn't seem to affect performance whatsoever, really. Can upload a video if you want :) I suppose it might be worse in C2 though. I understand your concern about people misusing it, but there are already many things that can cause performance issues if not used properly. Perhaps a warning could be issued if it really is that bad?
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Thu Aug 23, 2012 5:08 pm

I've added a color replace shader for the next build. I was talking about the 'getrgb' expression when I was worried about performance - what do you usually use it for?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Aug 23, 2012 7:30 pm

Oh, my bad. I use it in conjunction with the color replace shader so I can retrieve colors from palette images instead of entering the RGB values by hand. It's a huge time saver. I suppose it is sort of a niche feature but there are probably more useful things that can be done with it.
Also thanks for adding the color replace shader! I was getting worried for a second there :)
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024


Return to Construct 2 General

Who is online

Users browsing this forum: Bing [Bot] and 5 guests