CPCWiki forum

General Category => Games => Topic started by: alex76gr on 12:48, 31 May 14

Title: Everything looks better in scanlines!
Post by: alex76gr on 12:48, 31 May 14
Hi guys!

I created a collection of CPC game loading screens which i have enhanced by applying a scanlines effect.
The technique belongs to Daniel who owns a site for Amiga graphics and who yesterday uploaded the instructions of how to replicate the effect in Photoshop.
Here you can see his instructions
Amiga Graphics Archive – Amiga Graphics Archive (http://amiga.lychesis.net/knowledge/Display.html)

I really loved the way the old CRT monitors were displaying graphics and i always thought that scanlines were a beautiful side-effect of them.
Here you can see some samples of what you will find in the collection
(http://s26.postimg.org/b6v294rkl/asphalt_alt.png) (http://postimg.org/image/b6v294rkl/)(http://s26.postimg.org/twn1pvkb9/captain_america_doom_tube.png) (http://postimg.org/image/twn1pvkb9/)(http://s26.postimg.org/ywkhxtpxx/dragon_ninja.png) (http://postimg.org/image/ywkhxtpxx/)

There is a total of 75 pictures in 1536x1080 resolution and you can download them all as a zip file from here
Download CPC_scanlines.zip from Sendspace.com - send big files the easy way (http://www.sendspace.com/file/cz4glc)

In order to see clearly the scanlines effect you must zoom at 100%.
You can use these pictures as you want and i hope you like them.
Cheers!
Title: Re: Everything looks better in scanlines!
Post by: SyX on 14:40, 31 May 14
They look very similar a how my CPC looks in my old PAL CRT (i miss you xDDD)... i would love having this filter in a CPC emulator :)

PD: I can not prove too, but i'm sure i got my myopia from that damn green monitor xDDD
Title: Re: Everything looks better in scanlines!
Post by: alex76gr on 15:01, 31 May 14
Yes, that would be bliss!
Quotei would love having this filter in a CPC emulator
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 15:08, 31 May 14
.
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 15:30, 31 May 14
.
Title: Re: Everything looks better in scanlines!
Post by: twox on 15:52, 31 May 14
Quote from: SyX on 14:40, 31 May 14
They look very similar a how my CPC looks in my old PAL CRT (i miss you xDDD)... i would love having this filter in a CPC emulator :)

PD: I can not prove too, but i'm sure i got my myopia from that damn green monitor xDDD
You can have a scanlines effect in caprice32 emulator.
Title: Re: Everything looks better in scanlines!
Post by: tastefulmrship on 16:53, 31 May 14
Dragonninja in WinAPE2A18 with PAL Emulation enabled...

Title: Re: Everything looks better in scanlines!
Post by: arnoldemu on 17:19, 31 May 14
Quote from: Jonah (Tasteful Mr) Ship on 16:53, 31 May 14
Dragonninja in WinAPE2A18 with PAL Emulation enabled...
This got me thinking. I would expect to see pal effects with a modulator because the r g b from the CPC would be turned into a pal signal and the pal television would decode it. So you would potentially get scanlines and colour blending from pal. But the amstrad monitor takes r g b directly so we should not see colour artifacts or bleeding. We do see patterns in mode 2 because the horizontal resolution of the monitor is not quite high enough. So these filters are only accurate if used with a modulator and rf signal.
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 17:25, 31 May 14
Great samples, and a great tutorial. I think the end results on his tutorial are a bit exaggerated (less blur needed, probably), but lovely.

WinAPE's PAL emulation is really good, too!
Title: Re: Everything looks better in scanlines!
Post by: Devilmarkus on 17:49, 31 May 14
That's why I implemented CRT emulation long time ago in JavaCPC ;)

RGB-Split + Pal emulation + Bilinear filter:


Title: Re: Everything looks better in scanlines!
Post by: Devilmarkus on 17:53, 31 May 14
Another example without PAL emulation:


Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 18:02, 31 May 14
.
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 18:14, 31 May 14
.
Title: Re: Everything looks better in scanlines!
Post by: Token on 18:14, 31 May 14
Nice.  :)
I also like that framemeister rendering. Lovely scanlines colors.


(http://retrogaming.hazard-city.de/framemeister_16bit.jpg)
Title: Re: Everything looks better in scanlines!
Post by: SyX on 18:41, 31 May 14
Quote from: twox on 15:52, 31 May 14
You can have a scanlines effect in caprice32 emulator.
As phi2x said scanlines is only a part of the equation for perfect CRT emulation... and not the most important.

For example, in the Pac-Man loading screen the red and yellow pattern in the gloves gives a solid orange in the CRT and the same happen with the ghosts; because mode 1 (or 2) dithering with colours with similar luminance get mixed perfectly in a PAL CRT.
Title: Re: Everything looks better in scanlines!
Post by: ralferoo on 19:55, 31 May 14
Quote from: SyX on 18:41, 31 May 14
For example, in the Pac-Man loading screen the red and yellow pattern in the gloves gives a solid orange in the CRT and the same happen with the ghosts; because mode 1 (or 2) dithering with colours with similar luminance get mixed perfectly in a PAL CRT.
This is because the dot pitch is 16MHz or 8MHz for mode 2 and mode 1 respectively and the PAL colour clock is 4.43MHz, so the colour can only change every 1.8 pixels in mode 1.

HOWEVER. As arnorldemu said, I'll repeat because it got overlooked:
Quote from: arnoldemu on 17:19, 31 May 14
This got me thinking. I would expect to see pal effects with a modulator because the r g b from the CPC would be turned into a pal signal and the pal television would decode it. So you would potentially get scanlines and colour blending from pal. But the amstrad monitor takes r g b directly so we should not see colour artifacts or bleeding. We do see patterns in mode 2 because the horizontal resolution of the monitor is not quite high enough. So these filters are only accurate if used with a modulator and rf signal.

There's not much to add to that. The monitor sees the RGB signal changing at 8MHz or 16MHz exactly at the rate the signal is changing - the analogue electron gun reacts instantly to the change in RGB signal, the only slight blurring in mode 2 is because the grille isn't fine enough.

For the real CPC effect, you'd be using the Amstrad monitor and so not see the horizonal blurring effect in mode 1 or 0. :)
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 07:59, 01 June 14
.
Title: Re: Everything looks better in scanlines!
Post by: alex76gr on 21:21, 01 June 14
Yes, i use a bit different way to recreate the effect but it's all based on Amiga Graphics Archive.
Here is what i am doing using Photoshop.

1] First create a 1x2 pixels pattern to emulate the scanlines.
Make sure the background color is transparent and the value of the black is 255.
(http://s26.postimg.org/vwb039xn9/scanline_pattern.png) (http://postimage.org/)
Once you have made the pattern go to "Edit" menu, select "Define Pattern" and give it a name like "scanline".

2] Create a 6x4 pixels pattern to emulate the shadow mask.
(http://s26.postimg.org/tlhjcuc9h/shadow_mask1.png) (http://postimage.org/)
Based on the RGB model the color values for the first line are: 125,0,0 - 0,125,0 - 0,0,125 - 255,0,0 - 0,255,0 - 0,0,255
The second line values are: 255,0,0 - 0,255,0 - 0,0,255 - 125,0,0 - 0,125,0 - 0,0,125
The third line is the same with second and the fourth line is the same with the first.
When it is ready go to "Edit" menu and select "Define pattern". Give it a name you like.

3] Open Winape and grab a screenshot of some graphics.
Make sure that you have unchecked the "Half Size Display" option in the Display settings.
Also make sure you have checked the "Render both pixel lines" option.
This should produce a 768x540 PNG image.

4] Open the image in Photoshop.
Go to "Image -> Mode" menu and select "RGB Color".

5] Go to "Layer -> New" menu and select "Layer from background".
Go to "Layer -> Layer Style" and select "Blending options".
Click on "Pattern Overlay" and select the scanline pattern you created.
In "Blend Mode" select "Multiply" and leave the opacity at 100%.

6] Go to Layer menu and select "Flatten Image".
Go to "Image -> Image Size". Resize the image at exactly the double of its original size.
For example if the original size is 768x540, change it to 1536x1080.
Make sure "Scale styles" and "Constrain Proportions" is checked.
In "Resample Image" select "Nearest Neighbor".

7] Go to "Filter -> Blur -> Gaussian Blur", in "Radius" value enter 1 and press OK.

8] It's time to apply the shadow mask effect.
Go to "Layer" menu and create a new "Layer from Background".
Go to "Layer -> Layer Style -> Blending Options", click on "Pattern Overlay" and select the shadow mask pattern you have previously created.
In "Blend mode" choose "Color Dodge" and set the opacity at 25%. Press OK.

9] Go to "Layer" menu and select "Flatten Image".

10] At this time our image should look a bit dark after all these effects we applied.
Go to "Image -> Adjustments -> Levels".
Set the "Input Levels" values at 10 - 1.0 - 137 and press OK.

That's it!
Title: Re: Everything looks better in scanlines!
Post by: Executioner on 00:31, 02 June 14
It's not possible to do accurate PAL emulation, certainly not with the resultions which are currently standard or the way LCD monitors display pixels. WinAPE PAL emulation is just a quick and dirty method to produce a similar effect to VICE without taking stacks of processor time.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 19:53, 28 January 16
Thread revival.

I'm about to record a lot of videos from my Amstrad CPC464, and would really like to apply a scanline effect to them.

The XRGB-Mini Framemeister can add such an effect for me. And it does look cool, but I don't feel it looks very CPC'ish.

Therefor I'm instead thinking about the option of applying an image as an overlay, either in the video-editor for post-processing, or else as an option the viewer can turn on/off as he pleases.

And that's why I'm bringing back this thread.

Can someone make me a 1280x720 pixel overlay in PNG?  :)
This 1280x720 video is an Amstrad CPC image that has first been cut to 240p and then multiplied by 3. The result is that each line is drawn 3 times.

The Framemeister emulates scanlines by making every 3rd line darker. But even though I can apply blur and also set how much darker the 3rd line should be, I just don't feel it looks CPC'ish. It does look cool, but just not very CPC-like.

I've read the tutorial and sadly see that it asks me to multiply the image by a factor of 4.
I could do this, by cutting the image to 270p and then up-scaling to 1080p - but then I can't get 50 fps, because my recorder doesn't support 1080p50fps. And 50 fps really takes priority.

Therefor I'm "stuck" with 720p.

