Main Menu

Fungus

Started by kevin, May 10, 2005, 08:34:30 AM

Previous topic - Next topic

kevin

Here's a little example of being able to render to FX buffers..  It's drawing some alpha add circles to this screen sized fx image, then runs a Alpha subtract box over the entire screen and blits then faded result  to the back buffer..   That's a fair gut full for the cpu, but it's still cloking 43/44fps on my duron 800.

 It'd make a nice screen blanker, as patterns sort of grow, then fade away..



 Here's the code (even though it requires PB 1.07)

PlayBASIC Code: [Select]
   sw=GetScreenwidth()
sh=GetScreenHeight()

createimage 1,sw,sh
preparefximage 1

FungusColour=$020301

Do

rendertoimage 1
inc frames

if Frames>200
r=rndrange(2,4)
g=rndrange(2,4)
b=rndrange(2,4)
FungusColour=rgb(r,g,b)
frames=0
endif


lockbuffer
inkmode 1+64
for lp =0 to 35
circlec rnd(sw),rnd(sh),rndrange(20,40),1,FungusColour
next

inkmode 1+128
boxc 0,0,sw,sh,1,$010101
unlockbuffer

rendertoscreen
drawimage 1,0,0,0


Sync
loop







updated version of the code (PB V1.64)

PlayBASIC Code: [Select]
   #include "blitimage" 

sw=GetScreenwidth()
sh=GetScreenHeight()

Screen=Newfximage(sw,sh)

FungusColour=$020301

Do

rendertoimage Screen
inc frames

if Frames>200
r=rndrange(2,4)
g=rndrange(2,4)
b=rndrange(2,4)
FungusColour=rgb(r,g,b)
frames=0
endif

lockbuffer
inkmode 1+64
for lp =0 to 35
circlec rnd(sw),rnd(sh),rndrange(20,40),1,FungusColour
next
unlockbuffer

rendertoscreen
BlitImageAlphaSubColour(Screen,0,0,$010101)

Sync
loop







Draco9898

#1
We going to get 1.07 soon? any other cool effects? I'm still wondering about maybe some lighting and stuff  ;)
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin

It'll be ready, when it's ready.

kevin

Fungus + Sprites  & FireLines


Managed to speed up the Alpha ADD/ SUB blit functions.  So as result this demo is doing even more faster than the previous one. (50fps on duron 800)

Should be able to move some speed out of the blender by moving to MMX..

Draco9898

#4
That one looks neat, good job :) Any masking effects with sprites or such?
Could you build some Exe's of those demos?
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin

Here's the MMX version running..   The main time eater is the BlitAlphaSUB routine which copies the FX buffer and alpha subtracts each pixel in it.   This is made a lot easier using MMX instruction set.  As a result the blit alone makes the demo about 12/13 Fps faster.  So the previous tech demo is now running over 60fps (again on the duron 800)..  I think about's about as a fast as i can get it..  

This one has 100 rotated sprites, 100 alpha ADD lines,  a bunch of alpha circles to create the backdrop effect and a full screen alpha blit.. Which makes for a pretty decent  result... Those with really fast cpu's should be able to throw truck loads of sprites around.

Jeku

Niiiiice :)  Would love to see an EXE of that first fade screenie... I need something to rejuvinate the look of my new game...
**
Automaton Games - Home of WordTrix 2.0, WordZap, and GameBasic
Jeku's Music - Easy listening electronic...
**

kevin

Here's a video feedback example running in he existing test...  It's created by rendering to an image that's using this same image as it's texture.

Pretty much hooked up all the current avail sprite render modes.. Just need to hook up some commands so the user can set the variuos values (i.e. colour flash, add, sub, fade level, gournd rgb 's ), which currently you can't do.

kevin

#8
 Fungus

 This short 10 second video of a spinning, morphing textured polygon effect which has found in the PlayBASIC demos folder for years.    The effect is created through a combination of drawing a bunch of randomly positioned alpha additive circles to texture image while pre-applying an alpha subtraction to the all the pixels in the image.   This is then rendered to the screen.


  Additive alpha blending means the RGB colours are added to each.  In RGB terms this means the R , G and B channels from the destination image and the source colour (The Circle in this example) are added together individually.    The result for each channel is clamped at a maximum of 255.

    So if we added the RGB (200,100,200) colour  to RGB(10,200,255) colour  the result;

      we'd get RGB (200+10 , 100+200, 200+255) 

      Which would give us a new colour pf RGB (210. 255. 255)

  Subtraction is the same; except we subtract the individual channels of the source colour from the destination colour. 
   


PlayBASIC Code: [Select]
   CreateFXImage 1,600,500


sw=GetScreenWidth()
sh=GetScreenHeight()

MySprite=NewSprite(sw/2,sh/2,1)
SpriteDrawMode MySprite,2
SpriteTransparent MySprite,Off
CenterSpriteHandle MySprite
ScaleSprite MySprite,1.8

FungusColour=$020301

MakeBitmapFont 1,$ffffff

Do
Inc frames

If Frames>150
r=RndRange(1,4)
g=RndRange(1,4)
b=RndRange(1,4)
FungusColour=RGB(r,g,b)
frames=0
EndIf

lockbuffer
RenderToImage 1
iw=GetImageWidth(1)
ih=GetImageHeight(1)
inkmode 1+128
boxc 0,0,iw,ih,true,Rgb(1,1,1)
InkMode 1+64
For lp =0 To 37
CircleC Rnd(iw),Rnd(ih),RndRange(20,40),1,FungusColour
Next

RenderToScreen

TurnSprite MySprite,0.95
DrawSprite MySprite

UnLockBuffer

Sync
Loop





Watch this video on youtube