• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › General Discussion v
« Previous 1 ... 70 71 72 73 74 ... 369 Next »

Possible to create a NTSC S-Video shader for Dolphin?
View New Posts | View Today's Posts

Pages (2): 1 2 Next »
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Possible to create a NTSC S-Video shader for Dolphin?
08-22-2017, 10:42 PM (This post was last modified: 08-23-2017, 04:46 PM by Maverick Hunter X.)
#1
Maverick Hunter X Offline
さようなら
****
Posts: 331
Threads: 23
Joined: Apr 2011
So I have been playing around with the RetroArch Dolphin core at native resolution and slapped a NTSC S-Video shader on it and I liked the result very much!

Spoiler: (Show Spoiler)
[Image: NTSC_S-_Video-_Shader.png]

Would it be possible to create a shader with similar output for the standalone version of Dolphin?

The RetroArch Dolphin core is far far away from being close to stable at this point but when I tried it out with this shader I was hooked, I really like the authentic look.

EDIT: Seems like Dolphin is using .glsl shaders just like RetroArch but using the ones from RetroArch did nothing, just a black screen.
Find
Reply
08-23-2017, 05:47 PM
#2
Shonumi Offline
Linux User/Tester
**********
Administrators
Posts: 6,512
Threads: 55
Joined: Dec 2011
(08-22-2017, 10:42 PM)Maverick Hunter X Wrote: Would it be possible to create a shader with similar output for the standalone version of Dolphin?

Yes. It'd just take a fair amount of effort, but there shouldn't be anything inherently impossible about it, as far as I understand it.

(08-22-2017, 10:42 PM)Maverick Hunter X Wrote: EDIT: Seems like Dolphin is using .glsl shaders just like RetroArch but using the ones from RetroArch did nothing, just a black screen.

Generally, you really can't copy+paste shaders like that between two programs, not unless they know how their shaders are structured and what kind of input they need and output they give.
Website Find
Reply
08-23-2017, 06:00 PM
#3
degasus Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 1,828
Threads: 10
Joined: May 2012
In fact, you can almost copy&paste such postprocessing shaders, as long as they use the same amount of features. eg Dolphin lacks all kind of geometry manipulation and multi-pass shaders (sadly) and we refuse to provide hacks to access the depth buffer. But for such a NTSC shader, I see no need for such features. It should be a simple texture in image out shader - as supported by dolphin.
Just pick a few as reference: https://github.com/dolphin-emu/dolphin/tree/master/Data/Sys/Shaders
And port the retroarch shader to our syntax.
Find
Reply
08-23-2017, 07:33 PM
#4
Maverick Hunter X Offline
さようなら
****
Posts: 331
Threads: 23
Joined: Apr 2011
Looking at https://github.com/libretro/glsl-shaders/blob/master/ntsc/ntsc-320px-svideo.glslp which is the one I used for the RetroArch Dolphin core there is two .glsl shaders used, ntsc-pass1-svideo-2phase.glsl and ntsc-pass2-2phase-gamma.glsl

This is a stub taken from ntsc-pass1-svideo-2phase.glsl

Code:
#version 130

#define TWO_PHASE
#define SVIDEO

// begin params
#define PI 3.14159265

#if defined(TWO_PHASE)
    #define CHROMA_MOD_FREQ (4.0 * PI / 15.0)
#elif defined(THREE_PHASE)
    #define CHROMA_MOD_FREQ (PI / 3.0)
#endif

#if defined(COMPOSITE)
    #define SATURATION 1.0
    #define BRIGHTNESS 1.0
    #define ARTIFACTING 1.0
    #define FRINGING 1.0
#elif defined(SVIDEO)
    #define SATURATION 1.0
    #define BRIGHTNESS 1.0
    #define ARTIFACTING 0.0
    #define FRINGING 0.0
#endif
// end params

#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif

COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec2 pix_no;

uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;

// vertex compatibility #defines
#define vTexCoord TEX0.xy
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)

void main()
{
    gl_Position = MVPMatrix * VertexCoord;
    COL0 = COLOR;
    TEX0.xy = TexCoord.xy;
   pix_no = vTexCoord * SourceSize.xy * (outsize.xy / InputSize.xy);
}

and this is a stub taken from Dolphins asciiart.glsl shader

Code:
const int char_width = 8;
const int char_height = 13;
const int char_count = 95;
const int char_pixels = char_width*char_height;
const float2 char_dim = float2(char_width, char_height);
const float2 font_scale = float2(1.0/float(char_width)/float(char_count), 1.0/float(char_height));