So what do the experts say? Is it possible to create a PNG overlay image that gives my 720p videos a semi-realistic CPC-look?
Or is it best to settle for the Framemeister approach because it's only 720p?
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 20:16, 28 January 16
It would be nice to have a couple of screenshots, with and without scanlines, to see the effect and suggest a solution.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:18, 28 January 16
I found this one:
http://i.imgur.com/VXcVUTX.png (http://i.imgur.com/VXcVUTX.png)

Gonna try with that one first then.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 09:31, 29 January 16
Quote from: mr_lou on 20:18, 28 January 16
I found this one:
http://i.imgur.com/VXcVUTX.png (http://i.imgur.com/VXcVUTX.png)

Gonna try with that one first then.

Alright, tried it. Looks great, really lifts up the screenshots, but I still feel something is missing. I just can't figure out what it is...
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 09:37, 29 January 16
If you post some of your tests maybe we can help you figure out what's the touch they need  :D
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 09:55, 29 January 16
Yes, I'll do that. It's just a matter of merging the image with whatever overlay it is.

I can't take a screenshot of what I'm seeing, because it's running of a TV from blu-ray. I'm not actually using a blu-ray emulator on my PC.
Adding the overlay is trivial though.

In my project I can even offer the reader to select between several scanline-overlays.

I'll have to dig up my CPC monitor from storage and take a closer look in regards of how the RGBs are placed. Some overlays place them directly in line with each other, while over overlays (like the description linked to in the first post of this thread) puts them a bit off in relation to each other.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 10:28, 29 January 16
Alright.
Took Radzone screenshot from CPC.power.com
http://cpc-power.com/extra_lire_fichier.php?extra=cpcold&fiche=1747&slot=2&part=A&type=.png (http://cpc-power.com/extra_lire_fichier.php?extra=cpcold&fiche=1747&slot=2&part=A&type=.png)

Cut to 240p, scaled up to 720p, added scanlines overlay with and without blur.

What do you think?
Title: Re: Everything looks better in scanlines!
Post by: dodogildo on 10:33, 29 January 16
Scanlines added version is great. But keep it without the blurs or with veeery few blur..
Title: Re: Everything looks better in scanlines!
Post by: TotO on 10:44, 29 January 16
The problem is that filter don't match with the CTM matrix.
It is just a mind view about "how it should be" if the display was perfect. (the blur effect is wrong too)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 10:52, 29 January 16
The blur effect is way too much, not something CPC users are accustomed to. The clean version is not really CPCish either, as the vertical lines are far too much pronounced...
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 11:39, 29 January 16
Quote from: TotO on 10:44, 29 January 16
The problem is that filter don't match with the CTM matrix.
It is just a mind view about "how it should be" if the display was perfect. (the blur effect is wrong too)

Quote from: Gryzor on 10:52, 29 January 16
The blur effect is way too much, not something CPC users are accustomed to. The clean version is not really CPCish either, as the vertical lines are far too much pronounced...

Yea, none of those are CPC'ish. But neither is the Framemeister version.

Surely it must be possible for a graphics artist here to create an overlay that is closer though?

I'm thinking the approach above is the right one. The overlay "just" needs to be adjusted. I.e. change the transparency of the various bits.
There must be some combination that results in a much more CPC'ish look?
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 12:34, 29 January 16
I remember there was actually a Photoshop plugin to create scanlines, I had used it at some point and it was really versatile!
Title: Re: Everything looks better in scanlines!
Post by: ukmarkh on 13:40, 29 January 16
Looking at a CPC game through an Amstrad monitor beats everything imho. 
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 13:46, 29 January 16
Quote from: ukmarkh on 13:40, 29 January 16
Looking at a CPC game through an Amstrad monitor beats everything imho.

I agree, but this is for a blu-ray project, and an Amstrad monitor can't display a blu-ray disc.  ;)
Title: Re: Everything looks better in scanlines!
Post by: ukmarkh on 13:48, 29 January 16
Won't Hi-Def just show up all the things we don't wanna see, regardless of the filter?
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 13:51, 29 January 16
True, but even low-res material on a big, high-res screen will look similarly shite.
Title: Re: Everything looks better in scanlines!
Post by: ukmarkh on 13:52, 29 January 16
So why bother?
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 14:06, 29 January 16
Quote from: ukmarkh on 13:48, 29 January 16
Won't Hi-Def just show up all the things we don't wanna see, regardless of the filter?

I think it's possible to create an acceptable image on a 720p screen, using a mix of the right blur and the right overlay image.

Displaying a CPC image on a modern 720p screen will look like described in the tutorial linked to in the first post of this thread.

Adding a bit of blur and overlay will at least give a picture that matches an Amstrad CPC monitor better. Not perfect of course, but at least closer to how we remember it.

It's "just" a matter of creating this overlay.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 14:22, 29 January 16
Quote from: mr_lou on 10:28, 29 January 16
Alright.
Took Radzone screenshot from CPC.power.com
http://cpc-power.com/extra_lire_fichier.php?extra=cpcold&fiche=1747&slot=2&part=A&type=.png (http://cpc-power.com/extra_lire_fichier.php?extra=cpcold&fiche=1747&slot=2&part=A&type=.png)

Cut to 240p, scaled up to 720p, added scanlines overlay with and without blur.

What do you think?

I actually like the first image a lot. The other is a bit blurry for my taste :)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 16:15, 29 January 16
How's this one?
My own attempt at creating an overlay.
I think it resembles the Amstrad monitor a bit better.
What do you think?

Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 17:15, 29 January 16
Liking it a lot!  :) Could you try it with some other screens?
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 17:40, 29 January 16
Quote from: ||C|-|E|| on 17:15, 29 January 16
Liking it a lot!  :) Could you try it with some other screens?

Here's Batman.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 17:54, 29 January 16
And Prohibition

Title: Re: Everything looks better in scanlines!
Post by: khaz on 18:08, 29 January 16
The problem with a scan line filter is that it's a tiny part of why a CRT looks great to begin with. Most TVs don't even display distinct scan lines. I believe it was shown that 4K was the minimum resolution needed to accurately represent the shadow mask / aperture grille, but even this won't be enough. The first key element of a CRT I think is that the electron beam makes for a round or oblong phosphor spot, something that is never accounted for in any filter I ever saw. Square razor sharp pixels are an invention of the digital world. The second key point is that the size of the of the pixel itself is dependent on its brightness. a white or yellow pixel will take more space than a dark blue one: the black lines between scan lines have a variable thickness depending on how bright that region of the screen is.

Examples taken from another forum:
The first one is taken from a professional monitor, which has a much higher line definition than your standard TV, hence an exaggerated scan line separation. The second picture is what comes out of the NES HDMI mod, one of the best out there regarding upscaling and lag.
http://www.ultraimg.com/images/IMG_4693e420b.jpg (http://www.ultraimg.com/images/IMG_4693e420b.jpg)
http://i.imgur.com/UvueYyv.jpg (http://i.imgur.com/UvueYyv.jpg)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 18:30, 29 January 16
Quote from: khaz on 18:08, 29 January 16
The problem with a scan line filter is that it's a tiny part of why a CRT looks great to begin with. Most TVs don't even display distinct scan lines. I believe it was shown that 4K was the minimum resolution needed to accurately represent the shadow mask / aperture grille, but even this won't be enough. The first key element of a CRT I think is that the electron beam makes for a round or oblong phosphor spot, something that is never accounted for in any filter I ever saw. Square razor sharp pixels are an invention of the digital world. The second key point is that the size of the of the pixel itself is dependent on its brightness. a white or yellow pixel will take more space than a dark blue one: the black lines between scan lines have a variable thickness depending on how bright that region of the screen is.

There's no doubt that it's not the real thing.

But I'm bound to 720p, 50 fps.
I'm just looking for the best possible overlay to simulate an Amstrad monitor. Just a little bit is better than nothing. Just a little texture is better than blocky pixels.
So I have 3x3 LED pixels for each CRT pixel. How does such a 3x3 filter-grid look like in order to simulate the Amstrad CPC as good as possible within these constraints?

The NES HDMI thingy looks like the same thing the Framemeister produces at 1080p.
But that's no where close to what the Amstrad monitor did.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 18:39, 29 January 16
It seems clear that we have to emulate the whole electron beam, particle by particle, and the phosphorescent screen itself. Then, we can generate a virtual CRT monitor a virtually connect the emulator output to it. We should even emulate the electrons going through the cables, the PCBs...  :laugh:

P.D: I really like the screens!  :)

Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 18:53, 29 January 16
.
Title: Re: Everything looks better in scanlines!
Post by: khaz on 19:25, 29 January 16
Haha, yeah. I don't really miss shitty Composite like that though, RGB is where it's at.
Title: Re: Everything looks better in scanlines!
Post by: Apollo on 19:46, 29 January 16
@mr_lou (http://www.cpcwiki.eu/forum/index.php?action=profile;u=96):
The screens look very good, not completely as on a CTM but more as a modern CRT in the 90s but look great nevertheless!

@khaz (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1619):
Yeah, this is a important feature of CRTs that brightness results in "bigger" pixels and most emulation don't take that into account.

@alex76gr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=594):
Do you or anybody else have that zip from the first post anywhere? The link is sadly dead...

I was actually thinking to do a small tool for exactly that, that you can drop in a screenshot from an emulator in full-edgy glory and it renders a correct CRT or CTM pixel emulation out of it. Till now that was just a thought but as this thread shows it seems I am not the only one and I would be glad to make such a tool. The only thing I need is a good description how you get to the final image. Any descriptions are welcome and I would do some coding this weekend.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 19:50, 29 January 16
RGB was my choice back in the day as well! To be honest, I still keep a huge old CRT TV in Spain (on of those Sony with FD Trinitron that go up to 1440x1080i) and it is what I use with my old consoles when I go there. I bought it in 2006, when they were retiring them, and I never dared to change it for a flat screen. The problem is, of course, the weight and overall size of the monster (it is 36"). My dad wanted to throw it away this Christmas (although is basically mint because nobody uses it). Luckily, I was around to tell him not to touch it!  :laugh:

Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 19:51, 29 January 16
Quote from: Apollo on 19:46, 29 January 16
@mr_lou (http://www.cpcwiki.eu/forum/index.php?action=profile;u=96):
The screens look very good, not completely as on a CTM but more as a modern CRT in the 90s but look great nevertheless!

@khaz (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1619):
Yeah, this is a important feature of CRTs that brightness results in "bigger" pixels and most emulation don't take that into account.

@alex76gr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=594):
Do you or anybody else have that zip from the first post anywhere? The link is sadly dead...

I was actually thinking to do a small tool for exactly that, that you can drop in a screenshot from an emulator in full-edgy glory and it renders a correct CRT or CTM pixel emulation out of it. Till now that was just a thought but as this thread shows it seems I am not the only one and I would be glad to make such a tool. The only thing I need is a good description how you get to the final image. Any descriptions are welcome and I would do some coding this weekend.

A tool like that would be amazing  :)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 19:56, 29 January 16
Quote from: Apollo on 19:46, 29 January 16
The screens look very good, not completely as on a CTM but more as a modern CRT in the 90s but look great nevertheless!

