Adding Matrixcolor to Side Images Automatically Based on Scene

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
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Adding Matrixcolor to Side Images Automatically Based on Scene

#1 Post by emz911 »

To make a long story short, I am planning to add reshading/tint with Matrixcolor to side images, but all the tutorials I’ve found require defining and showing them individually by hand, since my game is already a million-words, I am seeking a simpler and faster method, preferably automatically adding tints to side images according to the current showing background scene (noon, night, etc.).
For your reference, this is the shading tutorial I am looking at, though not for side images (if you have recommendations for another way of coloring that performs better and faster to the system, welcome!): https://www.twoandahalfstudios.com/2019 ... atrixcolor
I understand that this is a really advanced function, but any help would be extremely appreciated, thank you!! :cry:

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Adding Matrixcolor to Side Images Automatically Based on Scene

#2 Post by Remix »

What version of Ren'Py are you using?
Do you only mean SideImages or others?
Frameworks & Scriptlets:

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Adding Matrixcolor to Side Images Automatically Based on Scene

#3 Post by emz911 »

Remix wrote: Sat Apr 10, 2021 6:09 pm What version of Ren'Py are you using?
Do you only mean SideImages or others?
I am currently using 7.3.5.606. Yes, I only need the tint of colors to go on the side images, defined as “image side” for characters, not anywhere else.
I mentioned “scene” because I want the side image tints to correspond to background scenes, for example all night scenes would have the same dark blue tint. What I wish to achieve is to link the current showing scene with a tint on the current showing side image, so if I do:

Code: Select all

scene room_night with fade
eileen happy “My side image is automatically tinted with a dark blue shade.”
amy “Mine as well, because the current scene is room_night.”
scene room_noon with fade
eileen “Now our side image tint is automatically changed to a warm tint because it is now noontime.”
This way I don’t have to manually go through every single dialogue and add those tints, if that makes sense... I’m not even sure if this is achievable, but thank you in advance!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Adding Matrixcolor to Side Images Automatically Based on Scene

#4 Post by Remix »

Simplest then is to set one or two defaults and alter the screen say to show the SideImage using those in the function...

Code: Select all

default tint = (1.0, 1.0, 1.0)
default brightness = 1.0

### in say screen
    add im.MatrixColor(SideImage(), im.matrix.tint(*tint)*im.matrix.brightness(brightness))

label wherever:
    $ tint = (0.45, 0.45, 0.75)
    $ brightness = -0.07
    scene ...
In Ren'Py 7.4 and beyond you'd want to do this in shaders though...
Note too that im.MatrixColor would only work when SideImage resolves to a physical file (not composite or layered etc)
Frameworks & Scriptlets:

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Adding Matrixcolor to Side Images Automatically Based on Scene

#5 Post by emz911 »

Remix wrote: Sat Apr 10, 2021 7:31 pm Simplest then is to set one or two defaults and alter the screen say to show the SideImage using those in the function...

Code: Select all

default tint = (1.0, 1.0, 1.0)
default brightness = 1.0

### in say screen
    add im.MatrixColor(SideImage(), im.matrix.tint(*tint)*im.matrix.brightness(brightness))

label wherever:
    $ tint = (0.45, 0.45, 0.75)
    $ brightness = -0.07
    scene ...
In Ren'Py 7.4 and beyond you'd want to do this in shaders though...
Note too that im.MatrixColor would only work when SideImage resolves to a physical file (not composite or layered etc)
Modify the say screen, wow, I never thought of this, this is simple and genius! Thank you so much! :lol:
Another quick question, would it be possible to get the current scene name? If so what variable or code do I use to get it? This way I can do things like “if scene_name” in the say screen to make things even easier.

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Adding Matrixcolor to Side Images Automatically Based on Scene

#6 Post by emz911 »

I think I’ve found what I need to get the showing image!

Code: Select all

 renpy.showing(name, layer='master') #Returns true if an image with the same tag as name is showing on layer
Still needs to be tested out. :)

Post Reply

Who is online

Users browsing this forum: No registered users