Monday, 7 November 2011

NEW JClampy's 320x240 resolution 4x magnification MAME HLSL Setup

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Finding correct settings that work with each different resolution is a long, difficult, and slow
process. If you think you can contribute or help with this process then please contact me.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please do not steal or plagiarism my work or settings without crediting me. Otherwise I will
take everything offline for my private friends and personal use only. I have put alot of time
and effort into all of this and would prefer if people would just point others towards my blog.

Special credit/thanks to Ryan Holtz aka 'Just Desserts', Bat Country Entertainment, cgwg and all those involved in creating and maintaining the HLSL filter for MAME and MESS.
Tested with versions 0.143u5 through to 0.143u9
I can now confirm that Version 2.0 is fully compatible with 320x240 resolution games, both Horizontally orientated and Vertically(240x320) orientated. After indepth research and testing there is only one way to get HLSL working properly with these games, the following instructions will show you how:

Version 2.0
* Super High Quality .png files.
* Perfect 'tiling' pattern ensures no gradient or banding artifacts with horizontal or vertical scrolling games.
* No 'warping' or 'pinching' effects ensure a crystal clear game image that is easier to look at.

First you need to choose whether you want a 'shadow mask' or an 'aperture grille' pattern. I recommend the 'shadow mask' when used without scanlines and the 'aperture grille' with scanlines. The 'shadow mask' creates a honeycomb type of pattern which is great by itself. Whereas if you prefer a crosshatch pattern then an 'aperture grille' when combined with scanlines will accomplish this. A 'shadow mask' without scanlines is my current personal preference.

ShadowMask = JClampy_ShadowMask4x_v2.0.png
ApertureGrille = JClampy_ApertureGrille4x_v2.0.png
Both included in file here: http://www.mediafire.com/?u9ea8yj9883akhe
(They are the same files as Version 2.0 from my NEO GEO blog section just named differently. If you already have those then you can use them for 320x240 games as well if you want.)

I have a square screen, not a widescreen, so have not tested with widescreen displays. If you use a widescreen and can't get desired effects then first try running MAME in a window and not fullscreen. If that does not work then you may have to use MAME's 'Border Artwork' feature to get the game image displayed in a correct aspect ratio window. I plan to release some custom widescreen borders tomorrow. Also, if you have not used HLSL before you might like to read my quick start guide here; http://gamingnos.blogspot.com/2011/10/quick-start-mame-hlsl-filter-guide-up.html

These settings should be set like this when using HLSL:
mame.ini
effect              none     (old visual effects off, aka 'visual effects')
scale_effect     none     (old visual effects off, not in all MAME variants, aka 'image enhancement')
switchres           1        (enable resolution settings, aka 'switch resolutions to fit')
sleep                 0        (power saving sleep mode off, aka 'sleep when possible')
video               d3d       (video output method set to Direct3D)
keepaspect        1         (maintain aspect ratios, aka 'enforce aspect ratio')
prescale             1        (no software prescale, aka 'scale screen')
hwstretch           0        (hardware stretching off)
d3dversion         9        (Direct3D version 9 required when using the HLSL filter)
filter                  0        (bilinear filtering off)
artwork_crop      0        (crop border artwork off)

For all 320x240 Horizontally orientated games run at a 4x magnification for final resolution output of 1280x960:
mame.ini
aspect ratio      4:3       (correct aspect ratio for our final display output)
resolution    1280x960   (our final display output resolution)
view     pixel aspect *OR* standard  (both options will give the same 4:3 or 3:4 ratio with 320x240 games)

hlsl.ini
hlsl_prescale_x         2      (2x zoom by video hardware)
hlsl_prescale_y         4      (4x zoom by video hardware)
hlsl_snap_width     1280    (rendered snapshots resolution must be the same width as our display output)
hlsl_snap_height     960     (rendered snapshots resolution must be the same height as our display output)
shadow_mask_alpha      0.250000     (my personal preference when not using scanlines)
shadow_mask_texture     JClampy_ShadowMask4x_v2.0.png *OR* JClampy_ApertureGrille4x_v2.0.png
shadow_mask_x_count       1
shadow_mask_y_count       2
shadow_mask_usize      1.000000
shadow_mask_vsize      0.750000
curvature       0.000000      (I recommend disabling this unless you like the moirĂ© effect)
pincushion      0.000000     (I recommend disabling this unless you like the moirĂ© effect)

Caveats:
1. 'hlsl_prescale_x' & 'hlsl_prescale_y' preferably you should use either 2, 3, or 4. I advise against 1 as it produced blurriness and 0 disables prescale altogether. Having an 'x' of 2 and 'y' of 4 creates a nice balanced image. Both 'x' & 'y' at 4 increases image sharpness, whereas both 'x' & 'y' at 2 increases image softness.
2. Although these may work in different combinations, you will probably notice a sharp reduction in quality if you change any of the following settings;
final display aspect ratio of 4:3 at resolution 1280x960 with hlsl_snap_width of 1280 and hlsl_snap_height of 960
shadow_mask_x_count       1
shadow_mask_y_count       2
shadow_mask_usize         1.000000
shadow_mask_vsize          0.750000
3. You can safely change the following setting to your own personal preference;
shadow_mask_alpha         0.250000
4. Due to the fact that 'standard 4:3' view or 'stretched'/'chopped'/'cocktail' views distort the display of the shadow mask or aperture grille .png files it is advised only to use the 'pixel aspect' view or use my custom borders.

