Author Topic: OldSkool FX (interference circles)  (Read 6768 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
OldSkool FX (interference circles)
« on: March 21, 2007 »
While trying to explain a friend an old demo fx and had no idea how it looks like, i did a small example and now there are different versions of it :D

Code: [Select]
; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600)
CreateSprite(1,800,600)

StartDrawing(SpriteOutput(lSprite))
  For i = 0 To 25
    lColor = -lColor +1
    Circle(400,300, 500-(i*20), RGB(lColor*255, lColor*255, lColor*255))
  Next
StopDrawing()

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  DisplayTransparentSprite(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
  DisplayTransparentSprite(0, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  vain.d = vain.d + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

Code: [Select]
; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600)
CreateSprite(1,800,600)

For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite
         Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0))
      Else
         Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255))
      EndIf
    Next
  StopDrawing()
Next

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  DisplayTransparentSprite(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
  DisplayTransparentSprite(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  vain.d = vain.d + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

Code: [Select]
; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600,#PB_Sprite_Texture)
CreateSprite(1,800,600,#PB_Sprite_Texture)

For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite
         Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0))
      Else
         Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255))
      EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(10,7)
    DisplaySprite3D(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
    DisplaySprite3D(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

Code: [Select]
; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600,#PB_Sprite_Texture)
CreateSprite(1,800,600,#PB_Sprite_Texture)
CreateSprite(2,800,600,#PB_Sprite_Texture)

For lSprite = 0 To 2
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite = 0 : Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0)) : EndIf
      If lSprite = 1 : Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255)) : EndIf
      If lSprite = 2 : Circle(400,300, 500-(i*10), RGB(0, lColor*255,0)) : EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)
CreateSprite3D(2,2)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(10,7)
    DisplaySprite3D(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
    DisplaySprite3D(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
    DisplaySprite3D(2, -50+Sin(vain.d/2)*50, -50+Cos(vain2.d)*50)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

If you guys want executables of the examples, just request and i will post it with link ^^
« Last Edit: June 17, 2007 by va!n »
- 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 va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: OldSkool FX
« Reply #1 on: March 21, 2007 »
Code: [Select]
; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,1024,768,#PB_Sprite_Texture)
CreateSprite(1,1024,768,#PB_Sprite_Texture)


For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite = 0 : Circle(512,384, 500-(i*10), RGB(lColor*(i*5), 0, 0)) : EndIf
      If lSprite = 1 : Circle(512,384, 500-(i*10), RGB(0, 0, lColor*(i*5))) : EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(4,7)
    DisplaySprite3D(0, -100+Cos(vain2.d)*50, -100+Sin(vain.d)*50)
    DisplaySprite3D(1, -150+Sin(vain.d)*50, -150+Cos(vain.d)*50)
    DisplaySprite3D(1, -200+Sin(vain.d/2)*200, -100+Cos(vain2.d)*100)
    DisplaySprite3D(0, -150+Cos(vain2.d)*150, -150+Sin(vain.d/2)*150)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
- 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 Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: OldSkool FX
« Reply #2 on: March 21, 2007 »
Yes please dude exes would be super! And thanks :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: OldSkool FX
« Reply #3 on: March 21, 2007 »
Here you can download a zip containing all the different versions as source and executeables!

www.secretly.de/public/OldSkool_FX.zip
- 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 Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: OldSkool FX
« Reply #4 on: March 21, 2007 »
Nice one  :updance:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: OldSkool FX
« Reply #5 on: March 21, 2007 »
Wicked Va!n - will give them ago.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: OldSkool FX
« Reply #6 on: March 21, 2007 »
Nice Keftales dude :)

Cheers and all the best,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: OldSkool FX
« Reply #7 on: March 21, 2007 »
Very good. Love those hypnotic fx. Thx for sharing !
 :goodpost: and K++ !!
[ 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: OldSkool FX
« Reply #8 on: March 21, 2007 »
Really nice interference circles :) I liked the 5th version the best as the rings look like they are stretching, classic Amiga effect there va!n :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: OldSkool FX
« Reply #9 on: March 21, 2007 »
thanks for the nice feedback :)
- 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 Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: OldSkool FX
« Reply #10 on: March 21, 2007 »
No problem :)

You can make a lot more things out of this technique too :)
The attached exe is exactly the same technique.

Code: [Select]
'
'
'
'

'--------------------------------------------------------------------------

            OPTION STATIC
            OPTION EXPLICIT
            Print "PRECALCULATING"
'-------------------------------------------------------------------------
'Please ditch the defs below, they are for the shit fps counter.
'Benchmark reading when nothing is happening is;
'
'-------------------------------------------------------------------------
        declare sub millisecs()
        DIM SHARED AS DOUBLE oldtime,newtime
        dim shared ticks,t as integer
       
'-------------------------------------------------------------------------
' The stuff below is needed to set up the circles;
'-------------------------------------------------------------------------
       
        declare sub dcircle(BYVAL CX AS INTEGER , BYVAL CY AS INTEGER , BYVAL R AS INTEGER, BYVAL CLR AS INTEGER)
        declare sub generate()       
        Dim Shared As uInteger Buffer( 640 * 480 ):  ' Screen Buffer. (or your texture buffer)
        Dim Shared As ubyte C_Buffer( 1280 * 1280 ):' Circles Buffer.
        dim shared as Uinteger C_Palette(512): ' Circles Palette.
       
        declare sub Make_circle_palette()
        declare sub render_delerium1(BYVAL XCX AS uINTEGER , BYVAL XCY AS uINTEGER)
        declare sub render_delerium2(BYVAL XCX AS uINTEGER , BYVAL XCY AS uINTEGER)
        dim shared cwobble as integer
        MAKE_CIRCLE_PALETTE()
        GENERATE()

