Creating Scanlines

BlitzPlus Forums/BlitzPlus Programming/Creating Scanlines

koekebakker(Posted 2005) [#1]
I'm affraid I allready know the answer, but is it possible to
create a scanline filter? (see picture below).
This is a 50% opaque filter done in Photoshop.
This filter is probably even harder to realize than an
odd/even scanline.

I'm trying to simulate an arcade screen/tv set feeling for my
new game Sokorat. This way it looks way better than a
sharp monitor in my opinion.

I found a topic on this subject before but maybe someone
did figuere it out by now.
Otherwise. Blitz team... plase make a plug-in/dll for this in
one of the next B+ versions. Is shouldn't be that hard I
guess.

Regards, Randy




CS_TBL(Posted 2005) [#2]
You mean something global you can apply to a whole screen buffer, or some pre-calcing to your tiles? The latter one shouldn't be that hard I think..


koekebakker(Posted 2005) [#3]
I prefer a global filter. In that way I am much more flexible.


GitTech(Posted 2005) [#4]
Can't you create a white image, with black lines and set the transparency color for that image to white? And then draw that image over the screen?


CS_TBL(Posted 2005) [#5]
In his example image the scanlines aren't full black tho.. :)


koekebakker(Posted 2005) [#6]
Indeed GitTech. If I'm not be able to make half-transparant
scanlines, I stick with that option. IMO also way better than
no scanlines at all.


aab(Posted 2005) [#7]
two really bad methods in Blitz:

writpixelfast the scanlines as half the (r g and b) of the read values underneath (BAD)

line a black line where the scanlines are every second frame (ALSO BAD)


Mr. Write Errors Man(Posted 2005) [#8]
Is speed an issue?

What about stretching the picture to twice the real size, then draw almost black scanlines to every second line, then stretch the picture back to original size. Could result in interesting effect, especially if you'd give scanlines some randomness.

Don't know if stretching in B+ is up to the task, though.


koekebakker(Posted 2005) [#9]
I thought about that Arctic fox. However. This game must be
flexible for graphic artists because I want to add an import
tileset function into the game. The tiles are 17*21px original
size. The gfx procedure must be simple so everyone can
make tilesets without stretching and adding a scanline filter
to it.

So what I have done is: I made a bitmap with black lines
and purple lines (purple=transparent)
Unfortunally it is not half-transparent.
The tiles are stretched within the game to double sized
tiles. On top of that there is the scanline image. Works
pretty fast though. but I need it to be tested on a
moderate system.So any volenteers in the near future?

You can get a free full version ;)


Mr. Write Errors Man(Posted 2005) [#10]
Actually I ment it the very same way you ended up doing it. :)

Though I had in mind that you would have stretched the image back to normal at the end, thus making the scanlines a bit blurry and more random.


koekebakker(Posted 2005) [#11]
Your right Arctic Fox :) But my main issue was that graphic designing should be easy for third party graphic artists without
adding filters themself.


Lattyware(Posted 2005) [#12]
'but I need it to be tested on a
moderate system.So any volenteers in the near future? '

I'll do it. E-mail me.


Ross C(Posted 2005) [#13]
Might not be an option, but couldn't you use a quad over the screen in 3d, to get the alphaness?


_PJ_(Posted 2005) [#14]
Yeah, I thought that, Ross. It'd probably need to be the right size, and disable antialiasing on the sprite to avoid it blurring out between the lines.


Mr. Write Errors Man(Posted 2005) [#15]
Ross C,

How do you achieve "a quad over the screen in 3d" in BlitzPlus?


Koekebakker,

Are you sure you couldn't do scanlines with the alphablending codes of the Code archives? I did some experimenting with them and it was faster than I thought it would be. I think alphablended scanlines are doable.


_PJ_(Posted 2005) [#16]
LOL - y'know for some reason I thought this was in "B3D programming".... oops!



How do you achieve "a quad over the screen in 3d" in BlitzPlus?



That IS a tough one, heh!


CS_TBL(Posted 2005) [#17]
I can only think of 2 solutions..

- create the scanlines in the actual tiles
- grab the output screen, manually color-dim each odd line

that last one does cook a bit eh ^____^


CS_TBL(Posted 2005) [#18]
and option 3

Create 2 sets of the same tiles! But one set has 50% darker tiles!

Now, build your map with the light ones in imagebuffer 1, build the map with the dark ones in imagebuffer 2, add purple scanlines over the dark one, and DrawImage the dark buffer on the light buffer using maskcolor for purple ..

didn't check or test it tho ..


CS_TBL(Posted 2005) [#19]
woiks!

Here you are :)



koekebakker(Posted 2005) [#20]
Wow CS_TBL, this rocks! thanks a lot.
Reasonably fast and easy to work with.
I was affraid that processes like this will slow down but I'm happely suprised it did'nt.

P.S. Lattyware, I'll mail you in one of the next days.
Back to coding again.


CS_TBL(Posted 2005) [#21]
Once you have a 'running' game with this 'filter', can you post a link then? I'd prefer to see this method running with an actual game to ensure the performance holds :)

(tho it did run with the same performance in debugmode here :)


koekebakker(Posted 2005) [#22]
No problem :)


koekebakker(Posted 2005) [#23]
At second thought I'm not fully satisfied with the speed
though. So I pre filter the tiles with a small routine.

since the game act like it is a low res game the smallest step
in graphic movement is 2 pixels means the scanlines align
every time without any problems.

Problem solved!