Page 1 of 1

Live colour alteration [SOLVED]

Posted: Sat Feb 01, 2014 3:51 am
by Asceai
I've been looking through the Ren'Py manual but I've been unable to see any sort of 'live' means of colour transformation of a displayable in ATL or anywhere else (apart from 'Solid'). The matrix stuff is awesome but only being able to use it with image manipulators somewhat limits it.
Is there something I'm missing?

Re: Live colour alteration

Posted: Sat Feb 01, 2014 7:12 am
by xela
Asceai wrote:I've been looking through the Ren'Py manual but I've been unable to see any sort of 'live' means of colour transformation of a displayable in ATL or anywhere else (apart from 'Solid'). The matrix stuff is awesome but only being able to use it with image manipulators somewhat limits it.
Is there something I'm missing?
How would you use Solid to transform color on a displayable? One of the most powerful tools Ren'Py has is UDD, there you can draw on a canvas using pygame methods directly to renpy. You can create your own displayable that way and can have any color passed as arguments or do it inside the class itself. I don't really know any way to recolor any displayable even with UDD, maybe someone with more skillz in graphics will help us out (cause I wouldn't mind knowing this as well), but I am not entirely sure where I would use it (most displayable in RenPy are created from images anyway).

Re: Live colour alteration

Posted: Sat Feb 01, 2014 7:56 am
by Asceai
xela wrote:How would you use Solid to transform color on a displayable?
By alphablend-ing it with the displayable. Probably inefficient, definitely limited.

Anyway, with a glance through pygame's documentation as well as of some StackOverflow-etc. questions about similar topics, it looks like pygame actually can't help here - when people asked about doing hue shifts and stuff, they were recommended to directly modify the image pixel-by-pixel. Not something I'd want to do in real-time, especially when it's something the video card could do much more efficiently (even with fixed-function opengl)
I guess this sort of makes sense, since pygame is IIRC just a thin wrapper on SDL and hence not designed to do this sort of thing.

Oh well!

Re: Live colour alteration

Posted: Sat Feb 01, 2014 8:14 am
by Unin
I would split the image into a red, green, and blue filtered image using photoshop. then overlay/blend the 3 sprites and adjust their alpha independently.

not sure if it would work in renpy, but thats how they process astronomical and meteorological images.

Re: Live colour alteration

Posted: Sat Feb 01, 2014 8:16 am
by xela
I still haven't tried messing with AlphaBlending :( so my understanding of what it does is somewhat limited...

Re: Live colour alteration

Posted: Sat Feb 01, 2014 8:18 am
by Asceai
Unin wrote:I would split the image into a red, green, and blue filtered image using photoshop. then overlay/blend the 3 sprites and adjust their alpha independently.

not sure if it would work in renpy, but thats how they process astronomical and meteorological images.
That's a fair point; in fact, I don't need to keep different copies, I can just im.MatrixColor them to produce the r/g/b varieties and Additive Blend them together.
I suspect the additive blend part is necessary though, although this sort of effect would probably be be approaching too expensive for software in the first place so it might make sense to just create a separate, cheaper alternative if additive isn't supported.

Re: Live colour alteration [SOLVED]

Posted: Sat Feb 01, 2014 8:21 am
by Unin
let us know how it works out. alot of people ask about hue shifting and if it works it'd be good to know.

Re: Live colour alteration [SOLVED]

Posted: Mon Feb 03, 2014 1:46 pm
by PyTom
For the record, live color blending is something I've had planned for a while. It will require shaders, which means giving up the software renderer and OpenGL 1.4 paths. That's something I'm planning on doing, but there are a few things that I consider to be higher priority at the moment.