Dolphin, the GameCube and Wii emulator - Forums

Full Version: 4k Passive 3D for Interlaced/Checkerboard
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

b7even

I love playing roms in stereoscopic 3D (yes i'm a little late to the party  Rolleyes ).

Only problem: Dolphin doesn't support interlaced mode (i don't understand why Dodgy ).
I can set Dolphin to SBS and let my SmartTV convert it to interlace - but only in ugly looking half-HD.

So i searched for another solution and found ReShade.
It allowed me to develop my own shader which converts a 4k dolphin Side-by-Side signal into 4k interlace/checkerboard. *yeeehaaa*
INFO: This solution can convert every program and game from SBS to interlace (not only dolphin).

Here is the shader with a description how to use it. File also downloadable as a zip.


Code:
/*
SBStoInterlaced4k by b7even

SBS to Interlaced 4k is a post-process shader which converts Side-by-Side Games to Interlaced Passive 3d.

Supports:
All resolutions (720p, 1920p/HD, 4k, custom resolutions)
Full-Screen / Windowed Mode.
Input: Side-by-Side (SbS) or Top-And-Bottom (TAB/TnB)
Output: Interlaced Horizontal or Interlaced Vertical or Checkerboard

Tested with:
Dolphin Wii Emulator and a Sony Bravia Passive 4k TV (Horizontal Interlaced).
Works great.

How to use:
Set your game to SBS or TopBottom 3d.
Use the Wrapper ReShade (supports OpenGL, DX9, DX10, DX11).
Copy the SBStoInterlaced4k.fx file into the game\reshade-shaders\Shaders directory
After starting the game: Press Shift-F2. Add a profile "foobar".
Activate SBStoInterlaced4k (if you can't see it, search for SBS).
Under sbs-Settings: Set your tv/monitor resolution (standard is 3840x2160).
Under sbs-Settings: Set your input method to either SBS or TopBottom
Under sbs-Settings: Set your output method to Interlaced Horizontal or Vertical or Checkerboard
(Output Method: depends on your Passive 3d TV, try all 3 if you don't know the specs of your TV
OR open a white picture, use your 3d glasses, close one eye and kiss your TV with your nose, you should see the lines/checkerboard)
Under sbs-Settings: Activate "Switch Eyes" if needed (rotate your glasses 180° to see if you need this option)
If it works, switch the ReShade mode under settings from "Configuration Mode" to "Performance Mode"

Why is the shader needed:
Many Smart 3d Tvs have a button on their remote control to activate 3d (or they use annoying protocols like HDMI 3D or Nividia 3d).
After pressing the key you can choose "Simulated 3d" "Side by side 3d" or "Top and bottom 3d".
If you press "Side by side 3d" on your tv's remote control the tv converts the signal to its own internal interlaced mode.
Problem: Many SmartTVs support only an HD input signal (despite beeing capable of real 4k 3d).
This shader does exactly the same. Instead of your SmartTV, your computer does the processing.

Advantage of this shader:
1. ALLOWS REAL 3840x2160 (4k) PASSIVE 3D!
  Looks astonishing. One of the best reasons to use 4k.
2. Less input lag on tv
3. Bypasses Protocols / Supports passive monitors which can't convert the signal on their own
4. Supports windowed mode (2D windows desktop with 3d tiles, fixed window resolution needed)

Hint 1:
If your tv has Horizontal Interlaced Lines set the game to Top-And-Bottom.
If your tv has Vertical Interlaced Lines set the game to Side-by-side.
This creates the best quality (without pixel loss).

Hint 2:
If you see extreme ghosting, deactivate all SmartTV picture optimizations with your remote control (tv-antialiasing, motion, contrast, blur and so on).
If the ghosting is gone reactivate one optimization after another to see what caused the problem.
Normaly a 3d-tv deactivates the problematic optimizations on theire own if you activate the 3d mode with your remote control. When your computer creates the 3d picture your tv doesn't know its showing 3d content.
Several optimizations combine neighbouring pixels destroying the interlaced lines = ghosting.
Deactivate the tv optimizations and the ghosting is gone.

Hint 3:
Use "SBStoInterlaced4kHorzTopBottom.fx" if the game supports Top-and-Bottom and your TV has 4k Horizontal Interlaced Lines.
It's more optimized.


Comment:
It's a shame that users who bought a 1000$ TV and a 500$ graphics card need my shader as a workaround. Protocols like Nvidia 3D, HDMI 3D and extra Hardware shouldn't be needed for such a simple solution.
This shader should be a native part of windows or the nividia/amd control center right from the start of 3d!
It's not a techinical but a artifical restriction to earn extra money and one of the reasons why 3d failed for several users.
Thank you ReShade for solving this problem.

*/

