I'm now interested in plasma stuff

Miscellaneous Forums/General Discussion/I'm now interested in plasma stuff

I was looking at the Plasma Pong thread.

I remember plasma stuff from the Amiga days.

I want to do plasma stuff.

Submit your code here - good stuff though.

Plus I need someone to explain the concept of plasma routines.

I'll do the rest.

my old school demo in my sig has some plasma in it.

Not good enough.

I'm off to bed - I'll expect some progress when I wake up.

Funny I've been thinking the same thing.
This link was in the readme for plasma pong, and looks like it would be straightforward to convert into blitz.

http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

and here is another, much more complex paper also mentioned at the plasma pong website
http://download.developer.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/src/gpgpu_fluid/docs/GPU_Gems_Fluids_Chapter.pdf

This stuff (fluid dynamics) is a bit different from plasma effects (lots cooler I think) but a lot of the same things would apply for both I would guess. There is at least one plasma effect in the code archives as well, in the graphics section.

well mines like the Amiga stuff, there wasn't any advanced physics done on Amigas then!

sorry, only maxgui here atm :P Tho it's only for the actual displaying.. and it was rushed a bit, I did better ones in the past ^_^
Strict

' CS_TBL

Local window:TGadget=CreateWindow("plasma",200,100,400,300)
Local canvas:TGadget=CreateCanvas(0,0,256,192,window)


Local timer:TTimer=CreateTimer(30)

Local f1:Int
Local f2:Int
Local f3:Int

Local x:Int
Local y:Int

Local r:Int
Local g:Int
Local b:Int

Local m1:Float
Local m2:Float

Repeat
	WaitEvent()
	If EventID()=EVENT_WINDOWCLOSE End
	
	If EventID()=EVENT_TIMERTICK
	
		SetGraphics CanvasGraphics(canvas)
			Cls
			f1:+2
			f2:+3
			f3:-4
			
			For y=0 To 191 Step 8
				For x=0 To 255 Step 2
				
					m1=Cos(f1+y)*128
					m2=Cos(f2+x)*128
			
					r=Sin(f1-x+y/4+m1)*127+128
					g=Sin(f2+y/2-x/4+m2)*127+128
					b=Sin(f3+x+y-m1/4)*127+128
					
					r=Limit(r,0,255)
					g=Limit(g,0,255)
					b=Limit(b,0,255)
					
					SetColor r,g,b
					DrawRect x,y,1,8
					
					r=Sin(f2+x+y/7+m1)*127+128
					g=Sin(f3-y/2-x/6-m2)*127+128
					b=Sin(-f1+x-y+m1/4)*127+128
					
					r=Limit(r,0,255)
					g=Limit(g,0,255)
					b=Limit(b,0,255)
					
					
					SetColor r,g,b
					DrawRect x+1,y,1,8
				
				Next
			
			Next
		
		Flip
		
	EndIf
	
Forever

Function Limit:Int(v:Int,lo:Int,hi:Int)
	If v<lo Return lo
	If v>hi Return hi
	Return v
End Function


Wouaou.
Phong : Those are really crazy papers.
But from CS_TBL's code looks like are really expensive.

Look at the gridrunner game in the 2D samples directory. It has a low-res plasma background.

Used to be easy to cheat to get this kind of effect when we had colour cycling with colour palettes. :P

lil' fix here

Strict

' CS_TBL

Local window:TGadget=CreateWindow("plasma",200,100,400,300)
Local canvas:TGadget=CreateCanvas(0,0,256,192,window)


Local timer:TTimer=CreateTimer(30)

Local f1:Int
Local f2:Int
Local f3:Int

Local x:Int
Local y:Int

Local r:Int
Local g:Int
Local b:Int

Local m1:Float
Local m2:Float

Repeat
	WaitEvent()
	If EventID()=EVENT_WINDOWCLOSE End
	
	If EventID()=EVENT_TIMERTICK
	
		SetGraphics CanvasGraphics(canvas)
			Cls
			f1:+2
			f2:+3
			f3:+4
			
			For y=0 To 191 Step 4
				For x=0 To 255 Step 4
				
					m1=Cos(f1+y)*128
					m2=Cos(f2+x)*128
			
					r=Sin(f1-x+y*2+m1)*127+128
					g=Sin(f2+y*2-m1+x*3+m2)*127+128
					b=Sin(f3+x+y-m1*3)*127+128
					
					r:+Sin(f2+x+y*2+m2)*127+128
					g:+Sin(f3-y*2-x*3-m1)*127+128
					b:+Sin(f1+x-y*2)*127+128
					
					r=Limit(r/2,0,255)
					g=Limit(g/2,0,255)
					b=Limit(b/2,0,255)
					
					
					SetColor r,g,b
					DrawRect x,y,4,4
				
				Next
			
			Next
		
		Flip
		
	EndIf
	
Forever

Function Limit:Int(v:Int,lo:Int,hi:Int)
	If v<lo Return lo
	If v>hi Return hi
	Return v
End Function


The bottomline is: just fool around a bit with sines and such..

ya don't even have to be a math-wiz to do plasmas.. just mess around with them sines..

This one uses 'indexed color' and a small'ísh/neat'ish gradient-calcer. ^_^

Strict

' CS_TBL

Local window:TGadget=CreateWindow("plasma",200,100,400,300)
Local canvas:TGadget=CreateCanvas(0,0,256,192,window)


Local timer:TTimer=CreateTimer(30)

Local f1:Int
Local f2:Int

Local x:Int
Local y:Int

Local m1:Float
Local m2:Float

Local cr:Int[256]
Local cg:Int[256]
Local cb:Int[256]

Local i:Int

Local t:Int

For t=0 To 255
	cr[t]=Limit(-100+t*2,0,255)
	cg[t]=Limit(t*2,0,255)
	cb[t]=Limit(100+t*2,0,255)
Next

Repeat
	WaitEvent()
	If EventID()=EVENT_WINDOWCLOSE End
	
	If EventID()=EVENT_TIMERTICK
	
		SetGraphics CanvasGraphics(canvas)
			Cls
			f1:+2
			f2:+3
			
			m1=Sin(f2)*230
			m2=Sin(f1)*250
			
			For y=0 To 191 Step 4
				For x=0 To 255 Step 4
				
					i= Sin(f1+x+m1*Sin(y+f1*3))*127+128
					i:+Sin(f1+y+m2*Sin(x+f2*2))*127+128


					i=Limit(i/2,0,255)
					
					
					SetColor cr[i],cg[i],cb[i]
					DrawRect x,y,4,4
				
				Next
			
			Next
		
		Flip
		
	EndIf
	
Forever

Function Limit:Int(v:Int,lo:Int,hi:Int)
	If v<lo Return lo
	If v>hi Return hi
	Return v
End Function