Thanks!

Anything you can think of I could do to make it look more like a CTM?
Title: Re: Everything looks better in scanlines!
Post by: TotO on 21:09, 29 January 16
Your last tests look better, but I think the filter is not properly applied.
When the pixel is black, the mask have to be black (using multiply).

For example, a blue screen don't have red and greed pixel together. So, the vertical scanline is more pronounced.
The best is to take some close CTM shots with the different CPC coulours and see the result...

Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 23:37, 29 January 16
.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 04:40, 30 January 16
Quote from: TotO on 21:09, 29 January 16
Your last tests look better, but I think the filter is not properly applied.
When the pixel is black, the mask have to be black (using multiply).

For example, a blue screen don't have red and greed pixel together. So, the vertical scanline is more pronounced.
The best is to take some close CTM shots with the different CPC coulours and see the result...

I was wondering about that. The reason is that I'm using a simple overlay right now.

To use multiply I can either manually do it in GiMP for each picture. But this means all pictures will be huge, and I don't have that much space available.
I can do it in code though (at least in theory), which is probably what I'll end up trying.

But this doesn't affect the videos, only the pictures. I can't apply a multiply layer using code for the videos.
So in this case I have to find a way to apply a multiply layer in Kdenlive.....

Unless someone knows of another way to apply such a multiply layer to a video?
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 09:05, 30 January 16
Alright, attempt 3.

How's this?
Title: Re: Everything looks better in scanlines!
Post by: dodogildo on 09:33, 30 January 16
Quite realistic
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 13:29, 30 January 16
It looks very cool to me as well  :)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 15:35, 30 January 16
Ok, I picked up my CTM from storage and took a closer look.
While I was out, the same thing that I would see myself was pointed out to me on IRC: That the RGB elements on a CTM screen aren't aligned horizontally.

Some interesting close-ups here:
Amstrad CPC - Technique graphique (7-épaisseur & luminosité des pixels) (http://cpc.sylvestre.org/technique/technique_gfx7.html)

The elements are shifted ½ length to each other, and each pixel uses up more than one RGB element.

That's of course also what alex76gr did in the first post.

In my 720p screenshots each CPC pixel is equal to 3x3 LED pixels. So I have 3x3 pixels to put "more than one RGB element" into.

I chose to do it like I think Devilmarkus has done for JavaCPC (it looks like it, but I can't know for sure).

(R)(G)(B)(0)
(B)(0)(R)(G)

This is of course not accurate, but as pointed out by khaz, we can forget about accuracy, even on a 4k resolution.
I'm only aiming at producing a simulation of a CTM, to give a texture that'll feel familiar.
Using the above pattern I will
- have more than one RGB element for each pixel.
- have shifted each RGB element ½ length relative to each other horizonally

So I think the overlay pixel positions is fine now. They ought to give an impression close to an Amstrad monitor.
Now I "just" need some way of fixing the colours, which I think becomes all too dark. When attempting to brighten them, they just become rather dusty.

Trying to adjust levels, as alex76gr describes, results in blurry colours.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 16:43, 30 January 16
Nice, you have finaly chose an "honeycomb" texture. We go ahead!  ;)
What shown the CTM close shots is the fact that picture don't have horizontal scanlines on CTM, because pixels are "interleaved".
But, vertical black columns that separate each pixels horizontaly. (and only pixel localised blur, not over all the picture)
Title: Re: Everything looks better in scanlines!
Post by: TotO on 18:03, 30 January 16
Here, 2x2 pixels are a 24x24 pattern. (a 12x12 pattern don't allow to recreate the thin vertical black columns)

[attachimg=2]

With this pattern, a 4K display is required to properly emulate the CTM!!!  :o
Sure, a hard computing on each pixel need to be processed to recreate the real picture. I can't manually.
Watch it at 25% (really good) and 100% size (fake colours).

[attach=2]
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 18:19, 30 January 16
Quote from: TotO on 18:03, 30 January 16
Here, 2x2 pixels are a 24x24 pattern. (a 12x12 pattern don't allow to recreate the thin vertical black columns)
With this pattern, a 4K display is required to properly emulate the CTM!!!  :o
Sure, a hard computing on each pixel need to be processed to recreate the real picture. I can't manually.
Watch it at 25% (really good) and 100% size (fake colours).

hehe, yea.
It may look better if you applied a little blur though?

Maybe I'll create a 4k version of 8-bit Stories later. For now I'll settle for a 720p version.  :)
Targeting blu-ray, I can't even go to 1080p because 50fps is only possible with 720p according to the specification.
I haven't seen the specs for Ultra HD Blu-ray yet. But if 4k 50fps is possible, then I might make a 4k version in the future.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 18:28, 30 January 16
Blur don't need to be applied and will come by itself if each pixel are a real RGB pattern with different level of brightness for each of them.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 19:07, 30 January 16
Quote from: TotO on 18:28, 30 January 16
Blur don't need to be applied and will come by itself if each pixel are a real RGB pattern with different level of brightness for each of them.

Hm, I can't see the logic behind that.

Your example is very sharp, which a CTM or another CRT isn't.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 19:41, 30 January 16
Because as said, my exemple is a fake using colours with patterns for each pixels.
Instead, it will be required to change each R,G,B luminosity inside each pattern to create the real colour and local blur.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:14, 30 January 16
Quote from: TotO on 19:41, 30 January 16
Because as said, my exemple is a fake using colours with patterns for each pixels.
Instead, it will be required to change each R,G,B luminosity inside each pattern to create the real colour and local blur.

Alright, I understand what you mean.
Can't quite see how it would result in the kind of blur I see on my CTM though.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 20:40, 30 January 16
First... Here, a new pattern applied as "multiply filter" to only shown the actives colours pixels. (0%, 50%, 100%)
Sure, it look very dark and too much sharp... But that allow to understand the direction to properly emulate the display.

[attach=2]

The same with a 25% resize... (false pixels are created to simulate the lack of resolution)

[attach=3]
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 00:18, 31 January 16
Looking good!


As for the image being too dark, I copied the image to another layer on GIMP and set layer mode to screen and transparency to 50%, and this is the result:


[attach=2]
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 06:08, 31 January 16
I found a link that seems to indicate that 50 fps is possible on Ultra HD Blu-ray players, so I might do a 4k version of 8-bit Stories later.
But it really depends on how many people is even interested in the 720p version. Because doing a 4k version would at minimum require re-encoding all the videos, possibly even re-recording them, since the 4k resolution allows me to record a 270p video from the CPC instead of a 240p version.
(But this would require new gear too, and I've already spent way too much money on this project as it is).

Those 4k examples still lack the blurriness and brightness.

I would do the filter a bit differently.

As khaz already pointed out, even 4k isn't enough to properly reproduce the RGB-elements layout. It still has to be scaled down a bit. As far as I can see, the result would be something like I came up with.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 10:16, 31 January 16
The problem is you filter not recreate real pixels.  ;D
It is not a rainbow but "R,G,B" individual gradiant looking "Dark-Bright-Dark".
Title: Re: Everything looks better in scanlines!
Post by: ZbyniuR on 10:30, 31 January 16
WOW - Now I see what you trying to do. This look more similar to CRT than scanlines in emulator, but I think horizontal dark lines should be more visible than vertical lines. :)
Title: Re: Everything looks better in scanlines!
Post by: TotO on 10:54, 31 January 16
The goal is not to fake what peoples want to see, but what is really displayed.  ;)
You can zoom on a CTM screen and search... No scanline, only dots and more or less prounonced verticals rows when R/G/B pixels are off.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 11:08, 31 January 16
Quote from: TotO on 10:16, 31 January 16
The problem is you filter not recreate real pixels.  ;D
It is not a rainbow but "R,G,B" individual gradiant looking "Dark-Bright-Dark".

Yes, but as we can agree, that becomes too dark.

So instead, I pick a mix of the two colours on each side of the dark.
So, e.g. between Red and Green, instead of black I'll put a dark RedGreen, i.e. 0x3f3f00
I'll also boost the Red and Green. That way it becomes
RED - redgreen - GREEN - greenblue - BLUE - bluered
0xff7f7f - 0x3f3f00 - 0x7fff7f - 0x003f3f - 0x7f7fff - 0x3f003f

Quote from: TotO on 10:54, 31 January 16The goal is not to fake what peoples want to see, but what is really displayed.  ;)
You can zoom on a CTM screen and search... No scanline, only dots and more or less prounonced verticals rows when R/G/B pixels are off.

My goal is to create an effect that looks like a CTM on a 720p resolution, not create a 100% realistic recreation.
And as already established, creating a 100% realistic look isn't even possible with a 4k resolution.

But IF I were to use 4k resolution, I would us the approach I've described here, in order to create a look similar to a CTM.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 11:26, 31 January 16
It is not the way to fix the problem... But, increasing the RGB surface and reducing the black gaps.
I have made a resize to 25% to show how it look more brighter is less black is used.

You can't produce a picture as bright as your LCD display if you want to properly simulate what a CRT shown.
Because a CRT without black areas will be more brighter too. ;)
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 11:43, 31 January 16
.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 12:10, 31 January 16
You can't lost luminosity.
You should do like on a real CTM and increase it on your monitor.  ;D
Title: Re: Everything looks better in scanlines!
Post by: arnoldemu on 15:23, 31 January 16
Quote from: TotO on 12:10, 31 January 16
You can't lost luminosity.
You should do like on a real CTM and increase it on your monitor.  ;D
@mr_lou (http://www.cpcwiki.eu/forum/index.php?action=profile;u=96),@TotO: What is the size of the effect used here? You may need to adjust it because the CPC's mode 1 pixels are not perfect square, so there will be some "bleeding" of colours. You may need to scale it horizontally and perhaps translate it a little in x and y.

You may also need to adjust the black level slightly so black is not 0,0,0 to match a real monitor.

The effect you have shown though is much closer to a real ctm :)

The next problem is gamma.

The monitor will "apply" gamma to the colours from the cpc.
I don't know if the screenshot has gamma applied or not or is it raw r,g,b from cpc?

