2D Alpha with 3D Functions
BlitzPlus Forums/BlitzPlus Programming/2D Alpha with 3D Functions
| ||
Hello, I have a Fullscreen 1024x768 Background and want to let some 2D Clouds fly over with Alpha-Blending. Because of the big images (The Clouds-Image is fullscreen, too) the ReadPixelFast and WritePixelFast are too slow for Real-Time. To get to the point: Someone mentioned in another thread, that it would be possible to make 2D-Alpha-Blending with Blitz3Ds Alpha Functions. But how?? I tried but my 2D graphics does not change when i use Blitz3Ds functions to change light or make alpha blending. Do I have to use DrawSprite instead of DrawImage? Wouldn't it be slower with that? Or do I have to create a plane and put my 2D graphics as Texture on it? Plz Help! Greetings GrrBrr |
| ||
Look for Syntax's "Sprite Control" its on BlitzCoder showcase someplace. |
| ||
ok, i'll take a look, thanks |
| ||
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. |
| ||
thanks for the help it works now :)))) |