-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core / DolphinQt / VideoCommon - support passive/anaglpyh logic in co…
…njunction with any custom post processing shaders
- Loading branch information
Showing
18 changed files
with
286 additions
and
22 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Data/Sys/Shaders/Internal/Anaglyph/dubois-LCD-Amber-Blue.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Anaglyph Amber-Blue shader based on Dubois algorithm | ||
// Constants taken from the screenshot: | ||
// "https://www.flickr.com/photos/e_dubois/5230654930/" | ||
// Eric Dubois | ||
|
||
void main() | ||
{ | ||
float4 c0 = SampleLayer(0); | ||
float4 c1 = SampleLayer(1); | ||
|
||
float3 lr = float3( 1.062,-0.205, 0.299); | ||
float3 lg = float3(-0.026, 0.908, 0.068); | ||
float3 lb = float3(-0.038,-0.173, 0.022); | ||
|
||
float3 rr = float3(-0.016,-0.123,-0.017); | ||
float3 rg = float3( 0.006, 0.062, 0.017); | ||
float3 rb = float3(-0.094,-0.185, 0.991); | ||
|
||
SetOutput(float4(dot(lr, c0.rgb) + dot(rr, c1.rgb), dot(lg, c0.rgb) + dot(rg, c1.rgb), dot(lb, c0.rgb) + dot(rb, c1.rgb), c0.a)); | ||
} |
20 changes: 20 additions & 0 deletions
20
Data/Sys/Shaders/Internal/Anaglyph/dubois-LCD-Green-Magenta.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Anaglyph Green-Magenta shader based on Dubois algorithm | ||
// Constants taken from the screenshot: | ||
// "https://www.flickr.com/photos/e_dubois/5132528166/" | ||
// Eric Dubois | ||
|
||
void main() | ||
{ | ||
float4 c0 = SampleLayer(0); | ||
float4 c1 = SampleLayer(1); | ||
|
||
float3 lr = float3(-0.062,-0.158,-0.039); | ||
float3 lg = float3( 0.284, 0.668, 0.143); | ||
float3 lb = float3(-0.015,-0.027, 0.021); | ||
|
||
float3 rr = float3( 0.529, 0.705, 0.024); | ||
float3 rg = float3(-0.016,-0.015, 0.065); | ||
float3 rb = float3( 0.009, 0.075, 0.937); | ||
|
||
SetOutput(float4(dot(lr, c0.rgb) + dot(rr, c1.rgb), dot(lg, c0.rgb) + dot(rg, c1.rgb), dot(lb, c0.rgb) + dot(rb, c1.rgb), c0.a)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Anaglyph Red-Cyan shader based on Dubois algorithm | ||
// Constants taken from the paper: | ||
// "Conversion of a Stereo Pair to Anaglyph with | ||
// the Least-Squares Projection Method" | ||
// Eric Dubois, March 2009 | ||
|
||
void main() | ||
{ | ||
float4 c0 = SampleLayer(0); | ||
float4 c1 = SampleLayer(1); | ||
|
||
float3 lr = float3( 0.437, 0.449, 0.164); | ||
float3 lg = float3(-0.062,-0.062,-0.024); | ||
float3 lb = float3(-0.048,-0.050,-0.017); | ||
|
||
float3 rr = float3(-0.011,-0.032,-0.007); | ||
float3 rg = float3( 0.377, 0.761, 0.009); | ||
float3 rb = float3(-0.026,-0.093, 1.234); | ||
|
||
SetOutput(float4(dot(lr, c0.rgb) + dot(rr, c1.rgb), dot(lg, c0.rgb) + dot(rg, c1.rgb), dot(lb, c0.rgb) + dot(rb, c1.rgb), c0.a)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Anaglyph Red-Cyan shader without compensation | ||
|
||
void main() | ||
{ | ||
float4 c0 = SampleLayer(0); | ||
float4 c1 = SampleLayer(1); | ||
SetOutput(float4(c0.r, c1.gb, c0.a)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Anaglyph Red-Cyan grayscale shader | ||
|
||
void main() | ||
{ | ||
float4 c0 = SampleLayer(0); | ||
float avg0 = (c0.r + c0.g + c0.b) / 3.0; | ||
float4 c1 = SampleLayer(1); | ||
float avg1 = (c1.r + c1.g + c1.b) / 3.0; | ||
SetOutput(float4(avg0, avg1, avg1, c0.a)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Anaglyph Red-Cyan luma grayscale shader | ||
// Info: https://web.archive.org/web/20040101053504/http://www.oreillynet.com:80/cs/user/view/cs_msg/8691 | ||
|
||
void main() | ||
{ | ||
float3 luma = float3(0.222, 0.707, 0.071); | ||
float4 c0 = SampleLayer(0); | ||
float avg0 = dot(c0.rgb, luma); | ||
float4 c1 = SampleLayer(1); | ||
float avg1 = dot(c1.rgb, luma); | ||
SetOutput(float4(avg0, avg1, avg1, c0.a)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Passive (horizontal rows) shader | ||
|
||
void main() | ||
{ | ||
float screen_row = GetWindowResolution().y * GetCoordinates().y; | ||
SetOutput(SampleLayer(int(screen_row) % 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.