To display on a modern tv you may need to do gamma adjustment.
I believe ctm is 2.2, but modern tv may be different so you may need to gamma adjust.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 15:36, 31 January 16
Sure, there is many things to take acount to have something close to the real result.
By the way, the CPC pixel ratio is close to 1:1 if you considerate the CTM is 4:3 and the CRTC overscan size 384x288 in MODE 1.
An don't forget that you don't know what is the PC screen ratio too...  :-\
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:45, 31 January 16
Quote from: arnoldemu on 15:23, 31 January 16What is the size of the effect used here? You may need to adjust it because the CPC's mode 1 pixels are not perfect square, so there will be some "bleeding" of colours. You may need to scale it horizontally and perhaps translate it a little in x and y.

I don't need it to be that perfect.

For 4k each CRT pixel gets 8x8 LED pixels. That makes it possible to give a pretty close emulation, like one CRT pixel using about 1 + 2 * ½ RGB elements.

Quote from: arnoldemu on 15:23, 31 January 16You may also need to adjust the black level slightly so black is not 0,0,0 to match a real monitor.

Yup, I did that.

Quote from: arnoldemu on 15:23, 31 January 16The next problem is gamma.

The monitor will "apply" gamma to the colours from the cpc.
I don't know if the screenshot has gamma applied or not or is it raw r,g,b from cpc?

To display on a modern tv you may need to do gamma adjustment.
I believe ctm is 2.2, but modern tv may be different so you may need to gamma adjust.

Yes I added gamma to, about 30 I think.
Not sure what you mean by 2,2.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 17:11, 01 February 16
Ok, I found a formular for gamma.
The filter is now applied in code, including gamma and RGB-elements emulation.

I think it looks pretty good. Definitely gives a better feel than the "blocky" version.

BUT: I am only applying this filter when viewing images in fullscreen. I'm not applying it when displaying the images in a smaller version in between the text.
And it's quite clear that the smaller versions of the images are therefor very bright and "clear" compared to the fullscreen filtered versions (of course).

But aren't we in agreement that displaying a CPC image on a PC with 0x00 and 0x7f and 0xff RGB values will give a too bright picture?
Does emulators darken the picture or are emulators generally displaying too bright images?
@arnoldemu (http://www.cpcwiki.eu/forum/index.php?action=profile;u=122), the screenshots I'm using has been taken using an older version of Arnold. Do you remember if you've darkened the picture?


This coded filter can only be used for the pictures. When it comes to video I'll have to find settings in Kdenlive that gives the somewhat same result.
Title: Re: Everything looks better in scanlines!
Post by: PulkoMandy on 07:17, 02 February 16
I don't know what other emulators do, but the values I use are from grimware.org measurements of the voltage at the Gate Array output. That is, emulation of the CPC, but not of the CTM gamma.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 09:11, 02 February 16
Quote from: PulkoMandy on 07:17, 02 February 16
I don't know what other emulators do, but the values I use are from grimware.org measurements of the voltage at the Gate Array output. That is, emulation of the CPC, but not of the CTM gamma.

I can't find anything about this. Do you have the direct link?
Title: Re: Everything looks better in scanlines!
Post by: TotO on 09:15, 02 February 16
Here: documentations:devices:gatearray [Grimware] (http://www.grimware.org/doku.php/documentations/devices/gatearray)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 14:45, 04 February 16
I have tried a ton of different ways of creating an acceptable "CTM-filter" for 720p resolution, and kinda getting nowhere.

Everytime I find something I think looks great, I spot something about it that isn't great.

Anyway, I won't bore you with the failed attempts.

Attached image shows an example of what I think I finally ended up with.

I don't see how I can produce something better when being restricted to 720p.

So tell me your opinion please.

Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 14:56, 04 February 16
My opinion is that it looks very cool and I wish I could have the same in real time for the emulators  :)

Could you try it with one of the screens from our adventure?  :D

[attachimg=1]

[attachimg=2]

[attachimg=3]
Title: Re: Everything looks better in scanlines!
Post by: MacDeath on 15:21, 04 February 16
From what I observed...

Amstrad mostly had no horizontal line effect if I recall well.

the moiré was mostly caused because the screen was not really flat at all, really looks like some huge light bulb and not always clean.

Mostly the "scan lines" effect could somewhat be vertical as on most real CPC cmonitors, the pixels supposed to be 1:1 (mode1) are actually slightly elongated vertically, but also because of the very nature of the luminophore.

pure red is actually made of one red vertical line and two black vertical lines in each luminophores in the pixel.


This vertical pixel ratio can be seen with some ditherings.

A pixel is actually a potato composed by some luminophores...
I think that to fully reproduce a CRT amstrad monitor, you would actually need huge modern resolution (really doable on a 4k or 5k retina I guess and actually emulate the whole luminophore matrix, taking account of the smaller black lines between each groups of RGB.

Also as monitors were huge light bulbs... have to take into account some luminosity thing.

Modern monitors, if with not huge HD (retina 5k screens) : you can still see some dark line between the pixels...
but it will mess up the emulation anyway because each colours in the luminophore would be divided vertically (imagine a 3x3 matrix) while they weren't on a CRT.

when you make graphics for such specs as a CPC or even a PLUS, it is good to stay with the modern rendering so you can understand the picture... and best way is to check on both modern PC and older real system.


also one individual monitor would display quite differently than another, depending of its age, serie of production, and model.

Clearly the PLUS mnitors are a different race than the CTM from older CPC models and any individual monitor wouldn't age the same way as another.



anyway, a "scanline effect doesn't have to be really hyper accurate... RGB CRT monitors were rarely actually accurate as well.
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 15:25, 04 February 16
It looks quite good, so I wouldn't spend more time on it if you're happy.


QuoteI wish I could have the same in real time for the emulators


Doesn't MAME do it?
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 16:08, 04 February 16
Yes, but I think that it does not look so nice  :) . Maybe is only my impression, I did not look in detail  :D
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 16:27, 04 February 16
Quote from: ||C|-|E|| on 14:56, 04 February 16Could you try it with one of the screens from our adventure?  :D

Here you go.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 17:32, 04 February 16
Thank you! They look very cool!  :D
Title: Re: Everything looks better in scanlines!
Post by: MacDeath on 18:36, 04 February 16
white vertical lines ?
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 19:18, 04 February 16
Quote from: MacDeath on 18:36, 04 February 16
white vertical lines ?

Vertical yes. The CTM monitor has vertical "scanlines" more than horizontal scanlines.

Not white though, of course. They were of course black, because they are essentially just the space between the RGB-elements.

For 720p I can't create a proper simulation of this, so I have to settle for this one.
The vertical "scanlines" will always be the darker color of the two.

It's not an accurate representation of the CTM monitor look, but it's the best I'm able to produce, and I feel it does give a better feeling than looking at those blocky pixels.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 19:20, 04 February 16
Quote from: MacDeath on 15:21, 04 February 16From what I observed...
I have used the same way for my previous mockup... (just zoom them)
About vertical lines ; Just look your picture to understand.  ;)
Title: Re: Everything looks better in scanlines!
Post by: MacDeath on 19:51, 04 February 16
no issue with "vertical"... but WHITE ?

of course the balck has pure black, but on the picture you posted, I thing the "scanlines" are white, which doesn't feel right.


To be fair a proper flat screen emulation would really need freeaking huge quality screens...  but it would be quite interesting to see that done well on a 4k or 5k Retina monitor.

Doesn anyone have a 4k euros iMac ?  :laugh:


