Finish describing video shader issues.

This commit is contained in:
Tim Allen
2017-08-12 15:09:15 +10:00
parent 1ae228663d
commit 5f67b2a8fc

View File

@@ -3,10 +3,8 @@ are similar in many ways,
but some of them do have particular quirks but some of them do have particular quirks
that you should be aware of. that you should be aware of.
Video Shaders and the Super Famicom (and Mega Drive) Video Shaders and TV-based consoles
---------------------------------------------------- -----------------------------------
Shaders look weird on Super Famicom because of interlace/hi-res
[Video Shaders](guides/shaders.md) [Video Shaders](guides/shaders.md)
customize how higan scales customize how higan scales
@@ -22,46 +20,69 @@ try to produce higher-quality output
by recognising particular patterns of pixel, by recognising particular patterns of pixel,
like taking three diagonal pixels like taking three diagonal pixels
and turning that into a smooth diagonal line. and turning that into a smooth diagonal line.
These shaders assume that These shaders assume that
each pixel drawn by the game's artists each pixel drawn by the game's artists
is a single pixel in the video output they analyze. becomes a single pixel in the video output they analyze.
Many of the consoles higan emulates
Most of the consoles higan emulates
can only output video at one specific resolution, can only output video at one specific resolution,
so this "one pixel equals one pixel" rule holds true, so this "one pixel equals one pixel" rule holds true,
and shaders like "xBR" work just fine. and pattern-based shaders like "xBR" work just fine.
Unfortunately, Unfortunately,
this is not the case for the Super Famicom. this is not the case for the Super Famicom.
The "normal" video mode
The "normal" video mode for the Super Famicom
draws 256 pixels across the width of the screen, draws 256 pixels across the width of the screen,
but it also supports a "hi-res" mode but the "high resolution" mode draws 512.
that draws 512 pixels on each line. Since Super Famicom games can enable hi-res mode at any time
Since Super Famicom games can enable hi-res mode at any time, (even halfway through a frame),
even halfway through a frame, higan always renders Super Famicom video output 512 pixels wide,
higan always renders Super Famicom video output at 512 pixels wide, just in case.
just in case hi-res mode is enabled later on.
This means that in "normal" mode, This means that in "normal" mode,
each pixel drawn by the game's artists each pixel drawn by the game's artists
becomes two pixels in the video output, becomes two pixels in the video output,
breaking the assumption pattern-based shaders are based on. breaking the assumption
that pattern-based shaders are based on.
The Super Famicom has a similar issue in the vertical direction: The Super Famicom has a similar issue in the vertical direction:
normally, normally,
an NTSC-based Super Famicom draws 238 rows of output, an NTSC-based Super Famicom draws about 240 rows of output every frame,
~60 times per second. sometimes referred to as "240p" video.
This is sometimes referred to as "240p" video.
When a game turns on "interlaced" mode, When a game turns on "interlaced" mode,
it draws ~480 lines of output, it draws the 240 odd-numbered lines of one frame,
~30 times a second; then the 240 even-numbered lines of the next,
first the ~240 odd-numbered lines, and so forth.
then going back to the top and drawing the ~240 even-numbered lines.
This is sometimes referred to as "480i" video. 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.
TODO: https://board.byuu.org/viewtopic.php?p=44758#p44758 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).
This also affects the PC Engine: The PC Engine does not support an interlaced mode,
https://board.byuu.org/viewtopic.php?p=44779#p44779 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 Music and Sound Effect Volume on the Mega Drive
----------------------------------------------- -----------------------------------------------