Bloomfilter out of alignment

Blitz3D Forums/Blitz3D Programming/Bloomfilter out of alignment

Leto(Posted 2007) [#1]
Hi, I found Bouncer's Bloomfilter code and had a quick try of it but the alignment seems to be really out of whack. Anyone more familiar with this could point me in the right direction to fix please?




Danny(Posted 2007) [#2]
Reading from Bouncer's code, I'm guessing you either changed the size of the blur texture ("If you adjust the tex size you have to mess with the position values inside blur texture function to get the blur positioned right").
OR you're using a different cameraZoom other than 1.0 on your default camera?!

It doesn't look so from your screenshot but I can imagine if you alter the cameraViewport settings to anything but default you'll get misalignment problems as well?!

d.


Leto(Posted 2007) [#3]
Yes you're right it seems related to my camera settings (I just assumed Bloomfilter would do some special to align things!) and the angle and zoom are causing problems. Thanks, Danny.


Warren(Posted 2007) [#4]
I just plugged this code into my own project and MY bloom filter window appears as a little postage stamp in the middle of the window. Is it understood that you'll have to mess with the sprite positioning/scaling on a project by project basis or should it "just work"?


Leto(Posted 2007) [#5]
Hi Warren. Yes I've just investigated more and the "GLsprite" is fixed at a certain location (suitable for CamZoom 1).

I am fiddling with it now but basically looks like we need to update GLsprite every time the main cam zoom changes.

In my case I also had to call "InitGlow(cam)" right after my CreateCamera and before some position/angling.


Danny(Posted 2007) [#6]
I haven't studied the code, but guessing by both your comments I'd say it doesn't take the cameraZoom into account...

The effect works amazingly well and fast, so well worth the tinkering to get it right for your settings...

d.


Danny(Posted 2007) [#7]
Here's a quick fix for it to take the camera zoom into account; in Bloomfilter.bb add this function:

Function SetGlowZoom(zoom#)
	if GLSprite <> 0 then ScaleSprite GLsprite, 100.0/zoom#, 100.0/zoom#
End Function
And use it to set/update the glow sprite's size in relation to the current camera zoom. Note: The SetGlowZoom() functions MUST be called AFTER GlowInit().

have fun,

D.


Leto(Posted 2007) [#8]
The bloom code just doesn't scale/position the "GLsprite" (sprite showing the bloom texture overlay) when your main camera changes zoom, yeah.

In InitGlow() there are these two commands
> PositionEntity GLsprite,0,0,100
> ScaleSprite GLsprite,100,100
which seem to align it perfect for default cam zoom.

I'm unsure how to calculate an appropriate scale/position when the cam changes zoom...


Danny(Posted 2007) [#9]
Hi Leto, I think our posts just crossed ;)
See above for solution..

d.


Leto(Posted 2007) [#10]
Danny! You champ haha, too easy. I was on the right track just couldn't work it out myself. Cheers.


Bouncer(Posted 2007) [#11]
The bloomfilter certainly needs some fiddling depending on how you use camera... but glad you got it working.


Warren(Posted 2007) [#12]
Yes, this was the key for me:

"In my case I also had to call "InitGlow(cam)" right after my CreateCamera and before some position/angling."

Thanks! If you do anything to the camera before calling InitGlow, you get alignment problems.