Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Fading in (and out) text for intro

Author
Message
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 23rd Feb 2011 21:41
Just trying to compare some solutions for fading in a simple line (or 2) of text similar to that what you get in movie trailers.

So effectivly i want to achieve the following.

1) Starts off black screen

2) Fades in some text

3) Text fades out

4) New text fades in
...repeat for however long intro is.

Now i came up with a solution after not being able to find anythnig on fading in text, and that was to draw a few bitmaps each one with a different line of text (like a different part of the animation so to speak) then paste the bitmap and change its fade values in a for loop. This unfortunately didnt work as it will load the bitmap and display it but as soon as i add 'fade bitmap' it says the bitmap does not exist. Also i have heard bad things about using fade bitmap while searching for solutions in regards to it so would rather not use it.

Now i came across a solution that is really good and it involves making a camera, making a plane the size of the screen, then texturing the plane with my bitmap (which is effectively just text), then you use a light source to fade it in. With some tweeking i reckon i could make it do the desired effect.

I was wondering if there were any other ways you guys reccomend, or would it just be better to do it as part of an animation in something like blender perhaps (which i cant use just yet but am slowly day by day going through tutorials) then rendering it as a movie or something then simply just loading the movie in DB?

P.S if the above is the case i dont suppose anyone knows a good simple fading text tutorial on blender that they could link to as i cant seem to find anything so far. In fact i cant find many good useful blender text effect animation tutorials yet there is so much i would like to do with it.

Thanks in advance.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 23rd Feb 2011 21:59 Edited at: 23rd Feb 2011 22:06
You can change the alpha level of a plane, or a sprite, those are both good ways to fade something in or out.

Here's an example using a sprite...



Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 23rd Feb 2011 22:39
Just had a play around with that, i like it, its another nice way and it cuts down on the bitmaps aswell if you wanted to write a fair bit more. Very nice, plus you just taught me more as i did not really know anything about sprite alpha. I fact i didnt understand alpha at all really.

Thanks
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Feb 2011 23:11 Edited at: 23rd Feb 2011 23:12
I do it the way Rich did it also because it can work with anything (full screen images with different colors) but just to be different I wrote one that just changes the text color to achieve the same effect.



The beauty of programming is there's always more than one way to do the same thing.

Agent
20
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 27th Feb 2011 05:13
I do it Grog's way. The trouble with using text is that it's slower than using a sprite, but if it's for a simple movie-like intro then you won't be having a very busy screen so framerate won't be an issue.

Think of the term "alpha" as a synonym for "transparency". An object (be it a line of text, a sprite, or an image pasted to the screen) will appear completely solid if its alpha value is 255. It will be completely invisible if its alpha value is 0, and you'll get varying degrees of transparency, with the background visible through it, if you have a value in between. We can therefore fade anything we want between solid and invisible by running it through its alpha values in a FOR...NEXT loop just like Grog has done.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Feb 2011 05:40 Edited at: 27th Feb 2011 06:02
@Agent - not sure what thread you are reading, as Grog's example does NOT use alpha values, it changes the color of the text from black to white and back to black again.

EDIT: I'm not trying to be rude, your posts are always helpful and informative.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Feb 2011 20:30
Yeah i think he may have meant your post Rich. Now i have learned a little bit more about alpha, i know what the 255 in your code is (believe it or not i didnt before, it didnt occur to me that it might be something to do with rgb values and so no), this has been a productive thread for me
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Feb 2011 14:26 Edited at: 28th Feb 2011 14:28
Quote: "Yeah i think he may have meant your post Rich."

I think Somarl is right. Also I don't know what you were reading Rich but nowhere does @Agent say Grog used alpha... just that he used a For...Next loop

Here's a simple rgba function I just posted for another thread which could be used to set the alpha of the text:


Just set the RGB values to whatever colour you want and edit the alpha value to make it transparent:


Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Feb 2011 19:09
Quote: "I think Somarl is right. Also I don't know what you were reading Rich but nowhere does @Agent say Grog used alpha... just that he used a For...Next loop"


Quote: "We can therefore fade anything we want between solid and invisible by running it through its alpha values in a FOR...NEXT loop just like Grog has done. "


As for the rest... I didn't know that alpha values would fade text like that. Great info!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Feb 2011 23:14
I still do it the way Rich posted originally using the alpha value because it's the much cooler way to do it since you can use it for any image not just text. Mine just changes the red, green, and blue content of the text color. Again, I just wrote it to be different.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 1st Mar 2011 00:13
There certainly is many ways of doing it, and each of them has its own interesting little twist. It was nice learning this just to get a little more insight as to how things like this work, even though in future if i produced any proper game that would use this i would probably go down the lazy route and make a movie instead, or jazz it up a little. But nonetheless it wasnt a pointless exersise, i definateley learned something, thanks guys.

Login to post a reply

Server time is: 2024-11-23 02:44:36
Your offset time is: 2024-11-23 02:44:36