17 September 2016, 23:59 | #1 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Pre-scaling before bilinear filtering for less-blurry image
This is probably already possible by stacking filters. Can anyone explain how because I haven't been able to figure it out.
I've been using a 1024×768-pixel Workbench. Text looks pretty small on my laptop, so I want to scale the image by 1.5× to have it occupy 1536×1152 pixels on-screen. Setting Horiz. size and Vert. size to 1.5× in Filter Settings works, but the result is pretty blurry. However, if I could pre-scale the image (e.g. pixel-doubling to 2048×1536 then scaling down with filtering to 1536×1152) the result would be significantly sharper. See the attached images. The blurrier scaled-up-1.5× image was created using a paint package rather than getting a screenshot of the filtered/scaled image in WinUAE. But it looks pretty similar. The other one was also made using a paint package, scaling up 2× then down with bilinear filtering. [After clicking a thumbnail, click the image to (hopefully) show it unscaled in your web browser.] |
21 September 2016, 18:46 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
RTG mode? I think it can do integer scaling quite easily (can be made simultaneously with color space conversion = not free if there is no need for conversion)
Chipset mode? Far from easy.. |
21 September 2016, 18:55 | #3 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Wouldn't being able to apply two null filters work? In my example (which is a chipset mode), I could have the first filter scale by 3× with point filtering, the second filter by 0.5× with bilinear filtering. But it seems the various size & position options/sliders in filter settings are only applied once?
|
21 September 2016, 18:58 | #4 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Quote:
|
|
21 September 2016, 19:08 | #5 |
Registered User
Join Date: Jul 2014
Location: Finland
Posts: 1,176
|
2x 4x integer scaling of RTG modes would be useful for me, on HiDPI screens AmigaOS is pretty much unusable. 4x integer scaling would make this okay.
|
21 September 2016, 19:27 | #6 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
So to achieve what I want, I guess a D3D shader would have to be used? I think all the ones which come with WinUAE apply fancy scaling effects though, there isn't a simple pixel-doubling/tripling one.
|
21 September 2016, 20:12 | #7 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
It probably would make best quality. Supersampling mode may also help (1x/2x/3x/4x) menu next to "reset defaults" which allocates 2x/3x/4x larger texture size, shader writes to large texture, then it is scaled back to output size.
|
02 October 2016, 17:52 | #8 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Like a complete noob I tried making my own shader by simply modifying _winuae.fx, changing filtermode to POINT in the SourceSampler definition:
Code:
sampler SourceSampler = sampler_state { Texture = (SourceTexture); MinFilter = POINT; MagFilter = POINT; MipFilter = NONE; AddressU = Clamp; AddressV = Clamp; }; D3D9Ex: SetTechnique: 8876086C S=1 F=0876 C=086C (2156) () Any idea what I'm doing wrong? |
02 October 2016, 20:46 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
You can't rename _winuae.fx and use it as a standalone shader. _winuae.fx is special case final pass which also includes support for masks and overlays.
|
02 October 2016, 21:23 | #10 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
OK so much for that.
I found this which looks like it could do the job, with suitable modifications??? https://github.com/mamedev/mame/blob...sl/prescale.fx |
03 October 2016, 22:01 | #11 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
I think I got an effect close to what I'm after by using this shader: http://www.si-gamer.net/gulikoza/src/point.fx
Using that unmodified there was an error in the WinUAE log, so I changed VertexShader = compile vs_1_1 VS(); PixelShader = compile ps_1_1 PS(); to VertexShader = compile vs_2_0 VS(); PixelShader = compile ps_2_0 PS(); after which it seemed to work OK. I put point_modified.fx as the -4 entry in filter settings, 2x in the box next to that. Extra settings set to bilinear (that applies to the final (null?) shader which WinUAE applies). Some screenshots are attached:
Note the much smaller file sizes for the mtpaint-created images. That's because they only use a small number of colours. For whatever reason the WinUAE-filter images have more than 256 different colours in them. Last edited by mark_k; 03 October 2016 at 22:10. |
18 March 2018, 13:50 | #12 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Hi Mark,
I was interested in trying out your adjusted "pre-scaling shader" today (attached in post #11), as I wanted to see whether there's something similar to MAME's "prescale" factor before applying filtering (which your adjusted shader seems to do just that for WinUAE), but unfortunately it doesn't seem to work with D3D11. Just wondering, did you get it to work with latest WinUAE 3.6.1 and D3D11? |
18 March 2018, 15:55 | #13 |
Banned
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
|
Mark_K, what's the native resolution of your laptop screen?
|
27 March 2018, 16:33 | #14 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
I haven't done any more work on this since post #11 above. And I don't really know anything about shaders.
Laptop screen res is 1920×1200 but I was running WinUAE in a window. Trying to get a 1024×768-pixel Workbench to look a bit less blurry, 1.5× is the largest "round" scale factor which fits (WB screen would occupy 1536×1152 pixels). |
29 March 2018, 08:20 | #15 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
It works the same way as the MAME prescale setting, i.e. you need to scale this shader 2x or 3x and set the bilinear option to true. It works very well for lowres screens, but unfortunately there's some scaling issue on hires screens that you may or may not notice. |
|
31 March 2018, 16:53 | #16 |
Registered User
Join Date: Oct 2006
Location: USA
Posts: 1,058
|
I tried for a long time to get this to work, and I could get it to work in FS-UAE but not in WinUAE.
http://eab.abime.net/showthread.php?t=89811 It is easy to test by looking at the text - in WinUAE, some pixels are more distorted then others after scaling. On FS-UAE, my shader "sharp-bilinear-simple" works perfectly and has been included in the Git repo already. |
31 March 2018, 17:12 | #17 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
I think there is not enough information, this is more like "it does not work" than including basic config, screenshots and more to describe it exactly. (I am still not sure if I understand what this is really supposed to do and why)
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga and MAC-address filtering | Depeche72 | Amiga scene | 15 | 01 September 2016 16:21 |
Pre-Scaling before Bilinear Scaling? | rsn8887 | request.UAE Wishlist | 6 | 05 September 2015 19:13 |
Integer pre-scale to reduce blurry pixels? | rsn8887 | support.WinUAE | 4 | 10 April 2015 18:11 |
D3D point/bilinear setting trouble | Ami_GFX | support.WinUAE | 4 | 10 December 2014 20:23 |
Off-by-one error with RTG image scaling? | mark_k | support.WinUAE | 10 | 01 December 2013 19:18 |
|
|