More cleanups.

This commit is contained in:
Tim Allen 2017-08-26 15:17:15 +10:00
parent afa8ea61c5
commit c273297577
3 changed files with 136 additions and 146 deletions

View File

@ -1,29 +1,41 @@
Most of the consoles higan emulates
were designed for the low resolution of NTSC televisions,
and their video output is often chunky and blocky
were designed for low resolution NTSC televisions,
and their video output is chunky and blocky
by today's standards.
Shaders customise how a console's video output
Video shaders customise how a console's video output
is drawn to the computer screen,
and can apply just about any effect you can imagine.
and can clean up and smooth out the original video,
reproduce the scanlines and blurring of the original display,
or any other visual effect.
Most [drivers](drivers.md)
only support these shaders
(some only support one or the other):
The available video shaders are listed in
the "Video Shaders" submenu of
[the Settings menu](../interface/higan.md#the-settings-menu).
Which shaders are available depends on
[video driver](drivers.md#video) higan is configured to use.
Most drivers only support these shaders:
- **None** draws each computer pixel
in the same colour as the nearest console pixel.
This is sometimes called "nearest neighbour scaling",
and produces crisp, blocky output.
- **Blur** draws each computer pixel
as the weighted average colour
- **None**
draws each computer pixel according to
the colour of the single nearest console pixel,
sometimes called "nearest neighbour" scaling.
This produces unnaturally crisp and blocky images.
- If you use [aspect correction or non-integral scaling][ac],
neighbouring console pixels may be drawn
with a different number of computer pixels due to rounding errors,
causing a distracting rippling effect.
- **Blur**
draws each computer pixel according to
the weighted average colour
of the four nearest console pixels.
This is sometimes called "bilinear scaling",
and hides some of the blockiness
at the expense of blurring edges.
averaging the colours of the four nearest console pixels,
sometimes called "bilinear" scaling.
This produces unnaturally blurry images.
However,
the OpenGL driver supports custom shaders,
in addition to the above.
[ac]: ../interface/higan-settings.md#video
In addition to those,
the OpenGL driver also supports custom shaders.
**Note:**
For technical reasons,
@ -32,9 +44,12 @@ can produce surprising behaviour
in certain shaders,
particularly shaders that compare each console pixel
with its neigbours.
See [Console-specific Notes](../notes.md) for details.
See [Video Shaders and TV-based consoles][vstv] for details.
# Where to get shaders
[vstv]: #video-shaders-and-tv-based-consoles
Where to get custom shaders
---------------------------
- higan includes some simple example shaders.
If your copy of higan did not come with shaders,
@ -44,7 +59,8 @@ See [Console-specific Notes](../notes.md) for details.
contains many high-quality shaders for use with higan.
- You can write your own.
# How to install shaders
How to install custom shaders
-----------------------------
Make sure the shader you want to install
is in the correct format:
@ -68,10 +84,10 @@ Launch higan,
open the Settings menu,
and choose "Advanced ..."
to open [the Advanced tab](../interface/higan-settings.md#advanced)
of the Settings dialog.
of the Settings window.
Under "Driver Selection",
make sure "Video" is set to "OpenGL".
If you changed the video driver,
If it wasn't already set that way,
you'll need to restart higan
for the change to take effect.
@ -81,31 +97,27 @@ and now the shaders you installed
should be listed at the bottom of the menu.
Load a game
(so you can see the results)
and switch between shaders
to see what they do
(so you can see the results),
switch between shaders
to see what they do,
and pick your favourite!
# Notable examples
Notable examples
----------------
The quark-shaders repository
The quark-shaders repository mentioned above
contains lots of carefully-crafted shaders,
but some are particularly noteworthy:
- **AANN** implements "anti-aliased nearest neighbour" scaling.
If the console's video is not displayed
at an exact multple of the console's native resolution,
rounding errors cause normal nearest-neighbour scaling
to draw some rows and columns wider than others,
which many people find ugly and distracting.
This is very common when
higan's aspect-ratio correction mode
is enabled.
AANN uses very slight anti-aliasing
to hide the rounding errors,
leaving the overall image as crisp as nearest-neighbour.
- **Gameboy** emulates the squarish aspect-ratio
greenish-colours
This uses anti-aliasing to hide
the rounding errors often introduced by
aspect ratio correction
and non-integral scaling,
producing an image nearly as crisp as the "None" shader,
but without the distracting ripple effect.
- **Gameboy** emulates the squarish aspect-ratio,
greenish-colours,
and limited palette
of the original Game Boy.
At larger scales,
@ -120,7 +132,85 @@ but some are particularly noteworthy:
and shimmer
that most game players would have seen
on real televisions.
This is important because
some games depended on NTSC artifacts
Some games depend on NTSC artifacts
to display colours outside the console's official palette
or to create effects like transparency.
Video Shaders and TV-based consoles
-----------------------------------
Simple shaders
(like "None"
and the third-party "AANN" shader)
just blindly scale up the images they're given,
but sophisticated shaders
(such as the third-party "xBR" shader)
try to produce higher-quality output
by recognising particular patterns,
like taking three diagonal pixels
and turning that into a smooth diagonal line.
These shaders assume that
each pixel drawn by the game's artists
becomes a single pixel in the video output they analyze.
The hand-held consoles that higan emulates
(and also the Famicom)
can only output video at one specific resolution,
so this "one pixel equals one pixel" rule holds true,
and pattern-based shaders like "xBR" work just fine.
Unfortunately,
this is not true for most of the TV-based consoles
that higan supports.
The Super Famicom's "normal" video mode
draws 256 pixels across the width of the screen,
but the "high resolution" mode draws 512.
Since Super Famicom games can enable hi-res mode at any time
(even halfway through a frame),
higan always renders Super Famicom video output 512 pixels wide,
just in case.
This means that in "normal" mode,
each pixel drawn by the game's artists
becomes two pixels in the video output,
breaking the assumption
that pattern-based shaders are based on.
The Super Famicom has a similar issue in the vertical direction:
normally,
an NTSC-based Super Famicom draws about 240 rows of output every frame,
sometimes referred to as "240p" video.
When a game turns on "interlaced" mode,
it draws the 240 odd-numbered lines of one frame,
then the 240 even-numbered lines of the next,
and so forth.
This is sometimes referred to as "480i" video.
Although interlaced mode cannot be enabled mid-frame
like high-resolution mode,
resolution switching is still complex,
so higan always draws all 480 lines of video output.
This means for a normal, non-interlaced game,
each pixel drawn by the game's artists
becomes four pixels in the video output
(two horizontally and two vertically)
making pattern-based shaders even less useful.
It also breaks most scanline-emulation shaders,
since they typically draw a scanline
for each row of pixels in the video output.
The Mega Drive has similar problems
to the Super Famicom.
It has the same behaviour with interlacing,
but its high-resolution mode switches
from 256 pixels across to 320 pixels across.
Therefore in normal mode,
each pixel drawn by the game's artists
becomes five pixels in the video output,
while in high-resolution mode,
each pixel drawn by the game's artists
becomes four pixels in the video output
(or 10 and 8 pixels in non-interlaced mode).
The PC Engine does not support an interlaced mode,
but its horizontal resolution is much more flexible
than the Super Famicom or Mega Drive,
and so it has the same problems with shaders as those consoles.

View File

@ -144,27 +144,8 @@ that aren't technically part of the console itself:
**Video Shader** controls
how the low-resolution video output of the emulated console
is scaled up to suit modern high-resolution displays.
The availability of items in this submenu depends on
which video driver higan is using,
so see [Choosing drivers](../guides/drivers.md) for more information.
- **None**
draws each output pixel according to
the colour of the single nearest input pixel,
sometimes called "nearest neighbour" scaling.
This produces unnaturally crisp and blocky images.
- **Blur**
draws each output pixel by
averaging the colours of the four nearest input pixels,
sometimes called "bilinear" scaling.
This produces unnaturally blurry images.
- When using the OpenGL driver,
an additional item appears in this menu for
each installed shader.
See [Using video shaders](../guides/shaders.md)
for details.
[Using video shaders](../guides/shaders.md)
describes all the options in this submenu.
**Synchronize Audio**
causes higan to wait for audio playback to complete

View File

@ -3,87 +3,6 @@ are similar in many ways,
but some of them do have particular quirks
that you should be aware of.
Video Shaders and TV-based consoles
-----------------------------------
[Video Shaders](guides/shaders.md)
customize how higan scales
the low-resolution video of the emulated console
up to the high-resolution of the computer display.
Simple shaders
(like "None"
and the third-party "AANN" shader)
just blindly scale up the images they're given,
but sophisticated shaders
(such as the third-party "xBR" shader)
try to produce higher-quality output
by recognising particular patterns of pixel,
like taking three diagonal pixels
and turning that into a smooth diagonal line.
These shaders assume that
each pixel drawn by the game's artists
becomes a single pixel in the video output they analyze.
Many of the consoles higan emulates
can only output video at one specific resolution,
so this "one pixel equals one pixel" rule holds true,
and pattern-based shaders like "xBR" work just fine.
Unfortunately,
this is not the case for the Super Famicom.
The "normal" video mode
draws 256 pixels across the width of the screen,
but the "high resolution" mode draws 512.
Since Super Famicom games can enable hi-res mode at any time
(even halfway through a frame),
higan always renders Super Famicom video output 512 pixels wide,
just in case.
This means that in "normal" mode,
each pixel drawn by the game's artists
becomes two pixels in the video output,
breaking the assumption
that pattern-based shaders are based on.
The Super Famicom has a similar issue in the vertical direction:
normally,
an NTSC-based Super Famicom draws about 240 rows of output every frame,
sometimes referred to as "240p" video.
When a game turns on "interlaced" mode,
it draws the 240 odd-numbered lines of one frame,
then the 240 even-numbered lines of the next,
and so forth.
This is sometimes referred to as "480i" video.
Although interlaced mode cannot be enabled mid-frame
like high-resolution mode,
resolution switching is still complex,
so higan always draws all 480 lines of video output.
This means for a normal, non-interlaced game,
each pixel drawn by the game's artists
becomes four pixels in the video output
(two horizontally and two vertically)
making pattern-based shaders even less useful.
It also breaks most scanline-emulation shaders,
since they typically draw a scanline
for each row of pixels in the video output.
The Mega Drive has similar problems
to the Super Famicom.
It has the same behaviour with interlacing,
but its high-resolution mode switches
from 256 pixels across to 320 pixels across.
Therefore in normal mode,
each pixel drawn by the game's artists
becomes five pixels in the video output,
while in high-resolution mode,
each pixel drawn by the game's artists
becomes four pixels in the video output
(or 10 and 8 pixels in non-interlaced mode).
The PC Engine does not support an interlaced mode,
but its horizontal resolution is much more flexible
than the Super Famicom or Mega Drive,
and so it has the same problems with shaders.
Music and Sound Effect Volume on the Mega Drive
-----------------------------------------------