Smoke
Blitz3D Forums/Blitz3D Programming/Smoke
| ||
Ok, i wrote this particle effect code and it's basicaly meant to look like smoke. It just ends up looking like a lot of grey blobs that don't look anything like smoke... I'm using a grey blurry sprite as the main_particle. Does anyone have any ideas anout how I could make this a bit more realistic. Here's the code: Function createparticle(player) p.particle=New particle p\entity=CopyEntity(main_particle) p\x=EntityX(player) p\y=EntityY(player)-1 p\z=EntityZ(player)-1 p\time=Rand(1400,2200) p\timer=MilliSecs() PositionEntity p\entity,p\x,p\y,p\z p\speed=-3 p\alpha=1 End Function Function updateparticles() Local random=Rnd(-0.5,0.5) For p.particle= Each particle p\alpha=p\alpha-0.1 EntityAlpha p\entity,p\alpha MoveEntity p\ent,random,random,random If MilliSecs()>p\time+p\timer Then FreeEntity p\entity Delete p.particle EndIf Next End Function |
| ||
If you played my latest demo (secret of manes) there is some smoke with the impact of the bullets when you fire the gun against a wall. If you like that - I released it some time ago, check blitzcoder.com for a particle system by norc. basicly it works in a way that a number of sprites are fading in and out cascadicly, partially overlapping (in time) while their size is increasing. Tey are all using the same sprite, the nebula sprite at a max of about .2 alpha transparency. It's not single surface, but it's very simple to use and flexible. you can have any number of textures simultanously with that system. In the Demo I use it for Fire and Smoke in the same time. however. - http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=norc02062003164813&comments=no |
| ||
Wow, nice demo. Thanks, is it Ok if i change the source etc, and use my own textures? If so, i will be using this in my next project. Once again, v nice effects... ;] |
| ||
yes, of course! |
| ||
Thanks. |
| ||
i have cinema 3d and have been playing around with the pyro plugin. I was wathcing the smoke. To get more realistic smoke they use a sprite system that animates the sprites. So its not just a fade from 1 sprite to nothing. So if you have a fire. the sprite is bright yellow and a full fireball, but at the end it is a small wisp. they also transition the alpha of course. The effect is quite realistic. Great for explosions or raging fires. |
| ||
my fire system uses this. An animated texture. It looks cool, but since i drew it myself, can't expect too much :) |
| ||
How cool is that hey! Welldone Guys! :) |
| ||
Ross do you have a demo u could show us? How are the frame rates on animated sprites? i have only implemented basic smoke particles for fear that the frame rates might get chewed up quickly. |
| ||
@Baudspeed: Good idea, thanks for the info. Just been doing some pixel art...maybe I'll try some explosion/smoke/fire sprite animations....at the moment I'm just doing RPG-style people, but I could try this. I'll post them when they're finished... |
| ||
@baudspeed, it's a single surface system using a texture with frames that i set. And it's fire :S But same idea, the fire animation increments. The frames change a bit. If i were better at drawing, i could do better :) http://www.rosscrooks.pwp.blueyonder.co.uk/Blitz/test.exe packed with molebox, so don't open it from the downloadbox thingy :) If you want, i can give you the demo with just the particles? No matter howmany particles there are, it doesn't really affect the pseed. What kills the above demo is the poly count nd large texture i think :) And the fill rate of course :) Zoom in and out with the mouse button. |
| ||
Simple smoke: The image: AppTitle "Smoke" ; Einar Wedoe, January 2002 Graphics3D 640,480,32,2 Global timer=CreateTimer(60) Global dx#,dy#,dz# Global number=50 Dim trail(number) Dim x#(number) Dim y#(number) Dim z#(number) AmbientLight 80,80,80 Global camera=CreateCamera() CameraViewport camera,0,0,640,480 PositionEntity camera,0,0,-150 AntiAlias False Global Smoke = LoadSprite("smoke.jpg") SpriteViewMode(Smoke , 1) PositionEntity(Smoke , 0 , -1000 , 0) EntityBlend(Smoke,3) EntityAlpha(Smoke,1) EntityColor(Smoke,150,150,150) For a#=1 To number trail(a)=CopyEntity(Smoke) x(a)=-1000 Next ;-------------------------------- Repeat Smoke UpdateWorld() RenderWorld() WaitTimer timer If KeyDown(28) Then SaveBuffer(FrontBuffer(),"smoke.bmp") ; Screenshot on Return Flip Until KeyDown (1) End ;-------------------------------- Function Smoke() dx=dx+5 If dx > 360 Then dx=dx-360 dy=dy+5 If dy > 360 Then dy=dy-360 dz=dz-2 If dz < 0 Then dz=dz+360 tmpx#=Sin(dx)*100 tmpy#=Cos(dy)*100 tmpz#=Cos(dz)*100+100 b#=number/2+5 For a#=1 To number-1 x(a)=x(a+1) y(a)=y(a+1) z(a)=z(a+1) PositionEntity (trail(a),x(a),y(a),z(a)) EntityAlpha(trail(a),a/number) b=b-.5 ScaleSprite(trail(a),b,b) Next x(number)=tmpx+Rnd(-2,2) y(number)=tmpy+Rnd(-2,2) z(number)=tmpz+Rnd(-2,2) End Function ;--------------------------------- Looks like this: |
| ||
Pretty kewl...nice coding |