Circular Fade

Blitz3D Forums/Blitz3D Programming/Circular Fade

Kryzon(Posted 2013) [#1]
Hi y'all.
Just trying some screen transition effects. This is the first one, a "circular" type fade (I think this is used in movies when the camera operator closes the camera's iris diafragm).
This code is adaptive: it works for all standard resolutions and ratios of 4:3 or 16:9. However, for some crazy resolutions it will not work (say, 100x500 windowed).

Anyway, there's no external media. If you make a smooth texture in Photoshop or whatever with alpha transparency etc. it'll look much better, as it won't have the pixelation from masking - I just wanted to make everything in code so it'd be easier to run.
If you do make a custom texture, it would have to be square and the circle area would have to be inscribed to it (i.e. touching the edges of the texture).

Screen:


Code (just copy & paste):



RemiD(Posted 2013) [#2]
Nice.

I think i have already seen a similar effect in the looney toons cartoons.


Axel Wheeler(Posted 2013) [#3]
Cool effect. With 1024 as the square size there are no visible jaggies to speak of, and still pretty much instantaneous.

Doing it in code as you have done is definitely preferable. Why carry freight you don't need?

You could probably use a cylinder rather than a texture. Flip the cylinder and be looking through it. But no need, this way works fine!


Kryzon(Posted 2013) [#4]
Thanks for testing.
When I use this in a game I'll definitely have an alpha transparent texture for the iris.
Due to filtering, something as low as 128 can look just fine.

For instance, you can use this texture...


...and change line #88 to load that, with flags (1+2).
You can also change line #14, replacing the "+ 0.1" at the end of the HALF_SCREEN_DIAGONAL calculation by "+ 1" so this texture isn't visible when fully open.
The smooth border makes a lot of difference.


Axel Wheeler(Posted 2013) [#5]
Yeah, the blur should make the jaggies disappear. You could still make the texture procedurally with writepixel commands. (Me loves the procedural stuff).