'-------------------------------------------------------------------------
' Includes.
'-------------------------------------------------------------------------
            '#define PTC_WIN
            #Include Once "tinyptc.bi"

'-------------------------------------------------------------------------
' Open Screen;
'-------------------------------------------------------------------------

        If( ptc_open( "FAST DELERIUM", 640, 480 ) = 0 ) Then
        End -1
        End If
   
'-------------------------------------------------------------------------
' Main Loop;
'-------------------------------------------------------------------------

DIM SHARED GADD AS INTEGER

    DO
       
        'WAIT &H3DA,8
       
       
    gadd=gadd+1
   
    render_delerium1(320+200*sin(gadd/33),420+200*sin(gadd/63))
    render_delerium2(320+200*sin(gadd/43),420+200*sin(gadd/53))
   
   
    millisecs()
    ptc_update@buffer(0)   
    ticks=ticks+1 :' <-- Ditch this (FPS Counter)
   
    LOOP UNTIL INKEY$ = CHR$(27)


'-------------------------------------------------------------------------
' Make some nice colours!.
'-------------------------------------------------------------------------

sub make_circle_palette()
    dim as integer A,RD,GR,BL
    RD=0
    GR=0
    BL=0   
    FOR A=1 TO 250
       
        If A<125 and RD<250 then RD=RD+3
        if A<125 AND GR<250 then GR=GR+2
        if A<125 and BL<250 then BL=BL+1       

        If A>125 and RD>5 then RD=RD-1
        if A>125 AND GR>5 then GR=GR-2
        if A>125 and BL>5 then BL=BL-3       
       
        C_palette(A) = RGB (int(RD),int(GR),int(BL))
    NEXT

FOR A=251 TO 500
       
        If A<375 and RD<250 then RD=RD+1
        if A<375 AND GR<250 then GR=GR+1
        if A<375 and BL<250 then BL=BL+1       

        If A>375 and RD>5 then RD=RD-1
        if A>375 AND GR>5 then GR=GR-1
        if A>375 and BL>5 then BL=BL-1       
       
        C_palette(A) = RGB (int(RD),int(GR),int(BL))
    NEXT

end sub


'-------------------------------------------------------------------------
' Render 1st circle set, clearing the buffer as we go.
'-------------------------------------------------------------------------

sub render_delerium1(BYVAL XCX AS uINTEGER , BYVAL XCY AS uINTEGER)
    dim as uinteger x,y,xrs,yrs,bpos,ppos,yppre1,yppre2
   
   cwobble=cwobble+3
    ' 573
    for y=0 to 479       
        yppre1 = 640*y
        yppre2 = (1280*(y+XCY))+(61+59*sin((y+cwobble))/23)
    for x=0 to 639
        bpos=yppre1+x
        ppos=yppre2+(x+XCX)
        buffer(bpos) = C_buffer(ppos)       
    next
    next
       
end sub

'-------------------------------------------------------------------------
' Render 2nd circle set and convert buffer to colours
'-------------------------------------------------------------------------

sub render_delerium2(BYVAL XCX AS uINTEGER , BYVAL XCY AS uINTEGER)
    dim as uinteger x,y,xrs,yrs,bpos,ppos,yppre1,yppre2
   
   
   
    for y=0 to 479       
        yppre1 = 640*y
        yppre2 = (1280*(y+XCY))+(69+68*sin((y+cwobble)/25))
    for x=0 to 639
        bpos=YPPRE1+x
        ppos=YPPRE2+(x+XCX)
        buffer(bpos) = C_PALETTE(buffer(bpos) + C_buffer(ppos))
    next
    next
       
end sub

'-------------------------------------------------------------------------
' Circle routine;
'-------------------------------------------------------------------------

SUB dCIRCLE(BYVAL CX AS INTEGER , BYVAL CY AS INTEGER , BYVAL R AS INTEGER, BYVAL CLR AS INTEGER)
DIM  as integer r2,cc,loopy,ww,l
r2=r*r
cc=-r
for loopy = cc to r       
        ww = Sqr(r2-loopy*loopy)
        for l = CX-ww to CX+ww                   
                       C_buffer((1280*(loopy+CY))+l)=CLR                   
        next   
       
next
END SUB

'-------------------------------------------------------------------------
' Create circle pattern
'-------------------------------------------------------------------------

sub GENERATE()
    dim rr,lame,ccl as integer
    lame=0
        ccl=0
        for rr=639 to 1 step-1
        dcircle (640,640,rr,ccl)
        if lame = 0 then ccl = ccl+2
        if lame = 1 then ccl = ccl-2
        if ccl>=250 then lame=1
        if ccl<=3 then lame=0
        next
END SUB

'-------------------------------------------------------------------------
' Shit FPS Counter, discard.
'-------------------------------------------------------------------------

SUB Millisecs()
    dim as double t   
    t=timer
if  t-oldtime >=1 then
    newtime = ticks
    ticks=0
    oldtime=timer
    print str( (newtime) )               
end if   
end sub

Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: OldSkool FX
« Reply #11 on: March 21, 2007 »
@SW:

That's simply amazing. Looks tremendous. Excellenet enhancement of this fx!
Some K++ !!!
[ 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: OldSkool FX
« Reply #12 on: March 21, 2007 »
very nice done!  :goodpost:
- 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: