Would it be possible to use something like masking to make a custom cursor sprite the inverted color of what’s behind it, if so, how?
Hi ResinTheFuriousMage, ooh interesting idea. I don’t think you’d need masking. If I was trying this, I’d make my custom cursor object with a small transparent “hole” in the centre. Then I’d get the ReadPixels extension and use that to read the color at the point where the hole is. And then change the color of the cursor to that color.
Oops, I forgot you want the opposite of the color. That makes it more complicated but should still be possible, maybe with an effect? If not, you’d have to find out how to mathematically maybe? find a color’s opposite.
Well, I love this kind of thing so I made it!
I used two extensions, ReadPixels and CursorObject.
Make a custom point on your cursor object. I called my custom point “Sensor”. This would be in the transparent hole. Or you could just have no hole and have the point somewhere outside the cursor, maybe at the tip.
My custom cursor has three number variables - red, green and blue.
The ReadPixels extension reads the pixels at the “Sensor” custom point in the cursor and saves them to the variables. But not the actual value, but instead 255 - the value. This inverts each rgb color.
Then these three number variables get saved to a scene string variable “RGBColor”.
The cursor object has the ColorReplace effect with the Original color parameter set to white (the color of my custom cursor).
The ColorReplace effect changes the NewColor parameter to the "RGBColor variable.
Hi!
Good work.
Xierra
I’m sorry, this wasn’t exactly what I wanted.
I have a crosshair sprite in my game, the crosshair consists of one solid color and it’s hard to see sometimes.
Games use this strategy to make the cursor visible.
The desired result is to change every pixel of the cursor to the opposite of the color behind it.
I don’t think it’d be possible to simply change the single color of the cursor to get this result, but rather do something a bit more complicated.
I do still appreciate the effort.
No worries, it was fun. But I don’t get your explanation though. If my cursor was a crosshair and didn’t have a black outline, wouldn’t it achieve this:
I think they are referring to subtractive blending, which is unfortunately not supported by the Pixi WebGL renderer:
Various blend modes supported by PIXI.
*
* IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.
* Anything else will silently act like NORMAL.
A Minecraft crosshair for example:
@magicsofa, yes I believe that’s correct.
Would it be possible to achieve this in any way?
Or is it impossible?