(http://cpc.sylvestre.org/technique/gfx7/point.jpg)
(http://cpc.sylvestre.org/technique/gfx7/blanc-gris.jpg)
(http://cpc.sylvestre.org/technique/gfx8/e1.jpg)


there are great infos at Les Sucres en Morceaux, but it is in french, all the pictures are quite interesting though...
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:01, 04 February 16
Quote from: MacDeath on 19:51, 04 February 16
no issue with "vertical"... but WHITE ?

of course the balck has pure black, but on the picture you posted, I thing the "scanlines" are white, which doesn't feel right.

As I said, I can't reproduce an accurate representation in 720p.
I have to settle with something that gives a feeling of a CTM monitor on a 720p resolution.

One of my previous attempts looks rather nice though. It used RGB-elements multiplied layer, but it wasn't 1:1 so the pixels looked wrong. The effect was great, but wrong pixel alignment ruined it. 4k resolution is necessary in order to do it like that properly, and I don't have that luxury available for this project.

The current result is actually created by using a RGB-element multiplied layer that is not 1:1 either, but where one CPC pixel width is equal to one RGB-element width. That's not how a real CTM monitor does it, but I have to do it like this in order to not get wrong pixel alignment.
This result is then blurred and bit and levels adjusted. Then burred a bit again and levels adjusted again.

If someone had shown me this result as the first option, I would have turned it down too. That's why I've spent days trying to come up with something better. But I can't. Not with 720p.

If you have a better suggestion I'm all ears.
Title: Re: Everything looks better in scanlines!
Post by: MacDeath on 20:11, 04 February 16
after a few looks, it is true that it looks more practical in "medium resolution" modern screen... it somewhat emulates the fact on real screen the R-G-B are a lot brighter.

Perhaps to use a slighty less white white... :laugh:
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:30, 04 February 16
I'm not "selecting" anything in this process.

It's all automatic.

Each CPC pixel is scaled to a 3x3 grid LED pixels. (This is not 1:1 RGB-elements, but 1 CPC pixel is rather 2-4 RGB-elements).
This 3x3 grid is then divided into the 3 RGB colours. So, if the pixel is a white, it will result in all 3 RGB colours "lit".
This, as you say, also means that if only a red is displayed, only the RED is lit in the RGB-element.

For a previous attempt I used a Glow filter after this step, which gave a really nice effect. I really thought this looked awesome. But the pixels aren't aligned. I've attached an example of that one to show you what I mean.
The effect gives a close to CTM impression I think. But sadly the 720p resolution isn't big enough to properly emulate the RGB-elements, so it's not working.

Anyway, since that didn't work, what I'm doing instead is to create a width:width RGB-element instead and then blur twice to compensate for 720p resolution. The result obviously doesn't look like a CTM monitor, but should give a much better impression of a CPC than no filter.

The "white scanlines" aren't created by me. They're created because there's white in the picture on that place. So the white is actually the colour - not the "scanline". The "scanline" is always the darker colour of the two you see.
Title: Re: Everything looks better in scanlines!
Post by: Fessor on 21:29, 04 February 16
Looks great. Wonder if its possible to get some more intensity to some inks (inks 16, 18, 26) because they are to dark.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 06:44, 05 February 16
Quote from: Fessor on 21:29, 04 February 16
Looks great. Wonder if its possible to get some more intensity to some inks (inks 16, 18, 26) because they are to dark.

I have tried. I cannot produce a better result than this. The current colours are the result of a levels-filter, setting the high-level to 0.58 and running it twice between gaussian-blur filters with a radius of 2.
Setting a lower value will make the colours brighter - but then other colours will be too bright.

Some colours are slightly too dark, and other colours are slightly too bright. As far as I can see it's a compromise I have to accept.

There's one method I haven't looked too much into yet though: Scale to 4k (or even 8k), then apply the RGB-elements filter multiplied, add glow-filter, scale back to 720p.
I only tried this briefly before, since it gave a boring result. I might make more attempts.

The current 720p result makes the vertical "scanlines" clearly visible. That part is a must.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 08:02, 05 February 16
Here is the same picture scaled to 4k - RGB-elements filter applied - glow-filter applied - scaled back to 720p using Sinc (Lanczos3) filter.

Is that better than the plain 720p version?
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 11:33, 05 February 16
It is definitely sharper and brighter. I would say that it looks better indeed, but the vertical lines are more apparent as well. If I have to choose, I would probably choose this last one  :)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 12:01, 05 February 16
My problem with the last one is that the scanlines have different distances between each other.
While the average distance may be closer to the real thing, I just prefer the first one where it's the same distance.

I wonder if I need to create a poll. I obviously want to use the one that'll make most people happy.
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 12:49, 05 February 16
I was going to say the same - the resizing made the effect uneven and it's pretty obvious, so I'd go with the previous result myself :)
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 12:51, 05 February 16
Yep, definitely the previous version is way better The uneven scanlines ruin the whole image.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 15:13, 05 February 16
My GF prefers the first one as well... I must be the only one that prefers the hi-res approach  :picard:
Title: Re: Everything looks better in scanlines!
Post by: remax on 17:27, 05 February 16
I prefer the first one, even if colors are not perfect...
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 20:25, 05 February 16
Yea, nothing is perfect in this mission.

I think I'll end up using the first Wec Le Mans one, but I admit I'm still conflicted.

1080p would give me slightly better scanline-effect, but then I'd only have 25 fps available. I'd really like to keep 50fps, but that means I'm stuck with 720p

...unless I turn the whole thing into an Ultra HD Blu-ray project, in which case I can get 4k resolution with 50 fps. That would solve everything.
But then I'd have no recipients because no one has an Ultra HD Blu-ray player.  :)

Choices choices choices.

I'll have to stick with the 720p 50fps option I think....
Title: Re: Everything looks better in scanlines!
Post by: Apollo on 22:57, 05 February 16
Wouldn't be 1080i50 be an option? You can still provide the 1080p50 AVC for download if you master with that and in the last step for the BD make a 1080i50 encoding.
Title: Re: Everything looks better in scanlines!
Post by: Apollo on 23:03, 05 February 16
Quote from: mr_lou on 08:02, 05 February 16
Here is the same picture scaled to 4k - RGB-elements filter applied - glow-filter applied - scaled back to 720p using Sinc (Lanczos3) filter.

I think Lanczos could be the wrong method for downscaling as it emphasizes sharpness which can lead to aliasing or a kind of moiré pattern with regular fine details. Try with a more simple downscale filters if they give better results.
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 23:39, 05 February 16
What is your 720p formula? I will try to add a filter to capriceRPI. I have yet made for basic scanlines and interlaced. Easy to add one more!!!
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 05:41, 06 February 16
Quote from: Apollo on 22:57, 05 February 16
Wouldn't be 1080i50 be an option? You can still provide the 1080p50 AVC for download if you master with that and in the last step for the BD make a 1080i50 encoding.

I don't think 1080i50 would look right. I also don't think it's an option for Blu-ray.
Encoding Video for Blu-Ray using H264/AVC - Doom9's Forum (http://forum.doom9.org/showthread.php?t=154533)

Quote from: Apollo on 23:03, 05 February 16
I think Lanczos could be the wrong method for downscaling as it emphasizes sharpness which can lead to aliasing or a kind of moiré pattern with regular fine details. Try with a more simple downscale filters if they give better results.

I've only tried the down-scale fllters available in GiMP. Sinc gave the best result I think.

Quote from: KaosOverride on 23:39, 05 February 16
What is your 720p formula? I will try to add a filter to capriceRPI. I have yet made for basic scanlines and interlaced. Easy to add one more!!!

I don't think an emulator can do it fast enough real-time.

First I scale to 720p and then I apply my RGB-elements pattern by AND'ing the values to the image.
(Used multiply formula previously).


  private static final int CPC_R = 0xffff0000;
  private static final int CPC_G = 0xff00ff00;
  private static final int CPC_B = 0xff0000ff;
  private static final int[][] CPC_RGB = {
    {CPC_R, CPC_G, CPC_B}
  };

    int outPixels[] = new int[destImage.width() * destImage.height()];

    for (int xx = destImage.getWidth() - 1; xx >= 0; xx--) {
      for (int yy = destImage.getHeight() - 1; yy >= 0; yy--) {
        int pos = yy * (destImage.getWidth()) + xx;
        int dr = (outPixels[pos] & 0xff0000) >> 16;
        int dg =(outPixels[pos] & 0xff00) >> 8;
        int db =(outPixels[pos] & 0xff);
        int cr = (CPC_RGB[yy % CPC_RGB.length][xx % CPC_RGB[0].length] & 0xff0000) >> 16;
        int cg = (CPC_RGB[yy % CPC_RGB.length][xx % CPC_RGB[0].length] & 0xff00) >> 8;
        int cb = (CPC_RGB[yy % CPC_RGB.length][xx % CPC_RGB[0].length] & 0xff);
        int nr = dr & cr;
        int ng = dg & cg;
        int nb = db & cb;
        int newcolor = 0xff000000 | (nr << 16) | (ng << 8) | (nb);
        outPixels[pos] = newcolor;
      }
    }


After that I apply some filters, using a library I downloaded from here:
Jerry's Java Image Processing Pages (http://www.jhlabs.com/ip/filters/)

I currently use GaussianFilter followed by a LevelsFilter, and then GaussianFilter again followed by LevelsFilter again.


    GaussianFilter gf = new GaussianFilter();
    gf.setRadius(2);
    destImage = gf.filter(srcImage, null);

    srcImage = destImage;
    LevelsFilter lf = new LevelsFilter();
    lf.setLowLevel(0f);
    lf.setHighLevel(0.58f);
    destImage = lf.filter(srcImage, null);

    srcImage = destImage;
    GaussianFilter gf = new GaussianFilter();
    gf.setRadius(2);
    destImage = gf.filter(srcImage, null);

    srcImage = destImage;
    LevelsFilter lf = new LevelsFilter();
    lf.setLowLevel(0f);
    lf.setHighLevel(0.58f);
    destImage = lf.filter(srcImage, null);


I've also tried the GlowEffect which I think gave a nice impression, but it doesn't seem to work that well with the current RGB-elements pattern I'm using.
Probably works better when the RGB-pattern includes some black as well. (See the last Radzone example).
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 07:55, 06 February 16
I can have 25 fps with 1080i though.

Would you rather have 25fps + a better scanline effect, rather than 50fps with the current scanline effect?

I always felt the 50fps was more important, but now I'm not sure.
Most games run at 25fps anyway, and the 50fps will only be visible briefly sometimes....
Title: Re: Everything looks better in scanlines!
Post by: PulkoMandy on 11:56, 06 February 16
I think 50fps is more important. Games are not always at full 50 fps speed, but they are not necessarily at 25fps either. They could refresh one every 3 frames at 50fps for example, which would then interfere with the 25fps display for even worse results.
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 13:43, 06 February 16
I also prefer the 50fps, but I also would really like a proper CTM-look.

I can't believe the amount of time I've spent on trying to come up with an acceptable result. It seems I just can't.
Currently actually leaning towards giving it up completely and just do plain videos with blocky pixel graphics.

Spent all day (again) trying to get an acceptable result. Need a break now.
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 14:02, 06 February 16
Thanks, it gives me an idea of how to manipulate the pixels. Just because an emulator can't lose so much time with pixel manipulation then I will try some precast tables. RPI  has not a superpower full cpu but has enough ram.

With caprice hires mode a cpc pixel has 2x2 real pixels, well, time for some calculations :)
Title: Re: Everything looks better in scanlines!
Post by: TotO on 15:54, 06 February 16
It is too much computing for finaly not look like a CTM...
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 16:57, 06 February 16
Ok, I'm trying a new approach.

What's your opinion on these?
Title: Re: Everything looks better in scanlines!
Post by: TotO on 17:03, 06 February 16
Yes, look interresting!
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 17:13, 06 February 16
Not bad!


It's simpler and yet it gives a nice glowing pixel grid effect.
Title: Re: Everything looks better in scanlines!
Post by: ||C|-|E|| on 18:05, 06 February 16
I like it!  :)
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 21:22, 06 February 16
Great!! It comes closer to CRT  :o

Well, all I have reached at 768x544 is some kind of dithering.... not great but... emulation does not suffer...

Ugly photos from the screen...
Title: Re: Everything looks better in scanlines!
Post by: Phi2x on 21:53, 06 February 16
.
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 22:01, 06 February 16
CapriceRPI also has that scanline mode  :D

Also I did an interlaced mode (Try with the double-res Orion-Prime intro!!)

As I said before, I only have 2x2 pixels for each CPC pixel, so I haven't enought resolution.

I'm making some tests with different values (I have precalculated a secondary palette with half bright values and switch between normal and darker when writing pixels. I have tried 1/2, 1/3 and 1/4 values and I'm not very convinced. I think I must try to lower 1/2 bright and try to give a semi grey tone but holding the colour as the main component of that pixel
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 22:02, 06 February 16
And don't try that scanline mode playing with SilkWorm and pressing the T key!!!! you have scanline from scanline!!!!!
Title: Re: Everything looks better in scanlines!
Post by: ZbyniuR on 02:01, 07 February 16
Horizontal scanlines look real as emulation of Green monitor - only.

Filter from #115 at first sight look interesting and good, much better than scanlines, could stay like this. I think only with zoom look different but more pretty than real monitor. I think most close to real CMT was in #82. :)
Title: Re: Everything looks better in scanlines!
Post by: mr_lou on 05:36, 07 February 16
Quote from: phi2x on 21:53, 06 February 16
Your results are a lot better than the dumb horizontal scanlines approach that we can see in some CPC emulators.

I was just thinking about that yesterday, how strange it is that some emulators offer this when the CPC monitor never looked like that.

