MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

Darkfalz
Lurker
Reged: 01/15/04
Posts: 17
Send PM


Demystifying hlsl shadow masks.
#350727 - 02/26/16 04:05 PM


Shadow mask settings for me look different per game resolution and per host PC resolution (differing amounts of vertical moire type patterns etc.). So it seems to be impossible to get them "right". As a result I just put the mask_alpha to 0 and go with 50% vanilla scanlines with defocus as a compromise.

Is there a guide or default that explains all these settings and how to get them "right"? hlsl.txt isn't of much help.

shadow_mask_tile_mode 0
shadow_mask_alpha 0.0
shadow_mask_texture shadow-mask.png
shadow_mask_x_count 6
shadow_mask_y_count 4
shadow_mask_usize 0.1875
shadow_mask_vsize 0.25
shadow_mask_uoffset 0.0
shadow_mask_voffset 0.0



uman
MAME Fan
Reged: 04/15/12
Posts: 455
Send PM


Re: Demystifying hlsl shadow masks. new [Re: Darkfalz]
#350728 - 02/26/16 04:46 PM


> Shadow mask settings for me look different per game resolution and per host PC
> resolution (differing amounts of vertical moire type patterns etc.). So it seems to
> be impossible to get them "right".

It is normal behaviour that shadowmasks look different, on different host PC resolutions. General rule: the higher your display resolution, the better the shadowmask will look, because you have more pixels left to mimic the shadowmask (without scaling it). Also it is possible, to get them "right". If you want better quality shadowmasks, try to increase the x/y prescale factors of the HLSL section. A value of "5" (five) gives a nice, good average and if your graphics card can handle it, you can even try higher values.

I am pretty sure, that in the next release the prescale factors, will be abandoned anyways.

> Is there a guide or default that explains all these settings and how to get them
> "right"? hlsl.txt isn't of much help.

The docs are currently rewritten and i assume there will be better docs very soon.

> shadow_mask_tile_mode 0
> shadow_mask_alpha 0.0
> shadow_mask_texture shadow-mask.png
> shadow_mask_x_count 6
> shadow_mask_y_count 4
> shadow_mask_usize 0.1875
> shadow_mask_vsize 0.25
> shadow_mask_uoffset 0.0
> shadow_mask_voffset 0.0

shadow_mask_tile_mode
is used for the LCD Gameboy shader.

shadow_mask_alpha

is the value for the transparency of the shadowmask. A value of 1.0 is 100% opaque and 0.30 is a good value to start.

shadow_mask_texture

is the name of the texture, that will be used to create the shadowmask. These three shadowmask files are located in the subfolder “artwork” of a MAME install and are used for raster games and colored vector games:

adapture-grill.png
shadow-mask.png
slot-mask.png

Each file represents a different shadowmask.

shadow_mask_x_count
shadow_mask_y_count
shadow_mask_usize
shadow_mask_vsize


These parameters are used to ensure proper alignment and tiling of the texture that is used to generate the shadowmask. HLSL shadowmasks are image-based and are not procedural textures, like mostly used in the OpenGL based pendant shaders.
Therefore it is very important and essential to use correct values.

The following values should be used for the different HLSL shadowmasks:

------------- shadow-mask settings ----------------

shadow_mask_texture shadow-mask.png
shadow_mask_x_count 6
shadow_mask_y_count 4
shadow_mask_usize 0.1875
shadow_mask_vsize 0.25

--------------- slot-mask settings ----------------

shadow_mask_texture slot-mask.png
shadow_mask_x_count 6
shadow_mask_y_count 6
shadow_mask_usize 0.1875
shadow_mask_vsize 0.1875

------------- adapture-grill settings -------------

shadow_mask_texture adapture-grill.png
shadow_mask_x_count 6
shadow_mask_y_count 6
shadow_mask_usize 0.1875
shadow_mask_vsize 0.1875



shadow_mask_uoffset
shadow_mask_voffset


These values move the shadowmask in sub-pixel range Only useful for developing and investigating. Leave it at Zero (default).



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9716
Loc: ECV-197 The Orville
Send PM


Re: Demystifying hlsl shadow masks. new [Re: uman]
#350730 - 02/26/16 06:26 PM


> try to increase the x/y prescale factors of the HLSL section. A
> value of "5" (five) gives a nice, good average and if your graphics card can handle
> it, you can even try higher values.

Be careful: it helps to know what prescale actually *does*. It blows up the game image by the factor specified, so a 320x240 game becomes 1600x1200 worth of pixels before the final stretch/filter, and you don't want to go past the resolution of your monitor. So for a 720P monitor or a 1366x768 laptop prescale 5 would be a bit excessive.



Jezze
Reged: 03/14/05
Posts: 72
Send PM


Re: Demystifying hlsl shadow masks. new [Re: Darkfalz]
#350731 - 02/26/16 06:32 PM


This issue have been discussed here recently and I'm working on it.

If you know how to compile MAME, you can checkout my branch on GitHub and test it yourself.



uman
MAME Fan
Reged: 04/15/12
Posts: 455
Send PM


Re: Demystifying hlsl shadow masks. new [Re: R. Belmont]
#350734 - 02/26/16 08:12 PM


> Be careful: it helps to know what prescale actually *does*. It blows up the game
> image by the factor specified, so a 320x240 game becomes 1600x1200 worth of pixels
> before the final stretch/filter, and you don't want to go past the resolution of your
> monitor. So for a 720P monitor or a 1366x768 laptop prescale 5 would be a bit
> excessive.

While in theory, there is nothing wrong with what you say, but in case of the shadowmasks, it is wrong. The higher the prescale, the better the look of the shadowmasks. With 1080p on my laptop and a prescale of 6 or 7, all moire effects are gone.
If you want to get rid of moire effects, there is simply no other solution or turn it off at all (not recommended).

