Dolphin, the GameCube and Wii emulator - Forums

Full Version: GLSL Shaders - CRT Emulating old televisions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Has anyone ported a CRT GLSL shader to Dolphin at all?

A good example would be the one discussed here

I've tried and failed to create a simple scanline based shader:

Code:
// lerp = mix

#define PI 3.14159265f

uniform samplerRECT samp0 : register(s0);

uniform float ScanlineAmount = 1.0f;
uniform float ScanlineScale = 1.0f;
uniform float ScanlineBrightScale = 1.0f;
uniform float ScanlineBrightOffset = 1.0f;
uniform float ScanlineOffset = 0.0f;
uniform float ScanlineHeight = 1.0f;
uniform float2 SourceDims = float2(640, 528);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
      float4 c0 = texRECT(samp0, uv0).rgba;

    float TargetWidth = SourceDims.x;
    float TargetHeight = SourceDims.y;

    float RawWidth = 1920;
    float RawHeight = 1080;

    float pixelRatio = RawHeight / SourceDims.y;

    float2 BaseCoord = uv0;
    
    float2 ScanCoord = BaseCoord - 0.5f / SourceDims;
    //float2 ScanCoord = BaseCoord;
    ScanCoord.y *= pixelRatio;

    float InnerSine = ScanCoord.y * RawHeight * ScanlineScale;
    float ScanBrightMod = sin(InnerSine * PI + ScanlineOffset * RawHeight);
    float4 ScanBrightness = mix(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f) * 0.5f, ScanlineAmount);

      // output
    ocol0 = float4(c0 * ScanBrightness.xyz, c0.a);
}

but it has no effect. Sad
This seems to be quite interesting.

Just watched some of the comparison screens from that thread and I liked what I saw.
This would be something I'd definitely would use if there is a solution.
I started poking around with some sort of translation today by starting with a simple scanline emulation.

Would be useful to know why that doesn't work so I can use it as a base for converting the CRT code.

One thing that confused me is that I would get a popup window with a list of errors the first time I would run the code (can't covert from float3, etc.) but on subsequent runs this list no longer appears. It was certainly helpful for debugging so I'd like to know how I could get it back Smile
(05-14-2012, 01:08 AM)ProfEmu Wrote: [ -> ]One thing that confused me is that I would get a popup window with a list of errors the first time I would run the code (can't covert from float3, etc.) but on subsequent runs this list no longer appears. It was certainly helpful for debugging so I'd like to know how I could get it back Smile
If you edit the Shutdown() function in Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp and add the line "s_currentShader = std:Confusedtring();" there, the error message should appear on all subsequent runs.
Well I've followed the instructions on this page but I'm still getting a truck load of errors when trying to build.

Here are the unique errors:

Code:
Error    24    error C1083: Cannot open include file: 'dxerr.h': No such file or directory    C:\SVN\dolphin-emu\Source\Core\AudioCommon\Src\DSoundStream.cpp    22    1    AudioCommon

Error    25    error C1083: Cannot open include file: 'xaudio2.h': No such file or directory    c:\svn\dolphin-emu\source\core\audiocommon\src\XAudio2Stream.h    25    1    AudioCommon


Error    60    error C1083: Cannot open include file: 'D3DX11.h': No such file or directory    c:\svn\dolphin-emu\source\plugins\plugin_videodx11\src\D3DBase.h    20    1    VideoDX11

Error    98    error C1083: Cannot open include file: 'd3dx9.h': No such file or directory    c:\svn\dolphin-emu\source\plugins\plugin_videodx9\src\D3DBase.h    23    1    VideoDX9

These two I presume are because of the above dependencies not being found:

Code:
Error    123    error LNK1181: cannot open input file 'C:\SVN\dolphin-emu\Source\x64\Release\AudioCommon.lib'    C:\SVN\dolphin-emu\Source\DSPTool\LINK    DSPTool

Error    127    error LNK1181: cannot open input file 'C:\SVN\dolphin-emu\Source\x64\Release\VideoDX11.lib'    C:\SVN\dolphin-emu\Source\Core\DolphinWX\LINK    Dolphin

I've included everything I need too according to the guide but only for the startup project (Dolphin -> Properties -> Configuration Properties -> VC++ Properties).

I'm using Microsoft Visual Studio 2010 Ultimate SP1 on Windows 7 64.

The project is configured for Release x64.
Looks like you didn't install the DirectX SDK or didn't setup the DX SDK paths, yet.
(05-14-2012, 05:47 AM)neobrain Wrote: [ -> ]Looks like you didn't install the DirectX SDK or didn't setup the DX SDK paths, yet.

I have included the following:

$(DXSDK_DIR)Utilities\Bin\x64;$(ExecutablePath)
$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Lib\x64;$(LibraryPath)

Are you referring to this version of the SDK. That is definitely installed.
do you have set up the DXSDK_DIR env variable?
(05-14-2012, 06:07 AM)neobrain Wrote: [ -> ]do you have set up the DXSDK_DIR env variable?

I don't think so. Where should I add that to?
why should someone use this? it adds so much fucking bloom ö-Ö
Pages: 1 2 3 4