Page 1 of 1

Dynamically Recoloring Monsters

Posted: Thu Dec 23, 2010 11:08 pm
by Sophia
Gambit37 wrote:"dsb_set_tint" will recolour monsters -- but this seems to just be an overlay that allows the underneath colours to show through. Is there a function for completely changing the colour of a monster but retaining the lumninance of each pixel? IE, could you say apply "brown" to the monster, and every pixel goes brown but retains it's brightness level so you can still each each pixel? This would be cool for doing things like making monsters turn to stone, ice, etc. without having to create hundreds of new images. Here's an example of what I mean:
Image
I've been adding some pixel-level color manipulation commands to DSB 0.47 and this is now doable.

Right now, it'll allow tweaking of the RGB and/or the HSV of each pixel on the monster's bitmap. This should let you do pretty much every simple color effect you can think of.

Fancier filters will be more work for me-- so I'm probably not going to do them unless they're relatively easy and specifically requested-- but I figured I might as well at least mention something before it's all set in stone. :)

Re: Questions about DSB/ESB

Posted: Thu Dec 23, 2010 11:58 pm
by Mon Ful Ir
How complicated would a transparency filter be? I can see potential uses where a designer might want to turn creatures into ghostly versions of themselves, and/or back again.

Re: Questions about DSB/ESB

Posted: Fri Dec 24, 2010 12:32 am
by Sophia
Oh, I should have mentioned that. You can tweak the alpha channel, too, which will let you do that. :)

Re: Dynamically Recoloring Monsters

Posted: Thu Jan 13, 2011 1:41 am
by Sophia
I had a bit of flash of inspiration on this topic recently when I remembered that there are already hooks in the code for giving Lua a rather high amount of control over the contents of a bitmap by means of the bitmap_tweaker property. In the standard base code, this is used to properly crop wall writing from a distance, so that it vaguely resembles what is actually written on the wall. Unfortunately, this method won't work, because trying to dynamically tweak monster images in this way slows the game down pretty unacceptably, at least if it does it dynamically on every frame. Some means of "caching" the result might work better, but there comes a point when it's simpler to just create the bitmap ahead of time, and I might be at that point. Of course, this has its own downside too, because having base code functions that deal in dynamically created and copied bitmaps only complicates things if/when I want to make the editor handle graphics.

So, in other words, the basic structure is in there, but I'm not sure how to expose it to the user in a way that isn't atrocious. Ugh... :(