Starwars-Like title?
Blitz3D Forums/Blitz3D Programming/Starwars-Like title?
| ||
How can I make a word scroller look as close to what the starwars title screen does on the original starwars? U know, w/ the slanted words, and the scrolling, and fading of the text as it nears the top of the screen? something that can basically create an invisible plane, and texture it w/ the words on the screen? |
| ||
stick a plane at 75-45' to the camera and render the text to the texture first before rendering it to the screen. see the render to texture example. |
| ||
You could also use some black fog (Camerafogmode), if you have a plain black background, and it would give you the fading out effect. The only other way is to have a custom built mesh, with vertex alpha. Or, i suppose you could use a fading out to black texture on top as well. |
| ||
i dont really know how to render text onto a texture. if i knew, then i could easily build the code for the title screen |
| ||
Well, SetBuffer() & TextureBuffer() command. Then use the text command. SetBuffer determines what buffer your drawing (2d only) command will draw to. That's about all there is to it. Be warned the drawing straight to a texturebuffer sometimes can fail on some PC's. I've never had it happen to me though. |
| ||
ok. i know how now. the only thing i dont get. is how do u know what size texture to create? |
| ||
here's my code so far, how do i make it so the texture is ALWAYS positioned in the middle and top of the cube? |
| ||
As i said it tells you how to do it in the render to texture exaample that comes with blitz. Once you have the buffer set you just use the text command with a font, or drawimage with a bitmap font. Then change back to the backbuffer before renderworld & flip. |
| ||
no, i already did that. i now need to know how to make it so the texture is always POSITIONED in the middle at the top of the cube |
| ||
Depends on how much detail you want, and how close the text will be to the screen. One thing to keep in mind, is the default mipmapping, it reduces the texture detail the further the texture gets from the camera. Anyway, you'll just need to experiment. |
| ||
Late post there. The text command has a centre command too. |
| ||
I'm much more moving things in texture only (and using one or more textures for the text. All these textures with alpha channels, of course). That way you can prepare a special mesh with Vertex Alpha on the top vertices, so that the text fades out when it's far away from the camera. You can use the B3D Pipeline for that. It's much easier because everthing is automated (the smooth alpha gradation, that is). You would just need to keep moving the texture(s) with a negative value on the V axis and Direct3D will take care of the rest. |
| ||
Your asking for trouble :P |
| ||
no, not center the text in the middle of the texture. i mean center the texture in the middle of the 3d cube. |
| ||
basically if you can get it working on the normal 2d screen area @ 1024x1024 first exactly how you want it (draw a temporary blue rectangle under the text as a guide). Then using a simple copyrect to the same buffer with a pixel or two offset on the grab to scroll the area upwards. then once that works perfectly, just draw it to a 1024x1024 texture assigned to the plane using setbuffer(). You do not need to scroll the texture's UV at all. |
| ||
Your using position texture. Don't use that. The texture should be automatically centred, and spread across the whole face of the cube. |
| ||
even if it's flat? |
| ||
Wait. You didn't read/understand what i said. You need to use the centre command with the texture command, and position each text line in the centre of the texture when drawing it. |
| ||
yes. The texturebuffer acts exactly the same as the screen does. once the buffer is set any drawing commands (or 3d with renderworld) will be drawn to it, just as they would to the screen/backbuffer. Positiontexture effects the textures positional UVs which is not what you want. (at all!) As i said, get it working in a 1024^ area of the screen first (simple text scrolling upwards). then you can render it on your plane in 3 more lines of code. PS, the size of the texture should always be power of 2 ie 512x512 or 1024x1024. |
| ||
Seriously, using textures is so simple you could do it with the blink of an eye. The only thing that could complicate is the fade out at the top (and\or bottom) of the plane, and that is handled automatically because of the vertex alpha. Of course, this method will be cumbersome if you don't know how to set the vertex alpha or create alpha-channelled textures. EDIT: ![]() (imagine text instead of the flat white, of course. That fade out is entirely from vertex-alpha). You know why I so strongly support this method? because you would need to only load the mesh, apply the text-textures and move them. Just that. No real-time image rendering. Just offseting a float (you'd also spare the rasterizer of having to handle 6 triangles instead of only 2...). |
| ||
here's what i have so far, it's now cutting off part of the words in the texture: |
| ||
You need to set the start X draw co-ord, for halfway across the texture. Your texture is 256 pixels/texels across, so you need to draw the text X co-ords at halfway across 256. |
| ||
Why are you scaling te texture= if you use a flat cube the textureUV is already 0,0,1,1. You dont need to scale it at all. |
| ||
works GREAT now! thanks Ross! One problem though. How can I make it so the texture is still there and viewable, but the object is invisible, and how can i fade it out as the words scroll across the top of the mesh? |
| ||
Ok. How can I make it so I can color the cube black, but still keep the letters in the texture white? i tried, and it made the entire texture invisible >< |
| ||
entitycolor entity,0,0,0 entityFX entity,1+8 |
| ||
I think what you want to do, is disable lighting, as D4NM4N suggests, with entityfx 1, and the entity color to 0,0,0 (BLACK), but set the entityblend mode to add. Now, each time you cls on your texture, change the clscolor to 0,0,0 (BLACK) and your text writing color to 255,255,255 (WHITE). The blend mode of add, should take the RGB value of each pixel in the texture, and add it to whatever is behind. So, 0,0,0 pixels will add nothing, and therefore appear invisible. 255,255,255 pixel, will add solid white to what ever is behind, so will appear bright white. |
| ||
Entitycolor doesnt work but EntityFX works GREAT! Now the only problems are, how do I slowly fade out the text as it reaches the top of cube (or screen if u prefer) and stop it from after reaching the top of the screen, loop back to the bottom and display it again ? |
| ||
The easiest way, probably, is to put another texture on top. This will act as a fader. I will knock up a texture when i get home. I'm glad to see you've coded this all yourself though, thus far, so well done :) |
| ||
Hey, thanks alot, Ross! :) |
| ||
Ok, problem. For some reason, the texture is not centered in the right place on the cube, or is not positioned in the right place on the cube, so the words are all f'ed up.. |
| ||
I'm glad to see you've coded this all yourself though, thus far, so well done :) Not quite :( Looks like Rez started by stealing this code: http://www.blitzbasic.com/Community/posts.php?topic=87946#1000967 I first noticed that he had a habit of doing this about a year ago when I saw him posting some of my old code and asking people to 'fix' it for him. Looks like he hasn't learned much in the last year... |
| ||
Hmmm, perhaps not Regardless, i'm not writing code out for him, so i'm happy to help, by giving ideas out. Anyway, i was busy with other stuff last night so i'll do that texture. Oh and scaling the texture will cause it to repeat itself. You don't/shouldn't be scvaling the texture, as the entire texture fills the cube faces. If you need more text to fit on, then reduce your text font size. |
| ||
JA2, STAY THE HELL OUT OF MY LIFE! I don't NEED your sorry ass here |
| ||
JA2, STAY THE HELL OUT OF MY LIFE! I don't NEED your sorry ass here I'm not a part of your life, thankfully. Please don't bring my donkey back into this, he's still in therapy after you called him dumb and spewed lots of capital letters at him. |
| ||
Good, well u can take ur "donkey", and GTFO of this thread and leave me the **** alone! |
| ||
Regardless of what JA2 says, you can't go about swearing at folks all the time. And stop being so overdramatic about it, before you get banned. Just concentrate on the subject at hand. |
| ||
i have to agree in one thread you named ja2 specifically and he had not posted in that or another recent thread by you, yet doing so was just a self fulfilling prophercy you might as well be a pre teen girl at a sleep over calling bloody mary three times into a mirror and wonder why shes then slitting your throat but i digress now in learning studying other code works and as we know its how you do your thing, but as long as you know what the code your studying does and arnt just changing something willy nilly then asking why its borked, ill call that progress grabbing 5 random jigsaw pieces and trying to force them together doesnt work and even if it did, the picture would be wrong knowing what the code does is imortant, more than "oh it ran, thats good ill just C+P it into this bit" then finding out its all borked because of it this thread is progress (aside from all the toys outside of the pram) only rez has posted code, even if it is not apparantly his, no one has said "change this block to that or this line to this" all thats been offered is advice and non code explanation of what to do and hes heading in the direction you prod him in i normally keep out of dark shadow wing threads, but ill atleast defend him on 'some' progress |
| ||
Ok, so Ross, what texture were u talking about? and why? |
| ||
http://www.rosscrooks.pwp.blueyonder.co.uk/star_wars_text.zip I have added the texture and re-arranged your/or the copy you copied. It was a bit of a mess. No globals, and references to the cube and camera all over the place. When coding, you should try to keep all the commands that place and set up each entity, together. It makes it eaiser to make changes to that entity, and track down potential errors. In the code you posted above too, the texture background wasn't actually transparent. Anyway, the texture i have added, is a simple fading to back. The way this works, is it blends down, onto the texture below. Any pixels that blend with black, will become trasparent. Anything blending with white, will be completely opaque. And anything inbetween, will be... well inbetween. |
| ||
Thanks Ross :) There's only 1 problem though. How can I make it so that no matter how big of a z-scale I give the cube, the words on the cube will NEVER run out of space and cut off the words? |
| ||
You will always run out of space. I'm not sure what you mean though... |
| ||
Try out this example, it's from the zip file u sent me, only I modded it so it shows that glitch: |
| ||
also, it stretches the text, so i dont like that |
| ||
Erm, all these things are under your control. It's not a glitch. If you don't like the way the text is stretched, simply don't scale the cube X axis so much. Also, if you don't want the text getting cut off, move the camera back, or move the cube forwards, |
| ||
um, dude. it's not the x-axis it's on. it's the z-axis. the x-axis is .0001, and it's rotated so the z-axis works like the x-axis. |
| ||
|
| ||
Same difference. You know what i'm saying though. Anyway, you've implemented that, so whats the issue now? If you want to fit more text in each line, you'll have to either, choose a smaller font size, or make your texture width, bigger. |
| ||
Tried that.. :3 |
| ||
and? |
| ||
Nice to see that you're trying things on your own now, Rez :) |
| ||
dont forget to have a dancing purple elephant inbetween a paragraph |
| ||
Did u even bother to try out the code to see why it was doing what it was doing? |
| ||
if that was to me: did you ever read and watch the opening crawl to something something darkside? |
| ||
That was NOT to u..... |
| ||
Did u even bother to try out the code to see why it was doing what it was doing?[quote] [quote]if that was to me: I think the (rather rude) reply was to Ross C. Shame really, after all he's done to help Rez... |
| ||
well seeing how the posts above mine went it did seem odd to be to me but i had to ask and as ross' post was a question, to reply with a question seemed doubly odd |
| ||
and its a shame ur still on these forums, JA2. |
| ||
![]() |
| ||
ur post doesnt phase me and i WASNT TRYING to be rude to ross. maybe ja2, but NOT ross |
| ||
Did u even bother to try out the code to see why it was doing what it was doing? comes across as rude re my previous few posts if you had said Ross, Did u even bother to try out the code to see why it was doing what it was doing? i wouild have known it was to ross and not me as i was the last post in the thread and you never answered my question ;) (even though it started with "if that was aimed at me" which it transpires it wasnt, still all the same ...) |
| ||
Yep, i still don't know what is wrong with the code. To stretch the text less, scale the cube less. To increase the amount of text you can fit in a line, either: - Increase the width of the texture - Decrease the font size of the text Can you detail what the issue is? |
| ||
and its a shame ur still on these forums, JA2. Why? Because I don't do your programming for you? ur post doesnt phase me and i WASNT TRYING to be rude to ross. maybe ja2, but NOT ross Well you shouldn't be trying to be rude to anyone really. I dunno why you go off on these rants, Rez. It really is quite childish... |
| ||
no. because of the fact that u exist. |
| ||
yes, i can detail what the issue is. infact. ill show u. *uploading image* |
| ||
no. because of the fact that u exist. And that bothers you? Hahahahaha |
| ||
of course. if u didnt exist, i would have a MUCH better life on these forums |
| ||
of course. if u didnt exist, i would have a MUCH better life on these forums Awww now you've gone and hurt my feelings... |
| ||
![]() |
| ||
|
| ||
i want to be able to scale the texture on the cube, so that no matter WHAT size i stretch the z-value to, the scale of the texture will always be the cube size / 2 , and keep the same font width instead of stretching it out |
| ||
Maybe try using the texture flags 16 and 32? |
| ||
nope, didnt work |
| ||
you need to keep the scaling of the cube in proportion to the scaling of the texture. i really don't know why your scaling it at all. essentially if your texture is 128 x 512 then your cubes coresponding dimensions should be the same ratio. ie. the cubes height should be 4 times its width. keep them in proportion. |
| ||
I'm scaling for a reason. the longer I scale the height, the more room I have to put more text. Here's what the 'cube' REALLY looks like w/ the background texture Exhibit A: ![]() Exhibit B: ![]() Now do u see how I'm using the z value as the width of the cube? |
| ||
This is why I want to scale the texture, so I can A) Keep it in the middle of the cube itself, and B) Display ALL the text from the left, to the right of the cube itself, and move the text up, while having the effect of making the cube 'invisible' w/ a fade out texture. |
| ||
you need to increase the texture size then height wise. then scale your cube according as described in my last post. because your working with textures, that have to have power of 2 dimensions , you have to scale your cube accordingly, and will be therefore limited to the sizes you can make your cube. oh and i,m assuming the textue will stretch upwards here. |
| ||
in THOSE 2 pics. yes. in the original engine, nope. it will actually stretch it width-wise. not height-wise. as i rotated the object itself. |
| ||
but surely you will run out of room height wise? anyway, the solution is the same. simply choose a bigger width for your texture and scale your cube according to the dimensions of the texture. |
| ||
no. thats the genius about the fade out of the texture. i can make it as tall as i want, and it will display the WHOLE story :) |
| ||
So, is your problem solved? |
| ||
no. not yet. i still have yet to make the words on the texture all be there w/o cutting out some of the words. |
| ||
You need to make the writing smaller, or, make the texture wider. That's the only way the text won't get cut off. |
| ||
please, please, please proof read and spell check everything before committing it to a png or whatever, i know in the past i, and others, have commented on some of your post eccentricities, but i would be dishing out this advice to anyone including myself, i gave word a sezure with red and green wavy lines all over the show and i was the only person i intended to ever read my text. note this is severly lacking in my forum posts as i dont use any proof reading tools for this kinda thing mr paper clip over and out ;) |
| ||
so it was ONE mistake. im human too ya know. |
| ||
How can I make the text like this? I need text-wrap. Is there a such function in Blitz, or a link to where I can find this function in Blitz 3D? http://www.youtube.com/watch?v=wRHFcQgNFQ8 |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php |
| ||
I did a textbox function for you, sometime last year, which featured text wrapping, and was in a nice function. I don't have it anymore. Oh wait, just searched: http://www.rosscrooks.pwp.blueyonder.co.uk/textscoller.zip This link contains a basic version, i'm not sure if it contain the text scrolling version, but you should still have it somewhere, as i finished it off. http://www.blitzbasic.com/Community/posts.php?topic=77340 I did a 2d version for someone in this thread and included the source. I don't know if it's all there, but the text wrapping part is def there. Anyway, you have the code needed to wrap text :) |
| ||
I still have the email i sent you, with the code. But you have no email address so i can't forward it. |
| ||
i have an email address, i will forward a message to ur email. So check ur inbox :) |
| ||
Sent |
| ||
Thanks, Ross. But I didn't know it was THAT demo that you were talking about. I still have the WHOLE project in fact! =D |
| ||
Ross, can you make it so that this code of yours "presses enter" automatically until it reaches the end of what it's supposed to say then it stops and doesnt display anymore text? and is there a way i can slow it down? |
| ||
just remove the part where the key hit exists and satisfy the condition for proceeding. |
| ||
what do u mean by that last part, mate? i get the 1st part. also, how do i slow down the text? |
| ||
Well, i haven't looked at this in a while, but the time field in the cur_paragraph type collection, would be my best bet for slowing it down. Increase whatever value it has. In fact, there is a reference to it, directly below, in the form of :p\time = 10" Also, the way this is designed to work, is the data statements at the end, are all seperate windows. Data "This is the first paragraph of ten. This code should word wrap the letters round so that they all fit in the window. And let the user press a button to continue to the next text." That is all the one paragraph. It was designed to do this, based on your need for it. I'm sure when it opens up a new paragraph, it will clear the screen, so pressing enter automatically won't help. I'm afraid i don't really have the time to sift through this, as i'm busy helping someone do graphics. It shouldn't be too hard to adopt this though. If p\char > Len(p\text_) Then ; last character reached p\status = 2 Else If Mid(p\text_,p\char,1) = " " Then next_word_status = check_next_word(p\text_,p\char,p\x) If next_word_status = -1 Then ; no more words p\status = 2 ElseIf next_word_status = 0 ; not enough room on this line p\y = p\y + StringHeight(p\text_) p\x = 10 ; 10 = how much the text is inset. ElseIf next_word_status = 1 ; enough room on this line p\x = p\x + StringWidth(" ") ; advance the p\x variable the width of a string ; no need to draw anything. End If Else SetBuffer TextureBuffer(text_texture) Text p\x,p\y,Mid(p\text_,p\char,1) SetBuffer BackBuffer() p\x = p\x + StringWidth(Mid(p\text_,p\char,1)) End If End If This part inside update_letters() function. It checks the current character. If it is a space, then it will look ahead at the next word, and check to see if it fits. More spefically this: ElseIf next_word_status = 0 ; not enough room on this line p\y = p\y + StringHeight(p\text_) p\x = 10 ; 10 = how much the text is inset. If the next word doesn't fit, then it will start a new line. So, if you choose a specific character to be a line terminator, it will automatically start a new line. So, in the update_letters() function, put in another IF statement to check for this character. If it's found, simply copy the code that executes if next_word_status = 0, as above. That will start a new line, and enable you to use this for what you need. |
| ||
how can i get it to show the text, but remove the whole window? |
| ||
If i'm going to have to recode i can't. it should be pretty straight forward to rip out the parts you need to code this . you said you learn by example so that code should be perfect. just read through it and study what is happening. it's all there for you |
| ||
Wow, 98 posts and he still doesn't get it. Rez, i'm sorry but you need to learn how to teach yourself, not get others to do the work for you. |
| ||
Next post from Rez will be something like: BACK OFF I am teh bestest coder EVER and I've made something EVEN BETTER than you can code. I'm LEAVING the blitz forums FOR GOOD because of that donkey JA2!!! |
| ||
I do not want to make enemies, just wanted to point that out. |
| ||
u know what, ja2?! NOW look whos being the stupid d***! LEAVE ME THE FUCK ALONE! |
| ||
u know what, ja2?! NOW look whos being the stupid d***! LEAVE ME THE FUCK ALONE! Aww come on, Rez. Don't be so mean... Hahaha |
| ||
This is a good time for a lock, just sayin. |
| ||
I'm wondering why Rez edited out the d*** but left the f*** unedited? |
| ||
LEAVE ME ALONE U PRICK! |
| ||
LEAVE ME ALONE U PRICK! Hahaha I'm not doing anything to you. Don't get yourself banned, Rez... |