Maybe there were many people who used a TV instead?

Quote from: ZbyniuR on 02:01, 07 February 16
Filter from #115 at first sight look interesting and good, much better than scanlines, could stay like this. I think only with zoom look different but more pretty than real monitor. I think most close to real CMT was in #82. :)

I agree that #82 gives a cool look, but I don't think it resembles the CTM properly. In #82 each vertical scanline is 1 CPC MODE 1 pixel wide. This is what gives the cool look, but it's just not how the CTM looks.
#115 isn't how it looks either though, but I think it comes a bit closer at least. Still not quite happy with the colours or brightness though.
Title: Re: Everything looks better in scanlines!
Post by: TotO on 09:45, 07 February 16
Quote from: mr_lou on 05:36, 07 February 16I was just thinking about that yesterday, how strange it is that some emulators offer this when the CPC monitor never looked like that.
Because it is the fast and easy way for looking "retro".
(as displaying things in green on sci-fi movies)
Title: Re: Everything looks better in scanlines!
Post by: arnoldemu on 10:23, 07 February 16
I think it comes from arcade monitors where scan lines are more visible? Maybe more visible on 60hz than 50hz.

It is more visible on green monitors because there is less bleeding of colours between the electron guns and the brightness is less.

I think that because the cpc is a progressive 288p display then depending on vertical height there are lines which are not scanned, so there should be (in a perfect calibrated monitor) darker lines, but because of the r,g,b and the focus and the 50hz the horizontal scanlines are almost invisible.

For emulation it is quicker to put black lines, but this is not accurate at all. Doing a full filter takes more cpu time.





Title: Re: Everything looks better in scanlines!
Post by: TotO on 10:34, 07 February 16
It come from the CRT mask technologies used for displaying pixels.
The CTM use a slot mask, so the beam raster scan and hilight colours when other monitors use an aperture grille, so the beam interlines increase the scanline effect (more visible at 60Hz, because interlines are biggest). PC CRT monitors usually use shadow mask.

(https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/CRT_mask_types_en-de.svg/290px-CRT_mask_types_en-de.svg.png)


Here an Aperture grille (licenced as Trinitron by Sony) close-up:

(https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/Aperture_grille_closeup_teletext.jpg/180px-Aperture_grille_closeup_teletext.jpg)

You can found this basic mask on most arcade monitors and NTSC TV sets...
It is why, arcade look better (at less in minds) with scanlines!  :-\
Title: Re: Everything looks better in scanlines!
Post by: TotO on 11:46, 07 February 16
Obviously, the GT85 monochrome monitor don't use colour mask... So scanlines are visible.
Title: Re: Everything looks better in scanlines!
Post by: KaosOverride on 18:56, 07 February 16
Quote from: mr_lou on 05:36, 07 February 16
I was just thinking about that yesterday, how strange it is that some emulators offer this when the CPC monitor never looked like that.

In the case of Caprice, for double resolution  there is a hardware double-height render mode. You draw the display with double width and single height, and hardware scale makes the rest. This is less CPU demanding printing a 2x1 display. Double work. For a 2x2 more CPU is needed, working 4 times more than low resolution mode. For low CPU systems and no hardware scaling the scanlines render is your friend, printing 2x1 but only even lines.

But this was 10 years ago, now we have enough horse power for full pixel printing.

What caprice needs for scanlines is odd lines a bit darker than even, and you have a nicer effect...

Also I'm aware that you are after a different and more accurate effect that the one I can get at an emulator, but I'm learning a lot of this subject and trying to do the best of caprice code (and for a raspberry host, so low CPU powered comparing with a PC)
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 22:19, 22 March 21
hi, here we go again  ;D
conversion for fullHD, grid effect, some photophore blend, a little glow. I must improve mode 2 patern