If you would like scanlines (especially nice with an aperture grille), here are my personal preference settings;
hlsl.ini
shadow_mask_alpha         0.100000        (I recommend using a lower number for the shadow mask or aperture grille when using scanlines)
scanline_alpha                 0.400000        (visibility of scanlines; I recommend making them appear stronger than the shadow mask or aperture grille)
scanline_size                   1.000000        (this means that every row of pixels will have it's own scanline; ratio of scanlines to image lines)
scanline_height                0.400000        (I recommend using thin scanlines that do not cover too much of the original games image)
scanline_bright_scale        1.000000        (brightness of the non scanlined areas. I recommend leaving this setting at 1)
scanline_bright_offset       0.000000        (unknown, not needed at the moment)
scanline_jitter                  0.000000        (I don't use, makes scanlines shimmer up and down; can cause nausea for some people)

Here are the rest of my personal preference settings;
hlsl.ini
defocus                   0.000000,0.000000        (I don't use defocus as it only adds blurriness to your game image)
converge_x              0.000000,0.000000,0.000000        (I don't use, suppose to offset pixel position by colours)
converge_y              0.000000,0.000000,0.000000        (I don't use, suppose to offset pixel position by colours)
radial_converge_x     0.000000,0.000000,0.000000        (I don't use, suppose to offset pixel position by colours)
radial_converge_y     0.000000,0.000000,0.000000        (I don't use, suppose to offset pixel position by colours)
red_ratio                 1.000000,0.000000,0.000000        (leave alone, red ratio 100%)
grn_ratio                 0.000000,1.000000,0.000000        (leave alone, green ratio 100%)
blu_ratio                 0.000000,0.000000,1.000000        (leave alone, blue ratio 100%)
saturation               1.100000                      (this controls saturation, how strong colours look/bleed, don't set too high or colours get distorted)
offset                     0.000000,0.000000,0.000000        (I don't use, suppose to offset strength of red,blue,green)
scale                      1.050000,1.050000,1.050000        (this controls brightness control, don't set too high or colours get distorted)
power                     1.150000,1.150000,1.150000        (this controls contrast control, where 1.0 = 100%)
floor                       0.000000,0.000000,0.000000        (this controls gamma control, I don't use it as colours get washed out, if you set it too high colours get distorted)
phosphor_life           0.200000,0.200000,0.200000        (can create a ghosting effect on fast moving pixels, up to you if you like or not?)

The game will be shown in correct aspect ratio at correct resolution of 4x magnification and look like this:
This is a screenshot of an 'shadow mask without scanlines'
But what about Vertically orientated games, how do I get them looking perfect?
For all 320x240 Vertically orientated (240x320) games run at a 4x magnification for final resolution output of 1280x960:
Unfortunately there is only one way to get a perfect distortion free HLSL image with Vertically orientated games. You must have a monitor that you can move to a vertical position. If your monitor does not rotate but is wall mounted then perhaps you could investigate if you can get a vertical mounting bracket. My monitor can be rotated and these are the steps I follow to get a perfect image;
1. Follow exactly the same instructions as for Horizontally orientated games.
2. Once you have the game running in MAME for the first time, you need to press the [Tab] key to bring up the 'in-game menu'. Then select and [Enter] into the 'video options' sub menu. From here you can select the 'Rotate' option and change it to either 'CCW 90degrees' or 'CW 90degrees'. Press the [Tab] key again to exit out of the 'in-game menu'. MAME will remember your selection from now on.

Your game would look like this before monitor rotation:
This is a screenshot of an 'shadow mask without scanlines'
Your game would look like this after monitor rotation:
This is a screenshot of an 'shadow mask without scanlines'
How Do I Know If Everything Is Working As It Should be?
Here are some screenshots that show you what it looks like when everything is working properly and when it is not: http://www.mediafire.com/?15yc6j7zvaumucv   Notice there is no banding of the displayed 'overlay' when it is working properly.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Finding correct settings that work with each different resolution is a long, difficult, and slow
process. If you think you can contribute or help with this process then please contact me.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please do not steal or plagiarism my work or settings without crediting me. Otherwise I will
take everything offline for my private friends and personal use only. I have put alot of time
and effort into all of this and would prefer if people would just point others towards my blog.


Special credit/thanks to Ryan Holtz aka 'Just Desserts', Bat Country Entertainment, cgwg and all those involved in creating and maintaining the HLSL filter for MAME and MESS.

No comments:

Post a Comment