Author Topic: Special sinusscrolling effect and I just don't get it  (Read 14660 times)

0 Members and 2 Guests are viewing this topic.

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Hey everybody,

Since this question can be asked to all coders, I'm going to ask it here.
Our GFX guy sended me this as screenprint as example of an effect he would love to have (in one of our demo's).

I tried and tried and really hurted my brain but I just don't get the technique of how to code it.
I did the sinusscrolling (basic) already with all characters clipped in 1 pixel width sprites but I just don't know what to do next  ???

Does anybody has an idea ?

All help appreciated,
DeXtr0

P.S. I'm trying to code it in PureBasic

« Last Edit: July 30, 2007 by DeXtr0 »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Kind of difficult to see what that effect does from the screen shot, but I will give it a try :)

Now, it seems as if the letters all keep the same width at least, it is the height of the letters that is changed.

It looks a little different to a normal sine scroll and I'd guess that the letters are being scaled vertically and not just sined!

And it looks more complicated than that still... The sine curves run smoothly through the line of text and so it brings me to the solution.

You need to have two sine waves and they both need to be slightly different so that the letters will stretch in between them.

You can use something called linear interpolation to stretch the scroll in between the sine waves. (see the pic below).

Again, working across the screen for each point of the sine wave you subtract the top from the bottom to give the size of the gap.

You then scale the strip of letter to fit the gap, drawing the top bit of it at the top wave.

This is assuming that you have a command in PB that lets you stretch sprites. (I believe that drawimage does???)

If you don't have that then you will need to stretch them manually and that means dividing the height of the letter by the size of the gap to get the value to interpolate by, it's a very simplified version of texture mapping.

But to put it as simply as I can, you need to think of this effect as stretching the letters to fit the gap between two sine waves.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Hey shock,

Always the master that answers first  :D

The idea of the vertical sizing is possible. I'm going to give that a try first
Then i'll see if I need 2 sinustables for the upper y and the lower y pos.

I'm going to try it again..

Keep you informed,
1000x Thanks,
DeXtr0

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
@DeXtr0:
do you know any demo where we can see the fx you requested? Maybe it would be nice for furture questions, if you can link to a demo (or video) if the fx is not really visible ^^ thx and happy coding :)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Sure va!n,

Our stuff is on our website www.dawncreations.com but we have only released 1 intro and one of our coders is coding a small risk-clone atm.
I'm coding mainly on our effects library  ;)

The effect i talked about is a BIT like the one in this intro but in this intro it's elite and that i can (not) yet code  :(

Cheers,
DeXtr0

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
@DexTr0:

Don't really know - guess Shockwaves idea about interpolation and/or different sinus tables
are most precise. Although I wonder if there arent any simpler way of doing it. Sometimes
you can achieve realistic looking fx with very simple equalations.

Nevertheless, I would first have a go trying it with zooming the clipped regions in and out.
Maybe this looks something like the desired fx...or accidently looks cool in another way ;-)

Anyway - good luck !
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Hey Benny, Shockwave, Vain and all others

This is what I managed to code yesterdayevening+night  ;)

But i'm not yet 100% there I think..

What do you think ?

Cheers,
DeX

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
@DexTr0:

Runs smooth here - but you are right. It just looks like the scroller gets bigger and
smaller.

Guess we need some translation in 3D. Meaning, that you add to the upper x,y
and lower x,y coordinate of a clipped area some z-/depth factor. And then re-
calculate its 2D coordinates (like you do it with 3D starfields). Maybe this looks more
realistic ???
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Quote
I can not say : x,y coordinates of the top of the clipped sprite = 10,20 - x,y coordinates of the bottom of the clipped sprite = 60,30

atm i am not really sure what you mean. sorry! but do you means something like the command ClipSprite() ?


[Accidental Edit - Shockwave (sorry DeXtro!) ]
« Last Edit: July 31, 2007 by Shockwave »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Nice work, that's exactly the way I imagined it would look.

In the class intro you posted, this is definately some textured quads using opengl or what ever api they used. It is different to the effect you have achieved.

A couple of ideas..

First your sinetable (the bottom one) seems to have a sharp step in it which hurts the effect a little bit.

Second, benny is right about the 3D thing, but it may be better in this case to stretch the scroll across in the same way to make some letters narrower..

I don't know what to say exactly, I have a feeling that this is one of those cases where you might go in and try to do something, but come out the other side with something a little bit different (though just as good!).
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Hrhr editing my posts haha :)

Nah no problem shockwave accidence can happen :)

And yeps I will try to do better but I don't know what i can do more.
I have to experience with transformSprite3D but as you can see in the example, I'm going in the good direction..

You tip was a golden one  :clap:

Soon an intro will follow with this effect (i hope)

Cheers,
DeXtr0

PS. Feel free to register on our forum aswell..

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Sorry about that Dextro, it happened because the quote button is right next to the modify button :(

Never knew you had a forum, I'll reg.

And I'm looking forward to seeing the intro!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
That was a fast reg !  :hi:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Special sinusscrolling effect and I just don't get it
« Reply #13 on: August 01, 2007 »
...
Soon an intro will follow with this effect (i hope)
...

Cool news - looking forward to see it !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Special sinusscrolling effect and I just don't get it
« Reply #14 on: August 01, 2007 »
Cool! I am still looking forward too ;)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Re: Special sinusscrolling effect and I just don't get it
« Reply #15 on: August 01, 2007 »
Haha you will guys.

Btw you are both in the greetings for helping me out  ;)

Cheers,
DeXtr0

P.S. Feel free to join our forum too. Always welcome...

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Special sinusscrolling effect and I just don't get it
« Reply #16 on: August 01, 2007 »
Mhhhh.... i think following is not the OldSkool coding way but maybe you can use or just test this way as you are using Sprite3D already, right? I still have an idea but i am not sure if this way would work.

What about when having for the scroller an own texture for example if the screen is 640x480 and each fontchar 32x32 pixel... to use a 640x32 texture with some vertices like follwing:

Code: [Select]
+-+-+-+-+-+-- -  -
|\|\|\|\|\|
+-+-+-+-+-+-- -  -


You could draw your scroller on this texure and transform each vertices for x,y for sinscroller and z for doing a zoom (transform) fx i.e.?! Just an idea...
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Special sinusscrolling effect and I just don't get it
« Reply #17 on: August 01, 2007 »
...
P.S. Feel free to join our forum too. Always welcome...

Registered  8)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Special sinusscrolling effect and I just don't get it
« Reply #18 on: August 02, 2007 »
Mhhhh.... i think following is not the OldSkool coding way but maybe you can use or just test this way as you are using Sprite3D already, right? I still have an idea but i am not sure if this way would work.

What about when having for the scroller an own texture for example if the screen is 640x480 and each fontchar 32x32 pixel... to use a 640x32 texture with some vertices like follwing:

Code: [Select]
+-+-+-+-+-+-- -  -
|\|\|\|\|\|
+-+-+-+-+-+-- -  -


You could draw your scroller on this texure and transform each vertices for x,y for sinscroller and z for doing a zoom (transform) fx i.e.?! Just an idea...

good exlanation and it would lead to the effect in the class intro :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DeXtr0

  • C= 64
  • **
  • Posts: 79
  • Karma: 4
  • Proud member of dAWN
    • View Profile
    • dAWN Creations
Re: Special sinusscrolling effect and I just don't get it
« Reply #19 on: August 05, 2007 »
Hey Va!n,

can you explain a bit more ? I don't follow 100%

Drawing on a texture should be possible but the "vertices" I don't understand completely ?

Can you drop me a light on this one please ?

Thanks,
DeXtr0