English Amiga Board Amiga Lore


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 17 September 2016, 23:59   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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.]
Attached Thumbnails
Click image for larger version

Name:	WB_1024x768.png
Views:	95
Size:	14.6 KB
ID:	50010   Click image for larger version

Name:	Scale_up_1.5x_to_1536x1152.png
Views:	88
Size:	59.9 KB
ID:	50011   Click image for larger version

Name:	Scale_up_2x_down_to_1536x1152.png
Views:	100
Size:	35.5 KB
ID:	50012  
mark_k is offline  
AdSense AdSense  
Old 21 September 2016, 18:46   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,542
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..
Toni Wilen is offline  
Old 21 September 2016, 18:55   #3
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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?
mark_k is offline  
Old 21 September 2016, 18:58   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,542
Quote:
Originally Posted by mark_k View Post
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?
That scaling is just final "blit" to display (with different source and destination rectangles), can't do it twice (or more).
Toni Wilen is offline  
Old 21 September 2016, 19:08   #5
Locutus
Registered User

 
Join Date: Jul 2014
Location: Finland
Posts: 714
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.
Locutus is offline  
Old 21 September 2016, 19:27   #6
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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.
mark_k is offline  
Old 21 September 2016, 20:12   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,542
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.
Toni Wilen is offline  
Old 02 October 2016, 17:52   #8
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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;
};
On trying to use that filter with the attached config, starting emulation gives a black screen and this over and over in the log:
D3D9Ex: SetTechnique: 8876086C S=1 F=0876 C=086C (2156) ()

Any idea what I'm doing wrong?
Attached Files
File Type: zip PointFilter.zip (863 Bytes, 23 views)
File Type: zip my_test_JIT_uaegfx_FilterTest.zip (2.7 KB, 21 views)
mark_k is offline  
Old 02 October 2016, 20:46   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,542
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.
Toni Wilen is offline  
Old 02 October 2016, 21:23   #10
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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
Attached Files
File Type: txt prescale.fx.txt (2.9 KB, 26 views)
mark_k is offline  
Old 03 October 2016, 22:01   #11
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
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:
  • Original_unscaled.png (9776 bytes) - unscaled image
  • WinUAE_1.5x_null_bilinear.png (206293 bytes) - WinUAE display with only null filter, 1.5x scaling, bilinear
  • WinUAE_2x_point_1.5x_null_bilinear.png (141669 bytes) - WinUAE display with 2x point.fx shader then null filter bilinear to 1.5x (less blurry)
  • mtpaint_2x_to_1.5x_bilinear.png (25706 bytes) - Original image, scaled up to 2x (point) then down to 1.5x bilinear with mtpaint paint package
  • mtpaint_3x_to_1.5x_bilinear.png (23326 bytes) - Original image, scaled up to 3x (point) then down to 1.5x bilinear with mtpaint.

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.
Attached Thumbnails
Click image for larger version

Name:	Original_unscaled.png
Views:	40
Size:	9.5 KB
ID:	50289   Click image for larger version

Name:	WinUAE_1.5x_null_bilinear.png
Views:	37
Size:	201.5 KB
ID:	50290   Click image for larger version

Name:	WinUAE_2x_point_1.5x_null_bilinear.png
Views:	40
Size:	138.3 KB
ID:	50291   Click image for larger version

Name:	mtpaint_2x_to_1.5x_bilinear.png
Views:	47
Size:	25.1 KB
ID:	50292   Click image for larger version

Name:	mtpaint_3x_to_1.5x_bilinear.png
Views:	33
Size:	22.8 KB
ID:	50293  

Attached Files
File Type: zip Config_and_shader.zip (4.1 KB, 19 views)

Last edited by mark_k; 03 October 2016 at 22:10.
mark_k is offline  
AdSense AdSense  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:34.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.22043 seconds with 12 queries