hello all, i love what you are doing here...
now ive been working on a sort of bloom for my game but am having some difficulty..
Firstly i should say that i have been using Evolveds bloom shader rewritten by RUCCUS from here http://forum.thegamecreators.com/?m=forum_view&t=102187&b=1
i took some code out and tryed to make it work as best as it could in my program, i ended up with this
Rem ***** Included Source File *****
Shaders_Init:
`variables
path$ = "FX\HDR.fx"
cam1 = 1
cam2 = 2
cam3 = 3
imgsize = 256
img1 = 47
img2 = 48
img3 = 49
obj1 = 100
obj2 = 101
obj3 = 103
width# = 0.01
brightness# = 3.2
technique = 7
FOV = 80
`Setup HDR
HDR_setup(path$,cam1,cam2,cam3,imgsize,img1,img2,img3,obj1,obj2,obj3,width#,brightness#,technique,FOV)
`Set camera
COLOR BACKDROP RGB(219,220,253):SET CAMERA FOV FOV:SET CAMERA RANGE 1,15000
RETURN
Shaders_Update:
`Update HDR
HDR_updateStats()
HDR_update(imgsize,cam1,obj3,0)
RETURN
FUNCTION HDR_update(imgsize,cam1,obj3,setcam)
POSITION CAMERA cam1,CAMERA POSITION X(setcam),CAMERA POSITION Y(setcam),CAMERA POSITION Z(setcam)
ROTATE CAMERA cam1,CAMERA ANGLE X(setcam),CAMERA ANGLE Y(setcam),CAMERA ANGLE Z(setcam)
POSITION OBJECT obj3,CAMERA POSITION X(setcam),CAMERA POSITION Y(setcam),CAMERA POSITION Z(setcam)
ROTATE OBJECT obj3,CAMERA ANGLE X(setcam),CAMERA ANGLE Y(setcam),CAMERA ANGLE Z(setcam)
IF imgsize = 64
MOVE OBJECT obj3,9875
MOVE OBJECT LEFT obj3,225
MOVE OBJECT UP obj3,200
ENDIF
IF imgsize = 128
MOVE OBJECT obj3,9925
MOVE OBJECT LEFT obj3,175
MOVE OBJECT UP obj3,150
ENDIF
IF imgsize = 256
MOVE OBJECT obj3,9975
MOVE OBJECT LEFT obj3,100
MOVE OBJECT UP obj3,75
ENDIF
ENDFUNCTION
FUNCTION HDR_updateStats()
`technique should equal 3,5 or 7
SET EFFECT TECHNIQUE HDR.obj1,"weights"+STR$(HDR.technique)+"_cam1"
SET EFFECT TECHNIQUE HDR.obj2,"weights"+STR$(HDR.technique)+"_cam2"
SET EFFECT TECHNIQUE HDR.obj3,"weights"+STR$(HDR.technique)+"_cam3"
`Set effect variables
SET EFFECT CONSTANT FLOAT HDR.obj1,"blurWidth",HDR.width#
SET EFFECT CONSTANT FLOAT HDR.obj2,"blurWidth",HDR.width#
SET EFFECT CONSTANT FLOAT HDR.obj3,"blurWidth",HDR.width#*1.5
SET EFFECT CONSTANT FLOAT HDR.obj1,"Brightness",HDR.brightness#
SET EFFECT CONSTANT FLOAT HDR.obj2,"Brightness",HDR.brightness#
SET EFFECT CONSTANT FLOAT HDR.obj3,"Brightness",HDR.brightness#
ENDFUNCTION
FUNCTION HDR_setup(effectPath$,cam1,cam2,cam3,imgsize,img1,img2,img3,obj1,obj2,obj3,HDRwidth#,HDRbrightness#,technique,FOV)
`Store global data in type
GLOBAL HDR AS HDRt
HDR.width# = HDRwidth#
HDR.brightness# = HDRbrightness#
HDR.technique = technique
HDR.obj1 = obj1
HDR.obj2 = obj2
HDR.obj3 = obj3
`Setup 3 cameras
MAKE CAMERA cam1
SET CAMERA FOV cam1,FOV
SET CAMERA RANGE cam1,1,9000
COLOR BACKDROP cam1,0
SET CAMERA TO IMAGE cam1,img1,imgsize,imgsize
MAKE CAMERA cam2
SET CAMERA FOV cam2,FOV
SET CAMERA RANGE cam2,0.1,100
COLOR BACKDROP cam2,0
POSITION CAMERA cam2,0,-900000,0
XROTATE CAMERA cam2,90
SET CAMERA TO IMAGE cam2,img2,imgsize,imgsize
MAKE CAMERA cam3
SET CAMERA FOV cam3,FOV
SET CAMERA RANGE cam3,0.1,100
COLOR BACKDROP cam3,0
POSITION CAMERA cam3,2000,-900000,0
XROTATE CAMERA cam3,90
SET CAMERA TO IMAGE cam3,img3,imgsize,imgsize
`Setup boxes to be textured
MAKE OBJECT BOX obj1,4.38,3.28,0.1
XROTATE OBJECT obj1,90
SET OBJECT AMBIENT obj1,0
SET OBJECT TRANSPARENCY obj1,1
POSITION OBJECT obj1,0,-900002,0
MAKE OBJECT BOX obj2,4.38,3.28,0.1
XROTATE OBJECT obj2,90
SET OBJECT AMBIENT obj2,0
SET OBJECT TRANSPARENCY obj2,1
POSITION OBJECT obj2,2000,-900002,0
MAKE OBJECT BOX obj3,22450,16950,0.1
GHOST OBJECT ON obj3
SET OBJECT LIGHT obj3,0
SET OBJECT TRANSPARENCY obj3,1
DISABLE OBJECT ZDEPTH obj3
`Load effects into memory
LOAD EFFECT effectPath$,obj1,0
LOAD EFFECT effectPath$,obj2,0
LOAD EFFECT effectPath$,obj3,0
`Apply effect settings to effect data
HDR_updateStats()
`Apply effects to objects
SET OBJECT EFFECT obj1,obj1
SET OBJECT EFFECT obj2,obj2
SET OBJECT EFFECT obj3,obj3
`Texture objects with resulting images
TEXTURE OBJECT obj1,0,img1
TEXTURE OBJECT obj2,0,img2
TEXTURE OBJECT obj3,0,img3
ENDFUNCTION
TYPE HDRt
width#,brightness#
technique
obj1,obj2,obj3
ENDTYPE
now the bloom works ok for the mosty part, but there are 2 problems
1. the color of the sphere doesnt seem to affect the bloom (using a loaded texture)
2. the bg which was black with white dots is now all white and thats a bit devastating
attached is a shot of the shader at work