Applying a red lightning/ general change of color

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
nature1996
Regular
Posts: 62
Joined: Wed Jun 21, 2017 10:35 am
Contact:

Applying a red lightning/ general change of color

#1 Post by nature1996 »

Hi,

I would like to apply a transformation that would simulate a red light in my game. For now, I show a translucent red screen over the whole thing, but it only make everything more red, while I basically would like them to be less blue and green (aka black should still be black). I've seen MatrixColor that could do the job, but I don't know how to apply that to the whole layer master. Furthermore, I would like to change the amount of colour progressively or dynamically over the whole game.

That would really help, because for now everything looks just red, not gloomy as it should.
Je parle aussi français

User avatar
arty
Regular
Posts: 120
Joined: Sat Jan 06, 2018 11:55 am
Completed: White Monday
Projects: HATE is a 4 Letter Word
Organization: KATHARSIS ART
itch: artys-games
Contact:

Re: Applying a red lightning/ general change of color

#2 Post by arty »

If you're willing to mess with custom python packages, you could see if you can get this to work: https://pypi.org/project/blend-modes/
(Keep in mind that this package requires Numpy, another package.)

As PyTom said: To include a pure-python module that isn't included with Ren'Py, drop the .py file into the game directory. Also remember to import the needed components in an init python block.

The problem with this approach is that it needs two images.

You'd need to either take a screenshot of the screen everytime something changes and then re-blend (which makes animations troublesome to say the least), or you'd need to blend every new image that appears on the screen with the overlay image. The latter sounds more realistic to achieve. "Simply" blending every image individually should not be noticable to the player, and it's probably not too complicated to implement code that automatically blends the images when they appear.

I think the above approach could also work with an image matrix...

Just my thoughts. I hope this helps at all.

User avatar
nature1996
Regular
Posts: 62
Joined: Wed Jun 21, 2017 10:35 am
Contact:

Re: Applying a red lightning/ general change of color

#3 Post by nature1996 »

That seems a bit much, where I could basically have a before and after version of both picture with a red matrixcolor, but I would like something more... reactive if you like. There is currently an "alpha" transform property, and I was wondering if it would be possible to add a Rcolor, Gcolor and Bcolor property as well, so that the resulting color transformation matrix would be:

Code: Select all

[R, 0, 0, 0, 0,
 0, G, 0, 0, 0,
 0, 0, B, 0, 0,
 0, 0, 0, a, 0]
That is unless I'm mistaken and the "alpha" transform doesn't use the color matrix or something like that. I guess that would be a question for the great PyTom...
I tried to figure out by myself how the alpha keyword works, but I failed...

Edit: I wanted to add, but forgot that I thought about using an alpha transform on the whole layer, than place a uniform background behind, though in the end it does the same thing as putting a uniform layer up front: while it works well as an aproximation for night scene (as x*alpha +0 = x*alpha), for a color filter it isn't as good (as x*alpha + R*(1-alpha) = trivial).
Je parle aussi français

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]