Edited by uman (02/26/16 08:17 PM)



Darkfalz
Lurker
Reged: 01/15/04
Posts: 17
Send PM


Re: Demystifying hlsl shadow masks. new [Re: uman]
#350999 - 03/03/16 05:47 PM


> > Shadow mask settings for me look different per game resolution and per host PC
> > resolution (differing amounts of vertical moire type patterns etc.). So it seems to
> > be impossible to get them "right".
>
> It is normal behaviour that shadowmasks look different, on different host PC
> resolutions. General rule: the higher your display resolution, the better the
> shadowmask will look, because you have more pixels left to mimic the shadowmask
> (without scaling it). Also it is possible, to get them "right". If you want better
> quality shadowmasks, try to increase the x/y prescale factors of the HLSL section. A
> value of "5" (five) gives a nice, good average and if your graphics card can handle
> it, you can even try higher values.
>
> I am pretty sure, that in the next release the prescale factors, will be abandoned
> anyways.
>
> > Is there a guide or default that explains all these settings and how to get them
> > "right"? hlsl.txt isn't of much help.
>
> The docs are currently rewritten and i assume there will be better docs very soon.
>
> > shadow_mask_tile_mode 0
> > shadow_mask_alpha 0.0
> > shadow_mask_texture shadow-mask.png
> > shadow_mask_x_count 6
> > shadow_mask_y_count 4
> > shadow_mask_usize 0.1875
> > shadow_mask_vsize 0.25
> > shadow_mask_uoffset 0.0
> > shadow_mask_voffset 0.0
>
> shadow_mask_tile_mode is used for the LCD Gameboy shader.
>
> shadow_mask_alpha
>
> is the value for the transparency of the shadowmask. A value of 1.0 is 100% opaque
> and 0.30 is a good value to start.
>
> shadow_mask_texture
>
> is the name of the texture, that will be used to create the shadowmask. These three
> shadowmask files are located in the subfolder “artwork” of a MAME install and are
> used for raster games and colored vector games:
>
> adapture-grill.png
> shadow-mask.png
> slot-mask.png
>
> Each file represents a different shadowmask.
>
> shadow_mask_x_count
> shadow_mask_y_count
> shadow_mask_usize
> shadow_mask_vsize
>
> These parameters are used to ensure proper alignment and tiling of the texture that
> is used to generate the shadowmask. HLSL shadowmasks are image-based and are not
> procedural textures, like mostly used in the OpenGL based pendant shaders.
> Therefore it is very important and essential to use correct values.
>
> The following values should be used for the different HLSL shadowmasks:
>
> ------------- shadow-mask settings ----------------
>
> shadow_mask_texture shadow-mask.png
> shadow_mask_x_count 6
> shadow_mask_y_count 4
> shadow_mask_usize 0.1875
> shadow_mask_vsize 0.25
>
> --------------- slot-mask settings ----------------
>
> shadow_mask_texture slot-mask.png
> shadow_mask_x_count 6
> shadow_mask_y_count 6
> shadow_mask_usize 0.1875
> shadow_mask_vsize 0.1875
>
> ------------- adapture-grill settings -------------
>
> shadow_mask_texture adapture-grill.png
> shadow_mask_x_count 6
> shadow_mask_y_count 6
> shadow_mask_usize 0.1875
> shadow_mask_vsize 0.1875
>
>
> shadow_mask_uoffset
> shadow_mask_voffset
>
> These values move the shadowmask in sub-pixel range Only useful for developing and
> investigating. Leave it at Zero (default).

Thanks for this. It looks better with prescale, but still moire - might be unavoidable with only a 768 display as I am testing currently. I read something about an auto-prescale option in future which would be great. My integrated graphics can only manage up to 3, NVIDIA GPU about 6 is okay.



Darkfalz
Lurker
Reged: 01/15/04
Posts: 17
Send PM


Re: Demystifying hlsl shadow masks. new [Re: R. Belmont]
#351002 - 03/03/16 06:05 PM


> > try to increase the x/y prescale factors of the HLSL section. A
> > value of "5" (five) gives a nice, good average and if your graphics card can handle
> > it, you can even try higher values.
>
> Be careful: it helps to know what prescale actually *does*. It blows up the game
> image by the factor specified, so a 320x240 game becomes 1600x1200 worth of pixels
> before the final stretch/filter, and you don't want to go past the resolution of your
> monitor. So for a 720P monitor or a 1366x768 laptop prescale 5 would be a bit
> excessive.

The higher I go the better it looks. I discovered this makes vanilla scanlines look better too. But unfortunately even if I leave shadow_mask blank or set alpha to 0, it still has the performance hit. Maybe the performance hit is all from the prescale not the blending? It would be nice to save rendering cycles blending an invisble shadow mask.



Jezze
Reged: 03/14/05
Posts: 72
Send PM


Re: Demystifying hlsl shadow masks. new [Re: Darkfalz]
#351008 - 03/03/16 07:17 PM


The blending does not hit the performance at all. But it makes a big difference if you sample 1600x1200 pixel based on a pre-scale of 5 or if you sample only 1366x768 based on your screen resolution.



Traso
MAME Fan
Reged: 01/15/13
Posts: 2687
Send PM


Re: Demystifying hlsl shadow masks. new [Re: Darkfalz]
#351285 - 03/07/16 11:32 PM


> ...might be unavoidable with only a 768 display as I am testing currently.


If your resolution isn't at least 1600x1200, it doesn't count.



Scifi frauds. SF illuminates.
_________________

Culture General Contact Unit (Eccentric)


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 530 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2418