Invert Transparency Mask

Started by Quintaros, Sun 17/04/2016 15:25:02

Previous topic - Next topic

Monsieur OUXX

Quote from: Quintaros on Fri 22/04/2016 17:50:20
Quote from: Monsieur OUXX on Fri 22/04/2016 17:44:37
Very interesting.
Another approach could be to first copy the offsetted sprites on an empty sprite, then draw the original character sprite on top of it all?
If I follow, that would create a halo around the character rather than creating a rim that overlaps the character.


Yes.
Step 1 : Render the character all white on an emtpty sprite that you'll call "spHalo". (as I said, I think that yoiu can use "tint" or something to render it all white without any effort)
Step 2: Create an empty sprite, and draw spHalo four times or more, slightly shifted (4 pixels up, 4 pixels down, 4 pixels left, 4 pixels right). Now you got your "halo"
Step 3: In the liddle of the same sprite, draw the original sprite.

Now you've got your original sprite with a white outline around it.
 

selmiak

Quote from: Monsieur OUXX on Mon 25/04/2016 08:52:49
Step 2: Create an empty sprite, and draw spHalo four times or more, slightly shifted (4 pixels up, 4 pixels down, 4 pixels left, 4 pixels right). Now you got your "halo"
sometimes drawing it 8 times it better, the diagonals could be 3pixels up + 3 pixel left and so on to make it seem more rounded...

Snarky

But that's not the effect he wants, though. He wants the rim lighting on the character, because that's, you know, right.

selmiak

*enters read mode from now on*

...after this post that is.

...probably ;)

Monsieur OUXX

#24
Quote from: Snarky on Mon 25/04/2016 11:44:22
But that's not the effect he wants, though. He wants the rim lighting on the character, because that's, you know, right.

Oh yes sorry, I didn't understand it properly. I thought he wanted a halo, I didn't understand "rim lighting" (language barrier).
That said, if it comes to GetPixel level, maybe he'd be better off with some sort of shader that would draw white pixels by travelling around the outline. I'm sure that with the proper formula the function would never wander too far off the outline, inside the sprite, hence greatly reducing the processing time.

EDIT: hey my original idea might still work :
1) Create a white version of the sprite using the appropriate tint variation
2) Create a pink version of the sprite using the appropriate tint variation
3) draw the pink sprite on the white sprite, slightly shifted to the left or the right -- hence keeping only the wanted bit of white sprite.
4) use the remaiing white sprite where needed (i.e. onto the original sprite).
Benefit : never go down to pixel level.

That process is basically the one described by Quintaros. However it will work only if tint (and... I can never remember the name... luminance?) are flexible enough, which would require some testing to be sure.



 

Snarky

Pretty sure that won't work. You probably won't be able to tint the character to "magic pink", and if you do manage to do so, drawing it on top of the other sprite will achieve nothing, since drawing transparent on top of non-transparent doesn't wipe out the region below, AFAICR.

SMF spam blocked by CleanTalk