(https://i.postimg.cc/LJ3V9C9s/mode-0.png) (https://postimg.cc/LJ3V9C9s)

(https://i.postimg.cc/f3WfJcyf/mode-1.png) (https://postimg.cc/f3WfJcyf)

Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 08:46, 23 March 21
Really nice. Perhaps a little too strong, but mode 0 especially looks great if you don't put your face against the screen!
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 09:29, 23 March 21
still working on new method
this one is nicer (energy distribution in fake photophores, obviously a little darker than fake RGB)
(https://i.postimg.cc/XpSBWpLN/output.png) (https://postimg.cc/XpSBWpLN)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 09:43, 23 March 21
Yeah that's a bit too dark.

Now, who's going to implement all those nice filters in a Windows terminal? :)
Title: Re: Everything looks better in scanlines!
Post by: arkive on 10:21, 23 March 21
Retro Virtual Machine has one of the best, easily configurable CRT implementations right out of the box. https://www.retrovirtualmachine.org/en/

You can also use the shaders in Retroarch on top of CPC emulation, or use Reshade to inject them directly into standalone emulators: GitHub - Matsilagi/RSRetroArch: (Curated) Repository of RetroArch and related ports for ReShade (https://github.com/Matsilagi/RSRetroArch)
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 10:30, 23 March 21

RVM CRT emulation is far from a CPC monitor, if you think it's the best avalaible we are f*cked  ;D

but i agree it's nice, funny and fancy, but every FX are not related to CPC monitors
Title: Re: Everything looks better in scanlines!
Post by: Sykobee (Briggsy) on 11:03, 23 March 21
I think it looks good for the darker colours, but the bright colours are muted by the effect. A gentle bloom on the bright colours might be nice too.


Maybe we need some reference photos from real CPC monitors for a variety of loading screens and test patterns, to assist in the CRT effect development.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 11:46, 23 March 21
Quote from: roudoudou on 10:30, 23 March 21
RVM CRT emulation is far from a CPC monitor, if you think it's the best avalaible we are f*cked  ;D

Prove it :) It has specific options for GT 65 colour/mono.

Besides, not everyone uses Amstrad monitors, at least not these days. Mine look great on my Trinitrons.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 11:59, 23 March 21

proof is used to prove that something exists, so it's your job to prove that RVM can mimic CTM

Here is a closeup of a CTM MM monitor, good luck with settings  :P
in the meantime i will continue to do something that looks like real CTM/MM  8)
(https://i.postimg.cc/ZBxVBSyB/real-mire-20210321-151927.jpg) (https://postimg.cc/ZBxVBSyB)
Title: Re: Everything looks better in scanlines!
Post by: eto on 12:33, 23 March 21
Quote from: roudoudou on 11:59, 23 March 21
Here is a closeup of a CTM MM monitor, good luck with settings  :P
in the meantime i will continue to do something that looks like real CTM/MM  8)


Can you share which program is displaying this test image?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 12:40, 23 March 21
Quote from: eto on 12:33, 23 March 21

Can you share which program is displaying this test image?
if you mean the mire => https://www.cpc-power.com/index.php?page=detail&num=16027


Title: Re: Everything looks better in scanlines!
Post by: eto on 13:08, 23 March 21


Yes, this one. Thanks.

Unfortunately I can't compare the output of the MM to the RVM but based on your picture (which of course also cannot replicate the exact impression you have in real life) I think the RVM emulator is doing a pretty good job. One of the reasons why I prefer it over the others, as the "feeling" is closer to a real machine than the other emulators.

Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 13:22, 23 March 21

there is absolutely NO horizontal scanline on CPC because of the staggered photophores (see photo below, it cannot happend)

on your try, there is no blend between pixels => on the CTM/MM you have 5 RGB photophores for eight pixels, that's why mode 0/mode1 pixels looks like elipsoids and why mode 2 is blended

Plus photophore has a particular behaviour because of energy emission at different locations
RVM will never emulate a CRT with pixel FX, you need to mimic photophores and do RGB emission at different locations

photography courtesy of Sylvestre(http://cpc.sylvestre.org/technique/gfx8/e1.jpg)
(http://cpc.sylvestre.org/technique/gfx8/e2.jpg)

last try with my conversion routine
(https://i.postimg.cc/hJMGDKLZ/output.png) (https://postimg.cc/hJMGDKLZ)

Title: Re: Everything looks better in scanlines!
Post by: eto on 13:41, 23 March 21
Thanks for the explanation. Now I understand better what you mean.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 13:50, 23 March 21
Quote from: roudoudou on 11:59, 23 March 21
proof is used to prove that something exists, so it's your job to prove that RVM can mimic CTM

I'm not sure you realize how "proving" something works :) The onus is usually on the one challenging an assumption. But, thanks for the pic anyway, that's what I was actually after (https://www.cpcwiki.eu/forum/file:///C:/KH10304/HTML/%20HTML%20PUBL/crtscr.html).

I did not say RVM can "mimic" Amstrad monitors, merely that it's at the moment the best solution for somebody who wants to quickly and easily get the "CRT look", which is not limited only to CTM/MM btw. Most people won't really know the difference between difefrent shadowmasks and such. Those who do can try to tweak one of the Retroarch shaders.

I mean, unless your shader, which does look interesting, is actually available somewhere. Is it?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 14:37, 23 March 21
Quote from: arkive on 13:50, 23 March 21
I'm not sure you realize how "proving" something works :)
I did not say RVM can "mimic" Amstrad monitors, merely that it's at the moment the best solution for somebody who wants to quickly and easily get the "CRT look", which is not limited only to CTM/MM btw. Most people won't really know the difference between difefrent shadowmasks and such. Those who do can try to tweak one of the Retroarch shaders.

I mean, unless your shader, which does look interesting, is actually available somewhere. Is it?
Sure millenials won't know the difference between CRT, shadowmask, trinitron and CTM/MM but not me  ;D (and i hope, not people who remember their CPC)

Now the code is only pure simple C code but i can already say that the code is scalable (multi-thread or shader later)

I'm talking with megachur (cpc-emu-power author) to see what can we do, but i can already explain what i'm doind and why

ps: About proof, i suggest you to read how "burden of proof"  works ;) we are not talking about mathematics but software capabilities but anyway, you told yourself that RVM cannot mimic CTM  ;D


Title: Re: Everything looks better in scanlines!
Post by: arkive on 15:05, 23 March 21
Quote from: roudoudou on 14:37, 23 March 21
you told yourself that RVM cannot mimic CTM  ;D

Umm... no, mate, that's what you said that I said, but I have never said it :D I think we have a bit of a language barrier situation here.

Anyway, looking forward to your implementation. Until then, RVM is a good solution for a quick CRT fix, and for those who want more authenticity there is CRT-Royale and other shaders where you can tweak slot mask settings.
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 14:05, 24 March 21
Quote from: roudoudou on 11:59, 23 March 21Here is a closeup of a CTM MM monitor

That moire is triggering my astigmatism :D
Title: Re: Everything looks better in scanlines!
Post by: gerald on 18:40, 24 March 21
Quote from: roudoudou on 14:37, 23 March 21
Sure millenials won't know the difference between CRT, shadowmask, trinitron and CTM/MM but not me  ;D (and i hope, not people who remember their CPC)
They even think that
- a CRT have a slow luminosity scan affecting them (Beat due to frequency offset between the of a camera looking at a CRT and the CRT, but never affecting your eye)
- a CRT always display static when the CPC is off (static is only present when you are looking at the output of untuned tuner, which does not exists on a CTM)
:picard2:
;D
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 19:06, 24 March 21
still improving

(https://i.postimg.cc/B8ZcF3dj/bob-output.png) (https://postimg.cc/B8ZcF3dj)
(https://i.postimg.cc/tZY3r5Ry/def1080p.png) (https://postimg.cc/tZY3r5Ry)

(https://i.postimg.cc/DWCQdDTB/imperial-mahjong.png) (https://postimg.cc/DWCQdDTB)
Title: Re: Everything looks better in scanlines!
Post by: robcfg on 19:16, 24 March 21
Looking really great!
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 09:02, 26 March 21
If you don't look too closely it is like you're looking at a CPC monitor :)

Also: Bob Winner, wish I had found this back in '86 - I'm sure it'd have blown my mind!
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 10:16, 26 March 21

I have a proof of concept with Linux 64 bits version of CPCEC emulator
the video is supposed to be viewed in straight 1080p to avoid jerk
if someone know a little DirectDraw, we may expect a windows version of CPCEC ?

https://clips.twitch.tv/AffluentCoyHippoANELE-a4xx-lsJoymgVX88

Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 10:19, 26 March 21
Ohhh that rocked! I think there's too much vertical stuff going on but it's really promising!
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 10:34, 26 March 21
Quote from: Gryzor on 10:19, 26 March 21
Ohhh that rocked! I think there's too much vertical stuff going on but it's really promising!
the session was captured live so there is encoder jerk, especially in black zones
i changed some details again since the stream and improved performances
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 10:56, 26 March 21
Yeah I saw the jerk and assumed it was the capturing/streaming, but it had me wondering, what sort of CPU overhead are you getting?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 11:11, 26 March 21
Quote from: Gryzor on 10:56, 26 March 21
Yeah I saw the jerk and assumed it was the capturing/streaming, but it had me wondering, what sort of CPU overhead are you getting?
i have a Ryzen 5-2600 / 6 cores/12 threads / 3.4GHz
best results with 8 threads for rendering (17% cpu for 50 frames/second)
single thread was approx. 40% of CPU
(https://i.postimg.cc/N90YYXWN/htop-screen13.png) (https://postimg.cc/N90YYXWN)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 11:18, 26 March 21
That's quite a bit! But to be expected. Doesn't it take advantage of GPU computations?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 12:36, 26 March 21
Quote from: Gryzor on 11:18, 26 March 21
That's quite a bit! But to be expected. Doesn't it take advantage of GPU computations?
it's CPU only, i don't know how to do shaders at all...
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 12:37, 26 March 21
Was only asking out of curiosity, it's not a big deal :)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 10:38, 27 March 21
Well I used to know a bit of DirectDraw but I'm pretty sure it's deprecated these days and thus a bit of a chore, I think it's mostly been superseded by Direct2D but it's been a long time since I was doing C/C++ coding so I don't know how different that is.


It does seem like this kind of thing would be well suited to a pixel shader though. For each component of a pixel, find the "nearest" emitter and then calculate how much of that color is mixed in. Possibly doing horizontal and vertical components separately to account for the slot shape? Feels like it should be doable. I might have a play around at some point and see what it would look like.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 12:34, 27 March 21
Quote from: andycadley on 10:38, 27 March 21
It does seem like this kind of thing would be well suited to a pixel shader though. For each component of a pixel, find the "nearest" emitter and then calculate how much of that color is mixed in. Possibly doing horizontal and vertical components separately to account for the slot shape? Feels like it should be doable. I might have a play around at some point and see what it would look like.
it's not that trivial (that's why all existing shaders doesn't look like real screens)
i do not compute low intensity like high intensity, that is the key  8)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 14:53, 27 March 21
Oh, I don't doubt there's a lot of subtlety to it and I haven't really considered it in depth. I do think it's an intriguing problem though and something that should be doable as a shader (at least in theory).


I do think this is one of the more interesting areas of emulator development of late. As screen resolutions get higher and higher, we're well past the point where there was a 1:1 pixel correspondence and all those extra pixels (and colour depth) really should be usable for producing a more faithful image.
Title: Re: Everything looks better in scanlines!
Post by: pelrun on 09:56, 28 March 21
I've just done a very rough attempt at a shader version using shadertoy: https://www.shadertoy.com/view/fsB3z1 (https://www.shadertoy.com/view/fsB3z1)
Unfortunately it doesn't have any reasonable way of using custom texture inputs, so I'm stuck with using one of the provided ones.

[attach=1,msg200045]
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 15:53, 28 March 21
Quote from: pelrun on 09:56, 28 March 21
I've just done a very rough attempt at a shader version using shadertoy: https://www.shadertoy.com/view/fsB3z1 (https://www.shadertoy.com/view/fsB3z1)
Unfortunately it doesn't have any reasonable way of using custom texture inputs, so I'm stuck with using one of the provided ones.


as you are dealing with floats, before going further, it may be cool to use geometry of a slot-mask with red column higher than green, blue column lower that green
then raising intensity by overflowing the other columns (but not too much) to compensate the darkness
PS: i have some photographies to do of use cases, it may help for your shader :)
again a capture from Sylvestre with white pixel / gray pixel
the white pixel is wider than the gray (kind of energy distribution)

(http://cpc.sylvestre.org/technique/gfx7/blanc-gris.jpg)
Title: Re: Everything looks better in scanlines!
Post by: pelrun on 05:12, 29 March 21
Quote from: roudoudou on 15:53, 28 March 21
as you are dealing with floats, before going further, it may be cool to use geometry of a slot-mask with red column higher than green, blue column lower that green
I'm not sure that's actually true of the slot mask; I think the offsets are actually due to the camera or the electron beam being slightly off-axis. After all some photos show the columns are perfectly aligned horizontally.
As for the "wider" bright pixels, that's a direct result of the non-linear response of the phosphors and should just happen once I implement that properly. I really need a proper high-contrast test image properly scaled before I can fiddle with that.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 07:56, 29 March 21
Quote from: pelrun on 05:12, 29 March 21
I'm not sure that's actually true of the slot mask; I think the offsets are actually due to the camera or the electron beam being slightly off-axis. After all some photos show the columns are perfectly aligned horizontally.
As for the "wider" bright pixels, that's a direct result of the non-linear response of the phosphors and should just happen once I implement that properly. I really need a proper high-contrast test image properly scaled before I can fiddle with that.


i counted 480 photophores for 768 pixels (770?) so if i'm right (for 480 count) there is 5 photophore each 8 mode 2 pixels


we may need a minimum of 8 photographies per color and intensity?
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 08:09, 29 March 21
Quote from: pelrun on 05:12, 29 March 21After all some photos show the columns are perfectly aligned horizontally.

I was going to ask, did the CTM really have the pixels placed diagonally as shown in the image above?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 08:59, 29 March 21
Quote from: Gryzor on 08:09, 29 March 21
I was going to ask, did the CTM really have the pixels placed diagonally as shown in the image above?
the grid seems to be flat but the read beam seems to be upper than the others on the pictures i have :D
we may set this as a parameter?
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 09:30, 29 March 21
Quote from: roudoudou on 08:59, 29 March 21
the grid seems to be flat but the read beam seems to be upper than the others on the pictures i have :D
we may set this as a parameter?


I'm pretty sure MacDeath has shared the relevant grilles?

But yes, the red being a bit higher does not sound strange - going downhill from left to right though, certainly seems off.
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 09:30, 29 March 21
To me it looks like alternating groups of RGB are offset (as per the diagram of slot masks on page 6) but the RGB within a group are all aligned. That's not really the same as the "pixels" being offset, because CRTs don't work like that.
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 09:41, 29 March 21
*subpixels.

There, fixed it.
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 17:23, 29 March 21
So I had a really rough stab at what I was thinking of. It's not a great PS and probably goes horribly wrong if there aren't the right number of pixels in the image etc but the results are something like:


(https://am3pap007files.storage.live.com/y4mkoEYn7RAoSd_uzrr3dkZgAoM30fxxl4NKChTf-07oaXQtbXYM1rx8GqlAHmBdiApZTpT2P13-xE62ZHBmpJAnG6q_DWWBTMOBSaD9N22kAUtqMHI4mPXe8-oa_CCEsF1wpu0q4VIBlJvE1sEJrvBaXRbU2rnrf81_eqI8GD4NYw?width=2071&height=1251&cropmode=none)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 08:19, 30 March 21
Am I the only one seeing vertical RGB bands on the road?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 08:24, 30 March 21
Quote from: Gryzor on 08:19, 30 March 21
Am I the only one seeing vertical RGB bands on the road?
nope, there is rainbow aliasing (even viewed in 1:1 pixel size)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 08:26, 30 March 21
Rainbow, yes, thank you - couldn't remember the term :D Should it be there?
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 08:45, 30 March 21
Yeah, there is some definite banding going on. I can't tell if it's my shoddy maths, an artefact of how I was rendering the image in WPF or some combination of the two. I have a feeling the way I was overlapping R&G channels might be off a bit and getting out of phase.


I don't have my CM14 any more :-( but I don't think an area of solid colour should have such a pronounced issue.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 15:27, 30 March 21
This thread could really use some quality shots of a CMT in action. The MM one was decent, but it's possible to get even closer/sharper. And I could use them for my project too, was actually about to make a separate thread asking for that.

Also, while I always applaud people working on new CRT representations, it really could be the case of bringing the water to the river (you say that in France, don't you? ;) Existing shaders such as CRT-Royale or CRT-guest have very advanced options allowing for slot mask adjustments. Perhaps it'd be easier to just tweak these.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 16:36, 30 March 21
Quote from: arkive on 15:27, 30 March 21
This thread could really use some quality shots of a CMT in action. The MM one was decent, but it's possible to get even closer/sharper. And I could use them for my project too, was actually about to make a separate thread asking for that.

Also, while I always applaud people working on new CRT representations, it really could be the case of bringing the water to the river (you say that in France, don't you? ;) Existing shaders such as CRT-Royale or CRT-guest have very advanced options allowing for slot mask adjustments. Perhaps it'd be easier to just tweak these.
I'm supposed to do test-case pictures Thursday at MacDeath place  ;D
Until now, i did not see anything accurate on existing shader mostly done for arcade platform
CNG did a test of CRT emulation in low resolution which is really cool (but i did not see any mode 1 ou mode 2 screens with it)
finally "many" people are working on CTM emulation  :-*
(https://i.postimg.cc/HnRP6414/CNG-IMAGE-2021-03-29-12-57-07.png)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 16:46, 30 March 21
Quote from: arkive on 15:27, 30 March 21
This thread could really use some quality shots of a CMT in action. The MM one was decent, but it's possible to get even closer/sharper. And I could use them for my project too, was actually about to make a separate thread asking for that.

Also, while I always applaud people working on new CRT representations, it really could be the case of bringing the water to the river (you say that in France, don't you? ;) Existing shaders such as CRT-Royale or CRT-guest have very advanced options allowing for slot mask adjustments. Perhaps it'd be easier to just tweak these.
Yes photos would definitely be a great resource for improving the accuracy.


And yes it may well be possible to tweak an existing shader to get the best result. I was mostly using it as a good excuse to practice writing something more difficult than a gray-scale implementation (which is about my level with shaders  :P )
Title: Re: Everything looks better in scanlines!
Post by: rexbeng on 18:58, 30 March 21
Quote from: roudoudou on 16:36, 30 March 21
CNG did a test of CRT emulation in low resolution which is really cool
I see that shown version of CPCE is not available to download yet though...
Title: Re: Everything looks better in scanlines!
Post by: rexbeng on 19:16, 30 March 21
Also, this is a somewhat 'request' directed to roudoudou or anyone of the people involved in this 'correct way to mimic CTM looks' quest. We, the pushers, are mocking the hell up our graphics on modern platforms. So I was wondering if you guys could mockup a transparent picture of the, say, 'CTM effect' which we could use as a layer above our mockups in modern pixel editors so as to get at least a glimpse of how things look on actual hardware.
Perhaps this sounds too far fetched, but hey, why not!
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 20:50, 30 March 21
I don't know about making a transparent image, because it's literally rewriting the colour of pixels based on where they are and probably what colour the adjacent ones are too. I'm guess image editors don't let you load a shader effect and have it apply to an image (or at least not the I've ever seen).


What would probably be a lot easier is a quick and dirty image previewer that let you load an image file and apply the effect to it.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 13:52, 31 March 21
Quote from: andycadley on 20:50, 30 March 21I'm guess image editors don't let you load a shader effect and have it apply to an image (or at least not the I've ever seen).
If something uses DirectX/OpenGL you can try to inject Reshade, though probably it wouldn't work with editors. Another way could be saving the image in the original format and then running it in an emulator with shaders.

There's also this amazing tool, ShaderGlass. Insta-CRT on anything you like :)  https://github.com/rohatsu/ShaderGlass

It can be a bit tricky to get the right values but it's worth trying out.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 17:54, 01 April 21
preview :)
Full PNG with R,G,B, White and paired colors => http://www.roudoudou.com/export/cpc/photophores.png
(https://i.postimg.cc/WzNGJw81/photo-zoom.jpg)


Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 18:54, 01 April 21
Mesmerizing.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 09:24, 02 April 21

from the photography above, i saw 2 things
photophores are square (i used 3x4 pixels in my CTM emulation, this is not correct)
i counted 18 photophores lines for 16 CPC lines
now i have to work again ;)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 16:35, 07 April 21
Ok, so I gave it another try...
(https://am3pap007files.storage.live.com/y4munvcOq7J78eQVh2847lA8HR4KExXzHXrhg1r_wmWCbQ57xG6ca93TvQ01OCb-BvLUOd3X6JmqPYAez1yH9X88Fncu9R1jJkaqPUUpeTH27dHWRm2hkpkhmOG61r4iiO5_PlFBpjWI5wna9BiJFyvP-D_na75mnqAmIw_3gtfJxk?width=1494&height=576&cropmode=none)


(https://am3pap007files.storage.live.com/y4mPR4j7P-7knpbPwBzW0YJQqGEqinFkXnwCrFkAskq73wIpVIYPDoclun_V5eZKG65RYFrYMzyPZVzWOju8ipvG-7ajOGF3KHbQj8d42d4OXBZXHn3PnTKusB58_w6zalTgXxzn2L7nKkx42RFRhlDvFjbfD3aeOJp_0yhU14v8hM?width=544&height=242&cropmode=none)


It's not perfect, but it's a lot better (and has got rid of the nasty colour banding weirdness in my last effort)
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 16:47, 07 April 21
it is too dark because black area are not that big
i'm working on a new (yeah, another one) version, much "analog", and because of that "analog mimic", it's easier
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 17:05, 07 April 21
You're probably right. Easily tweakable though as everything is analog:
(https://am3pap007files.storage.live.com/y4mnIZOV_HvVDBpe9O3ncTSWgnd7cwUoZSgP5Pn_Rpm9xNgGZueZqrhcz9NabztopEIYWi-Iy2u90C_LyEtsOfK4o4OkMZCx1uXNezkz_pQ9qR07nWgI1ejtD9-GzOSHQJopuq0CI7StguYPpHTitWh94aHUIbLsvSmzYkfValwLdY?width=630&height=295&cropmode=none)


Better?
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 17:28, 07 April 21
yeah! really better, now need to boost colors to have a white, brighter
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 20:10, 07 April 21
i got this with my new "analog" routine
(https://i.postimg.cc/qRf4WpJC/burning-screen15.png)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 21:32, 07 April 21
Nice. Looks a little too bright to me, some of the subtle shading on the red light seems to have been lost on the red light for example. I'll have to have a closer look on my laptop - it's easier to get a good feel for how well the effect comes across on a higher definition screen.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 23:39, 07 April 21
(https://i.postimg.cc/tJBLpYvr/rene-screen15.png)
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 10:21, 17 April 21
I worked again on a new CTM emulation which gives good results in mode 0, mode 1, but also in mode 2 !!!  8)
i played a lot Arkanoid yesterday night  ;D
(https://i.postimg.cc/64vQhYkd/arka.png) (https://postimg.cc/64vQhYkd)

(https://i.postimg.cc/G989rm4H/arka-zoom.png) (https://postimg.cc/G989rm4H)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 12:03, 27 May 21
Looks really lovely!

I realised I had missed a few posts in this thread. Any progress? :)

Been following a CRT/emulation comparison project/account on Twitter and I have to say, seeing what the CRT does to the images... it takes a *lot* to approach the effect.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 12:15, 14 January 22
So did anything usable ever came out of this?
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 16:48, 14 January 22
I haven't given up on the idea, although writing an entire emulator to really try it out is probably something I don't have time for right now. Never say never and there might be options to add it to something existing and open source.


Certainly the testing I did do was enough to convince me that it's plausible and works really well on a 4K screen of pulling off a much more convincing image than fairly basic "scanline" effects do, so I really hope somebody does give it a go even if it isn't me.
Title: Re: Everything looks better in scanlines!
Post by: arkive on 11:40, 16 January 22
Quote from: andycadley on 16:48, 14 January 22
I haven't given up on the idea, although writing an entire emulator to really try it out is probably something I don't have time for right now.
That certainly would be an overkill :) I was just wondering because there was a talk earlier of incorporating it in some existing emulator.

In any case, you can already achieve similar effect using existing shaders in Retroarch or ShaderGlass (https://github.com/mausimus/ShaderGlass)
Title: Re: Everything looks better in scanlines!
Post by: Gryzor on 12:04, 16 January 22
ShaderGlass looks interesting. I wonder how well it works with scaling though.

Off topic, but I was blown away by the be MiSTer filter masks, was playing RoboCop yesterday and it looked exactly like my CRT arcade cab!
Title: Re: Everything looks better in scanlines!
Post by: Carnivius on 16:46, 17 January 22
Quote from: arkive on 11:40, 16 January 22
That certainly would be an overkill :) I was just wondering because there was a talk earlier of incorporating it in some existing emulator.

In any case, you can already achieve similar effect using existing shaders in Retroarch or ShaderGlass (https://github.com/mausimus/ShaderGlass)
Oh yeah I use shaders in Retroarch which does almost all of my emulation for me.   ShaderGlass is great too for anything else I don't use Retroarch for.   My PC is getting real old so I can't go nuts with too many shaders and filters and such but I've managed to compromise and settle for a decent config without dragging the running of the actual games down any.  I can't be doing with a 'clean' image anymore. Especially knowing how many 8 and 16 bit games actually made use of the odd aspects of CRTs particularly in their graphic choices and techniques. Aspects that just don't exist in modern TV's and so have to be faked to get the graphics to appear the way the original artists intended.   :)
Title: Re: Everything looks better in scanlines!
Post by: andycadley on 18:57, 17 January 22
Quote from: arkive on 11:40, 16 January 22
That certainly would be an overkill :) I was just wondering because there was a talk earlier of incorporating it in some existing emulator.

In any case, you can already achieve similar effect using existing shaders in Retroarch or ShaderGlass (https://github.com/mausimus/ShaderGlass)


Yeah, these are things I might have a look into at some point. The code I had was very picky about the exact resolution it was rendering at and didn't work at all well on anything less than a 4K screen so it would still be a fair old bit of effort to make it functional.


But running it over a pre-recorded segment of Burnin' Rubber did look really nice, much more so than generic scanlines etc or basic blurring effects that some emulators seem to use. Things like the shadow under the car looked "right" and other things like Mode 2 text had that nice bleeding effect you see on a genuine monitor.
Title: Re: Everything looks better in scanlines!
Post by: roudoudou on 09:42, 07 January 24
long time since this thread, new year means new resolutions so...

i try to made some accurate CTM filter, GT filter and also Trinitron filter because i know some people like scanlines (note that Trinitron has horizontal AND vertical scanlines, eveything else is fantasy screen!)

the filter is supposed to be used at full size (1600x1200) but the rendering is also ok in small size (800x600)

CTM (https://i.postimg.cc/R08WdTCm/newCTM.png)

GT (https://i.postimg.cc/fR8ttN6J/newGT.png)

Trinitron (https://i.postimg.cc/vZYxZB2J/new-Trinitron.png)

mode 0 CTM fullsize (https://i.postimg.cc/QxrWvSQx/new-CTMfull.png)

mode 0 CTM reduced (https://i.postimg.cc/CM8qv9fQ/new-CTMreduction.png)



Powered by SMFPacks Menu Editor Mod