Applying a tint to a whole scene in the game
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.
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.
- harajukulolita
- Regular
- Posts: 75
- Joined: Mon Jul 15, 2013 11:24 am
- Completed: None so far!
- Projects: Currently working on... Starlight Wishes
- Tumblr: loli-studio
- Deviantart: harajukulolita
- Contact:
Applying a tint to a whole scene in the game
Hi everyone, I'm sorry if this question has been asked before and I haven't seen it. I wanted to know how to creat a tint for a whole scene in the game. For example, if it were a memory then the whole thing would play out in a sepia or greyscale tint.
I know that this can be done with individual images using the im.Sepia and im.Greyscale operations among others but can how do I apply the sepia or greyscale to the whole scene without defining individual images?
I know that this can be done with individual images using the im.Sepia and im.Greyscale operations among others but can how do I apply the sepia or greyscale to the whole scene without defining individual images?
Re: Applying a tint to a whole scene in the game
You can't, scene isn't an image.
I have no idea on how this can be done, maybe a solid with a tweaked alpha channel. That could potentially give the scene a darker look but it's far away from greyscale effect.
I have no idea on how this can be done, maybe a solid with a tweaked alpha channel. That could potentially give the scene a darker look but it's far away from greyscale effect.
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Applying a tint to a whole scene in the game
Ren'Py currently can't do this in any half-decent way. The only matrix colour operations available are image manipulators. They can't be applied 'live' so you can't e.g. make a Transform that turns everything grey.
Now, to get around the 'defining individual images' part, here's a hack I wrote. It is the very definition of a hack because it uses undocumented internal Ren'Py functionality (specifically, the 'images' dictionary, used to get a list of images) but it creates greyscale versions of every image.
So, instead of 'show picture' you can use 'show picture greyscale', instead of 'scene background' you can use 'scene background greyscale' etc.
It'll only work with images that are image manipulators - if you have something like an animated image, this won't work with that - while greyscale versions of the individual frames should exist, the code won't know how to use them.
I don't currently know a good way of delivering the second requirement - making everything greyscale automatically. The simplest way is to redefine config.show to check a flag (e.g. greyscale) and apply the 'greyscale' attribute to shown images if it is set (I use getattr to check it so it won't bug out if you haven't set greyscale yet):
This way you can just set the flag and all subsequent shows will use the greyscale variants:
There's numerous downsides to this. First, it won't work with renpy.show(), only 'scene' and 'show' statements. It won't work with anything that isn't specified as an image manipulator, so animations etc. won't work (you'd want to create new versions of them with the greyscale image attribute if you use them in these scenes). You also have to re-show everything in the scene to get them to appear in greyscale - the screen doesn't just go grey automatically.
Now, to get around the 'defining individual images' part, here's a hack I wrote. It is the very definition of a hack because it uses undocumented internal Ren'Py functionality (specifically, the 'images' dictionary, used to get a list of images) but it creates greyscale versions of every image.
Code: Select all
init 999 python:
grey_images = {}
for i in renpy.display.image.images:
try:
grey_im_name = i + ('greyscale',)
grey_images[grey_im_name] = im.Grayscale(renpy.display.image.images[i])
except:
pass
for i in grey_images:
renpy.image(i, grey_images[i])
It'll only work with images that are image manipulators - if you have something like an animated image, this won't work with that - while greyscale versions of the individual frames should exist, the code won't know how to use them.
I don't currently know a good way of delivering the second requirement - making everything greyscale automatically. The simplest way is to redefine config.show to check a flag (e.g. greyscale) and apply the 'greyscale' attribute to shown images if it is set (I use getattr to check it so it won't bug out if you haven't set greyscale yet):
Code: Select all
init python:
def replacement_show(name, *args, **kwargs):
if getattr(renpy.store, 'greyscale', False):
renpy.show(name + ('greyscale',), *args, **kwargs)
else:
renpy.show(name, *args, **kwargs)
config.show = replacement_show
Code: Select all
label start:
scene forest_bg
show girl
girl "Hi!"
$greyscale = True
scene forest_bg
show girl
"I remembered this place from my childhood..."
return
Re: Applying a tint to a whole scene in the game
For any game that doesn't use "live" displayable atm when stuff needs to be greyscaled, this is an excellent workaround. You could potentially define a number of tints and have it go to back/white gradually... excellent example!
- harajukulolita
- Regular
- Posts: 75
- Joined: Mon Jul 15, 2013 11:24 am
- Completed: None so far!
- Projects: Currently working on... Starlight Wishes
- Tumblr: loli-studio
- Deviantart: harajukulolita
- Contact:
Re: Applying a tint to a whole scene in the game
Thank you for the advice, not that I mind spending the time defining each image I'm going to use in the scene but it would just be so much better if there were shorter and practical ways of doing this. I'll give this code a try and see how things work out thank you very much
- SONTSE
- Regular
- Posts: 96
- Joined: Sun Nov 24, 2013 10:49 pm
- Completed: 11 VN's so far
- Discord: jkx0282_10798
- Contact:
Re: Applying a tint to a whole scene in the game
I run into same problem recently, and found this thread.
Asceai solution does work, but it seems modern RenPy auto-define images from "images" folder bypassing the routine that was hacked by the script above, so they are not affected.
Could you please fix the script to include those auto-defined images?
Or is there more decent way to handle that problem so far?
Thanks!
Asceai solution does work, but it seems modern RenPy auto-define images from "images" folder bypassing the routine that was hacked by the script above, so they are not affected.
Could you please fix the script to include those auto-defined images?
Or is there more decent way to handle that problem so far?
Thanks!
Re: Applying a tint to a whole scene in the game
Can you not create an overlay/screen with the desire effect as an image?
Then do the show screen to show said overlay?
Then do the show screen to show said overlay?
- SONTSE
- Regular
- Posts: 96
- Joined: Sun Nov 24, 2013 10:49 pm
- Completed: 11 VN's so far
- Discord: jkx0282_10798
- Contact:
Re: Applying a tint to a whole scene in the game
An effect that operates not a single image (like usual effects do), but composite displayables (e.g. whole layer or screen), or simply applies into everything behind it would be exact thing I love to be pointed at. ^^
Who is online
Users browsing this forum: Google [Bot]