realistic explosions

Blitz3D Forums/Blitz3D Programming/realistic explosions

Ross C(Posted 2003) [#1]
hey, i'm using 3d spheres textured with a flame like texture for my explosions in my 2d shootem up. problem is, i can get them to look realistic. they look ok but not what i'm looking for

here's my rough code

Graphics3D 800,600,32

SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,0,-500

light=CreateLight()

explode=CreateSphere(16)
EntityAlpha explode,0.1
PositionEntity explode,-60,0,0
Dim texture(1)
texture(0)=LoadTexture("fire.png",2)
texture(1)=LoadTexture("fire1.png",2)


While Not KeyHit(1)




If KeyDown(2) Then Gosub createexplosion




Gosub updateexplosion

UpdateWorld
RenderWorld
Text 0,0," tris="+TrisRendered()
Flip
Wend
End

.updateexplosion
For e.explosion=Each explosion
	e\scale=e\scale+4
	ScaleEntity e\entity,e\scale,e\scale,e\scale
	TurnEntity e\entity,3,3,3
	If e\scale=>250 Then FreeEntity e\entity:Delete e.explosion
Next
Return

.createexplosion
e.explosion=New explosion
e\entity=CopyEntity(explode)
EntityTexture e\entity,texture(Int(Rnd(0,1)))
PositionEntity e\entity,0,0,0
TurnEntity e\entity,Rnd(0,359),Rnd(0,359),Rnd(0,359)
e\scale=0.1
ScaleEntity e\entity,e\scale,e\scale,e\scale
Return

.setup
Type explosion
	Field x,y
	Field entity
	Field scale#
End Type
Return


press 1 to generate explosions. you'll need to have 2 textures named fire and fire1 both in png format for it to work. anyone got any ideas??


jhocking(Posted 2003) [#2]
I usually use pictures of an explosion on a flat/sprite. If that looks too flat for your needs you may want to use crossed flats (like how trees are often done for games) or use a particle system to create the explosion.


Rob Farley(Posted 2003) [#3]
I use a particle system for the explosions on my Lander game. Each explosions has about 10 particles for smoke, fire, explosion, shrapnel etc, all of this is used to make it look more full bodied.




-=Darkheart=-(Posted 2003) [#4]
Oh Rob you do do some great things with particles.

Darkheart


Rob(Posted 2003) [#5]
Look for my free particle source code examples on code archives. LINK It's arguably the simplest to use.


Red Ocktober(Posted 2003) [#6]
I agree Doc... those look real nice.

--Mike


-=Darkheart=-(Posted 2003) [#7]
Rob's engine trails and thrusters look really cool too, Lander has some lovely stuff like that.

Darkheart


Ross C(Posted 2003) [#8]
thanks alot guys. Rob i'll give your particle system a look. Looks sweet :D