// SBS to INTERLACED 4k PS

 ////////////////////
/////// MENU ///////
////////////////////

uniform float MonitorWidth <
ui_tooltip = "MonitorWidth (ex. 3840).";
ui_type = "drag";
ui_min = 0.0; ui_max = 3840.0;
> = 3840.0;

uniform float MonitorHeight <
ui_tooltip = "MonitorWidth (ex. 2160).";
ui_type = "drag";
ui_min = 0.0; ui_max = 2160.0;
> = 2160.0;

uniform int SBS <
ui_label = "Input Mode";
ui_tooltip = "If image bulges in movement, change it to Diagonal. When proportions are distorted, choose Vertical";
ui_type = "combo";
ui_items = "Side-By-Side\0Top-And-Bottom\0";
> = 0;

uniform int LINES <
ui_label = "Output Mode";
ui_type = "combo";
ui_items = "Interlace: Horizontal Lines (Passive3D)\0Interlace: Vertical Lines (Passive3D)\0Checkerboard\0";
> = 0;

uniform int EYESSWITCHED <
ui_label = "Switch Eyes";
ui_type = "combo";
ui_items = "Normal Eyes\0Switch Eyes\0";
> = 0;


 //////////////////////
/////// SHADER ///////
//////////////////////

#include "ReShade.fxh"

float3 SBStoINTERLACED4k(float4 vois : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float2 position = texcoord;

if (EYESSWITCHED==0)
{
if (SBS==0)
{
if (LINES==0)
{
if (int(position.y*MonitorHeight)%2<0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}
else if (LINES==1)
{
if (int(position.x*MonitorWidth)%2<0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}
else
{
if ((int(position.y*MonitorHeight)+int(position.x*MonitorWidth))%2<0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}
}
else
{
if (LINES==0)
{
if (int(position.y*MonitorHeight)%2<0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}
}
else if (LINES==1)
{
if (int(position.x*MonitorWidth)%2<0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}
}
else
{
if ((int(position.y*MonitorHeight)+int(position.x*MonitorWidth))%2<0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}
}
}
}
else
{
if (SBS==0)
{
if (LINES==0)
{
if (int(position.y*MonitorHeight)%2>0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}
else if (LINES==1)
{
if (int(position.x*MonitorWidth)%2>0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}
else
{
if ((int(position.y*MonitorHeight)+int(position.x*MonitorWidth))%2>0.5)
{
position.x*=0.5;
}
else
{
position.x=position.x*0.5+0.5;
}
}

}
else
{
if (LINES==0)
{
if (int(position.y*MonitorHeight)%2>0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}
}
else if (LINES==1)
{
if (int(position.x*MonitorWidth)%2>0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}

}
else
{
if ((int(position.y*MonitorHeight)+int(position.x*MonitorWidth))%2>0.5)
{
position.y*=0.5;
}
else
{
position.y=position.y*0.5+0.5;
}
}

}
}

// Sample display image
float3 Display = tex2D(ReShade::BackBuffer, position).rgb;

return Display;
}


technique SBStoINTERLACED4k
{
pass
{
VertexShader = PostProcessVS;
PixelShader = SBStoINTERLACED4k;
}
}


Comment:

It's a shame that users who bought a 1000$ TV and a 500$ graphics card need a shader as a workaround. Protocols like Nvidia 3D, HDMI 3D and extra Hardware shouldn't be needed for such a simple solution.
This shader should be a native part of windows or the nividia/amd control center right from the start of 3d!
It's not a techinical but a artifical restriction to earn extra money and one of the reasons why 3d failed for several users.