|
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
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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: 9717
|
Loc: ECV-197 The Orville
|
|
Send PM
|
|
|
Re: Demystifying hlsl shadow masks.
[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.
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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.
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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)
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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.
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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.
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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.
|
|
|
|
Re: Demystifying hlsl shadow masks.
[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)
|
|