Letters fading in

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
FragmentedBergyo
Regular
Posts: 101
Joined: Mon Jul 30, 2012 6:02 pm
Contact:

Letters fading in

#1 Post by FragmentedBergyo »

Just a short question. Is it currently possible to make the text display with a letter-to-letter fade effect?
Usually the letter just appears, but having the letters just fade in would be a effect that's much easier on the eyes.

Is that currently possible?

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Letters fading in

#2 Post by Asceai »

Not without a lot of nontrivial custom coding.
Here is a topic discussing this.

EDIT: Of course, 'not without a lot of nontrivial custom coding' is really a 'yes' answer in disguise, and it's of course POSSIBLE to do this. I don't like any of the ways I've thought of to do this, though:
  • Split up the text into a Text displayable for every letter and use a fading transform on all of them, calculating the start time of each fade based on the CPS. The unfortunate problem is that, to work out where to place every displayable, you essentially need to reimplement a good portion of the text rendering code, working out how far apart to place each letter and reproducing the text wrapping ren'py does, so this is horrible. All those displayables being transformed separately is probably bad on performance too.
  • Do the same thing, but with a UDD. I'm sure this comes with a bit less overhead, but the text spacing and wrapping issue still apply so it's still horrible.
  • Do the same thing as in the first case, but have each displayable contain the entire string, and just make {color=#0000}all the text except {/color}t{color=#0000}he letter corresponding to this displayable{/color} transparent. This ensures ren'py does all the wrapping for you, but I'm certain there's a lot of overhead here and you're doing alpha transforms on all these textbox-sized displayables, which is a horrifying thought.
  • Use {color=} tags to do the fading for you instead of using transforms. Only use one text displayable, except you have a screen that recreates the text displayable every frame with the correct fades for the {color=#FFFE}c{/color}{color=#FFFD}u{/color}{color=#FFFC}r{/color}{color=#FFFB}r{/color}{color=#FFFA}e{/color}{color=#FFF9}n{/color}{color=#FFF8}t{/color}{color=#FFF7} {/color}{color=#FFF6}t{/color}{color=#FFF5}i{/color}{color=#FFF4}m{/color}{color=#FFF3}i{/color}{color=#FFF2}n{/color}{color=#FFF1}g{/color} (except you'd probably use 8-digit hex colours for a better graduation). You'd calculate this based on the text cps as well, like in the previous cases. I don't know how the overhead of doing this, given that ren'py probably likes not rerendering all this text every frame and you're making it do exactly that, or how the overhead compares to the above three terrible ways of doing it. I'd probably implement this and the previous solution and see which one chokes your processor/video card the least.
But like I said, it's a fair bit of work for a fairly non-notable effect.

EDIT 2:
I just thought of another possibility that's much better than the others. I don't know if it would really work or if there's any other issues, this is just me mulling:
  • Create a Text displayable containing the original unaltered textbox text (and any colouring and formatting tags etc.)
  • Create a second Text displayable that is filled with {color=} tags fading the text from near-black to white with each character. It might also be desirable to make the text in this one thicker with outlines or whatever, although I dunno how that would work with the per-letter fading.
  • Use an ImageDissolve transition to fade in the first displayable using the second as the control image. Modify the ramp and delay values based on text_cps.
Last edited by Asceai on Wed Apr 23, 2014 10:10 am, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Letters fading in

#3 Post by PyTom »

There's actually a bit of infrastructure there in the Text class, but it's waiting for some changes to the Render system that I'm hoping to get to this summer. If I can do that, then it should be fairly easy to add stuff like this.

The Render system was held back for a while by the need to keep the software renderer working. But now that it's 2014, I'm hoping we can go GL-only.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
FragmentedBergyo
Regular
Posts: 101
Joined: Mon Jul 30, 2012 6:02 pm
Contact:

Re: Letters fading in

#4 Post by FragmentedBergyo »

Alright, thanks for the quick responses, folks. Release is still pretty far away and I can wait for such minor details as long as the implementation won't clash with a lot of things.

Thanks again!

User avatar
Samu-kun
King of Moé
Posts: 2262
Joined: Mon Sep 03, 2007 3:49 pm
Organization: Love in Space Inc
Location: United States
Contact:

Re: Letters fading in

#5 Post by Samu-kun »

I've been requesting this since... 2010, I think. I await patiently.

User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

Re: Letters fading in

#6 Post by TheOneAndOnly-K »

I have letters fading into the text, but all I do it lower the texts speed. Try that.

Post Reply

Who is online

Users browsing this forum: Ocelot