Smoke only showing white?

Blitz3D Forums/Blitz3D Programming/Smoke only showing white?

I'm not at home atm and was trying to knock up some smoke. I know this isn't the best method but I'm really just testing this out. But the problem is I can't get the smoke to be dark gray. It's only showing up pure white. I've done smoke before and I'm not sure what's up with this.

You'll have to forgive me if it's simple. It's been awhile since I've done any programming. 8(

BTW, the "smoke.bmp" I am using is 64x64.

;Smoke

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

camera = CreateCamera()
MoveEntity camera,0,0,-10
light = CreateLight()
CameraClsColor camera, 150,190,150


Global FX=LoadSprite("smoke.bmp")
EntityBlend fx,3
EntityFX fx,1
HideEntity fx

Global p.part
Type part
	Field ent
	Field alpha#,fade#,fade_timer#
	Field xvel#,yvel#,zvel#
	Field xpos#,ypos#,zpos#,rot#,s#
End Type


While Not KeyHit(1)

a=a+1
If a>10
	a=0
	Create_Smoke(0,-7,0)
	Create_Smoke(.6,-7,0)
	Create_Smoke(1.25,-7,0)
EndIf

Update_Smoke()

UpdateWorld
RenderWorld
Flip
Wend


Function Create_Smoke(x#,y#,z#)
p.part = New part
p\ent = CopyEntity(FX)
;EntityColor p\ent,50,50,20
p\xvel =Rnd(-.0075,.0075)
p\s=.5
p\xpos=x
p\ypos=y
p\zpos=z
p\alpha = 1
p\fade = .0025
p\yvel = .03
p\rot = Rnd(-.5,.5)
SpriteViewMode p\ent,2
End Function



Function Update_Smoke()
For p.part = Each part
	PositionEntity p\ent,p\xpos,p\ypos,p\zpos
	p\s = p\s + .005
	ScaleSprite p\ent,p\s,p\s
	p\xpos = p\xpos + p\xvel
	p\ypos = p\ypos + p\yvel				
	p\alpha = p\alpha - p\fade
	EntityAlpha p\ent,p\alpha
	TurnEntity p\ent,0,0,p\rot
	
	If p\alpha =< 0
		FreeEntity p\ent
		Delete p
	EndIf
Next
End Function


I think you will need to use a blend value of 1, (alpha):

EntityBlend fx,1

look here:

my Demo shows Realtimesmoke

http://www.blitzbasic.com/Community/posts.php?topic=47964#538761

basicly you shouldn't use a bmp for smoke, but a tga. so the alpha channel should actually contain the "body" of the smoke, where the RGB channel may contain no drawings, but only contain the color you want the smoke to be painted. So this way you can set the smoke color to whatever you like. This way you would also make simplyfied shadows.

An other method that may utilize a BMP would be to use writepixelfast to edit the RGB channels and use the initial pixel brightness for the alpha channel:

rgb=readpixelfast(x,y) and $FFFFFF
a=((rgb shr 16)+((rgb and $FFFF) shr 8) + (rgb and $FF))/3
grey=$777777
argb=grey or (a shl 24)
writepixelfast x,y,argb

of course, this requires to use the alpha flag.
argb=rgb

Ok I found it. I had to load the texture in a different manner.

smoketex=LoadTexture("smoke.bmp",2)
Global FX = CreateSprite()
EntityTexture FX,smoketex
HideEntity fx


Looks stunning (according to the wife). :)

Depends very much on the quality of the texture.

I just used an old smoke texture I found, and it looked very cartoony (-not your code's fault).

Would you post the texture you're using?