void main()
{
    float2 char_pos = floor(GetCoordinates()*GetResolution()/char_dim);
    float2 pixel_offset = floor(GetCoordinates()*GetResolution()) - char_pos*char_dim;

    // just a big number
    float mindiff = float(char_width*char_height) * 100.0;

    float minc = 0.0;
    float4 mina = float4(0.0, 0.0, 0.0, 0.0);
    float4 minb = float4(0.0, 0.0, 0.0, 0.0);

    for (int i=0; i<char_count; i++)
    {
        float4 ff = float4(0.0, 0.0, 0.0, 0.0);
        float4 f = float4(0.0, 0.0, 0.0, 0.0);
        float4 ft = float4(0.0, 0.0, 0.0, 0.0);
        float4 t = float4(0.0, 0.0, 0.0, 0.0);
        float4 tt = float4(0.0, 0.0, 0.0, 0.0);

        for (int x=0; x<char_width; x++)
        {
            for (int y=0; y<char_height; y++)
            {
                float2 tex_pos = char_pos*char_dim + float2(x,y) + 0.5;
                float4 tex = SampleLocation(tex_pos * GetInvResolution());

                float2 font_pos = float2(x+i*char_width, y) + 0.5;
                float4 font = SampleFontLocation(font_pos * font_scale);

                // generates sum of texture and font and their squares
                ff += font*font;
                f += font;
                ft += font*tex;
                t += tex;
                tt += tex*tex;
            }
        }

It differs quite a lot in terms of coding, well at least I think it does since I'm inexperienced.

How can I learn how to port RetroArch shaders to Dolphin in an easy way so it will work?

The only experience I have with shaders is combining and mixing different ones via the .glslp files but since Dolphin can't use multi-pass shaders that knowledge is pretty useless here.
Find
Reply
08-24-2017, 12:40 AM
#5
Shonumi Offline
Linux User/Tester
**********
Administrators
Posts: 6,512
Threads: 55
Joined: Dec 2011
(08-23-2017, 06:00 PM)degasus Wrote: In fact, you can almost copy&paste such postprocessing shaders, as long as they use the same amount of features.

I was mainly thinking uniforms would be an issue with some post-processing shaders. E.g. with GBE+ and its GLSL post-processing shaders, they require a small amount of specific uniforms passed in to function properly, even though most of the work is nothing more advanced than simple math and mix(). All most of my shaders need are the system's original screen size and the current emulator window size, but that's basic stuff. However, at least one relies on input from the current system clock (for colorizing B/W GB games according to time of day). Although, I'm no expert in GLSL, so maybe my shaders are weird outliers.
Website Find
Reply
08-24-2017, 01:07 AM (This post was last modified: 08-24-2017, 01:08 AM by Maverick Hunter X.)
#6
Maverick Hunter X Offline
さようなら
****
Posts: 331
Threads: 23
Joined: Apr 2011
(08-24-2017, 12:40 AM)Shonumi Wrote: I was mainly thinking uniforms would be an issue with some post-processing shaders. E.g. with GBE+ and its GLSL post-processing shaders, they require a small amount of specific uniforms passed in to function properly, even though most of the work is nothing more advanced than simple math and mix(). All most of my shaders need are the system's original screen size and the current emulator window size, but that's basic stuff. However, at least one relies on input from the current system clock (for colorizing B/W GB games according to time of day). Although, I'm no expert in GLSL, so maybe my shaders are weird outliers.

That makes two of us not being experts in GLSL as I have been experimenting most of the day trying to get something to work or show up on the screen.
Looking at the shaders provided with Dolphin they look so simple and requires only a few lines of code to work.

Then looking at the shaders from RetroArch that's when I start to scratch my head big time, they're so complex I don't even know where to start.
Obviously I know nothing about writing shaders but making a nice NTSC S-Video shader seems like complete rocket science to me.

The games look so damn good with the NTSC S-Video shader that I can't stop thinking about it, it looks just like I remember it all those years back when I played GameCube games on the TV with S-Video connected.

I really don't care much for high resolution 4K experiences and I'm surprised that a shader like this never got made, I mean look at the screenshot, it looks so authentic.

Sure 1x resolution gets you half way there but you should really try out the RetroArch core with the ntsc-320px-svideo.glslp and see it in action.
Find
Reply
08-24-2017, 01:17 AM
#7
KHg8m3r Offline
Doesn't sleep, just Dolphin and Robots
*******
Posts: 5,949
Threads: 4
Joined: Sep 2013
It's so blurry it's hard to make out a lot of things. I don't remember my old TV being that bad....
However, I would like to see how this shader looks when applied to a game running a 3x or 4x IR.
Find
Reply
08-24-2017, 01:20 AM (This post was last modified: 08-24-2017, 01:36 AM by Maverick Hunter X.)
#8
Maverick Hunter X Offline
さようなら
****
Posts: 331
Threads: 23
Joined: Apr 2011
(08-24-2017, 01:17 AM)KHg8m3r Wrote: It's so blurry it's hard to make out a lot of things. I don't remember my old TV being that bad....
However, I would like to see how this shader looks when applied to a game running a 3x or 4x IR.

I'll gladly provide you with more screenshots from other games, it looks totally fine here.

EDIT:

Here's a few more examples

Spoiler: (Show Spoiler)
[Image: image.png]

[Image: image.png]

[Image: SMS.png]

[Image: image.png]
Find
Reply
08-24-2017, 02:09 AM (This post was last modified: 08-24-2017, 02:09 AM by JMC47.)
#9
JMC47 Offline
Content Producer
*******
Content Creators (Moderators)
Posts: 6,543
Threads: 29
Joined: Feb 2013
That looks worse than T.V. iirc Source: I have a trinitron in my room
Find
Reply
08-24-2017, 05:25 AM
#10
DrHouse64 Offline
A woman yet a man, a man yet a woman
****
Posts: 343
Threads: 18
Joined: Jun 2013
(08-24-2017, 02:09 AM)JMC47 Wrote: That looks worse than T.V. iirc Source: I have a trinitron in my room
I'm so jealous right now. RGB cables I guess ?
From France with love.
Laptop ROG : W10 / Ryzen 7 4800HS @2.9 GHz (4.2 GHz Turbo disabled unless necessary for better thermals) / 16 Go DDR4 / RTX 2060 MaxQ (6 Go GDDR6)
Find
Reply
« Next Oldest | Next Newest »
Pages (2): 1 2 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode