2D Alpha with 3D Functions

BlitzPlus Forums/BlitzPlus Programming/2D Alpha with 3D Functions

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Hey, thanks coffee. Did that MaskImage3D function help?

GrBrr,
If you want to try out SpriteControl for your alpha'd clouds do something like this:

; the include file
Include "Sprite Control.bb"

Const sw=640,sh=480 ; display dimensions

; set up the 3d display
Graphics3D sw,sh
SetBuffer BackBuffer()

; create a main camera
cam=CreateCamera()
CameraClsMode cam,False,True ; < do not clear color buffer

; create a sprite pivot and attach to camera
spritecam=CreateSpritePivot(cam)

; load images/sprites
bkg=LoadImage("background.jpg")
cloud=LoadImage3D("cloud.jpg")
EntityAlpha cloud,0.3 ; fade out the cloud

x#=sw*0.9 : y=sh*0.5

Repeat
	x=x-0.7
	TileBlock bkg
	DrawImage3D cloud,x,y
	RenderWorld
	Flip
Until KeyHit(1)
End


If you are using a full-screen sized image for the clouds (i.e 1024x1024) and experience slowdown (due to fillrate problems) you have a few options:

* Change the size of your clouds image to say, 512x512 and use

cloud=LoadImage3D("cloud.jpg")
ResizeImage3D cloud,1024,1024

* Cut your image up and create individual clouds. Then ..

Dim cloud(10)
For c=1 to 10
cloud(c)=LoadImage3D("cloud"+Str$(c)+".jpg")
Next

This second method at least allows you to move your clouds at different speeds.

Oh, and if you want nice and sharp clouds use ClearTextureFilters before loading the sprites.