Unity - post processing results in split screen in VR?Easiest way to split a string on newlines in .NET?Split a string by another string in C#How to make HTTP POST web requestApply post processing shaderGvrMainViewer black screen in unityUnity Split Stereo DisplayGet neighboring colors in Unity shader?How can create 360 Render Texture in Unity?Can I share game screens with other Unity programs?Unity Shader Bug
Blank spaces in a font
How did astronauts using rovers tell direction without compasses on the Moon?
Can Lightning Lure be used to knock out a creature like a magical Taser?
Composing fill in the blanks
Why were contact sensors put on three of the Lunar Module's four legs? Did they ever bend and stick out sideways?
Piece of chess engine, which accomplishes move generation
How can Paypal know my card is being used in another account?
Why did I lose on time with 3 pawns vs Knight. Shouldn't it be a draw?
Does dual boot harm a laptop battery or reduce its life?
My employer is refusing to give me the pay that was advertised after an internal job move
Alternatives to minimizing loss in regression
Complaints from (junior) developers against solution architects: how can we show the benefits of our work and improve relationships?
To find islands of 1 and 0 in matrix
What are the cons of stateless password generators?
Why does aggregate initialization not work anymore since C++20 if a constructor is explicitly defaulted or deleted?
Why did some Apollo missions carry a grenade launcher?
Semen retention is a important thing in Martial arts?
If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?
Is it okay for me to decline a project on ethical grounds?
Why does the Rust compiler not optimize code assuming that two mutable references cannot alias?
Why is my fluorescent tube orange on one side, white on the other and dark in the middle?
Why is it "on the inside" and not "in the inside"?
What is the German equivalent of the proverb 水清ければ魚棲まず (if the water is clear, fish won't live there)?
Surviving a planet collision?
Unity - post processing results in split screen in VR?
Easiest way to split a string on newlines in .NET?Split a string by another string in C#How to make HTTP POST web requestApply post processing shaderGvrMainViewer black screen in unityUnity Split Stereo DisplayGet neighboring colors in Unity shader?How can create 360 Render Texture in Unity?Can I share game screens with other Unity programs?Unity Shader Bug
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Ok, I'm building for Oculus rift and am just trying to get chromatic aberration, or really any post-processing effects to work. The only way the effects show up is if I apply them to my CenterEyeAnchor camera in the OVRCameraRig. This works in editor but when I plug a headset in, the screen gets split into 2 x the number of effects scripts I apply:
I've been trying legacy image effects scripts (the up to date one does nothing), as well as this downloaded shader for chromatic aberration:
Shader "Hidden/LensCAAndDistortion"
Properties
_MainTex ("RGB", 2D) = ""
_BorderTex ("Border", 2D) = ""
CGINCLUDE
#include "UnityCG.cginc"
uniform float _RedCyan;
uniform float _GreenMagenta;
uniform float _BlueYellow;
uniform float _Zoom;
uniform float _BarrelDistortion;
uniform int _BorderOnOff;
sampler2D _BorderTex;
sampler2D _MainTex;
half4 _MainTex_TexelSize;
half4 _UV_Transform = half4(1, 0, 0, 1);
float2 barrelDistortion(float2 theUV)
float2 h = theUV.xy - 0.5;
float r2 = h.x * h.x + h.y * h.y;
float f = 1 + r2 * (_BarrelDistortion * sqrt(r2));
return f * (1.0+_Zoom) * h + 0.5;
half4 fragLens (v2f_img i) : SV_Target
half2 zoomUV = i.uv;
float4 theScreen = tex2D(_MainTex, zoomUV);
if ((_RedCyan == 0) && (_GreenMagenta == 0) && (_BlueYellow == 0))
zoomUV = barrelDistortion(zoomUV);
if (_BorderOnOff == 1)
theScreen.r = tex2D(_MainTex, zoomUV).r * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).r;
theScreen.g = tex2D(_MainTex, zoomUV).g * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).g;
theScreen.b = tex2D(_MainTex, zoomUV).b * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).b;
if (_BorderOnOff == 0)
theScreen.r = tex2D(_MainTex, zoomUV).r;
theScreen.g = tex2D(_MainTex, zoomUV).g;
theScreen.b = tex2D(_MainTex, zoomUV).b;
if ((_RedCyan != 0)
ENDCG
Subshader
ZTest Always Cull Off ZWrite Off
ColorMask RGB
Pass
CGPROGRAM
#pragma vertex vert_img
#pragma fragment fragLens
ENDCG
Fallback off
// shader
What is happening here? Can it be fixed?
Script:
void Start ()
if(!SystemInfo.supportsImageEffects)
enabled = false;
return;
void OnRenderImage (RenderTexture sourceTexture, RenderTexture destTexture)
if(LensShader != null)
material.SetFloat("_RedCyan", RedCyan * 10.0f);
material.SetFloat("_GreenMagenta", GreenMagenta * 10.0f);
material.SetFloat("_BlueYellow", BlueYellow * 10.0f);
material.SetFloat("_Zoom", 0.0f - Zoom);
material.SetFloat("_BarrelDistortion", BarrelDistortion);
material.SetTexture ("_BorderTex", TrimTexture);
if (TrimExtents == true)
material.SetInt("_BorderOnOff", 1);
else
material.SetInt("_BorderOnOff", 0);
Graphics.Blit(sourceTexture, destTexture, material);
else
Graphics.Blit(sourceTexture, destTexture);
void Update ()
void OnDisable ()
{
if(curMaterial)
DestroyImmediate(curMaterial);
c# unity3d shader virtual-reality
add a comment |
Ok, I'm building for Oculus rift and am just trying to get chromatic aberration, or really any post-processing effects to work. The only way the effects show up is if I apply them to my CenterEyeAnchor camera in the OVRCameraRig. This works in editor but when I plug a headset in, the screen gets split into 2 x the number of effects scripts I apply:
I've been trying legacy image effects scripts (the up to date one does nothing), as well as this downloaded shader for chromatic aberration:
Shader "Hidden/LensCAAndDistortion"
Properties
_MainTex ("RGB", 2D) = ""
_BorderTex ("Border", 2D) = ""
CGINCLUDE
#include "UnityCG.cginc"
uniform float _RedCyan;
uniform float _GreenMagenta;
uniform float _BlueYellow;
uniform float _Zoom;
uniform float _BarrelDistortion;
uniform int _BorderOnOff;
sampler2D _BorderTex;
sampler2D _MainTex;
half4 _MainTex_TexelSize;
half4 _UV_Transform = half4(1, 0, 0, 1);
float2 barrelDistortion(float2 theUV)
float2 h = theUV.xy - 0.5;
float r2 = h.x * h.x + h.y * h.y;
float f = 1 + r2 * (_BarrelDistortion * sqrt(r2));
return f * (1.0+_Zoom) * h + 0.5;
half4 fragLens (v2f_img i) : SV_Target
half2 zoomUV = i.uv;
float4 theScreen = tex2D(_MainTex, zoomUV);
if ((_RedCyan == 0) && (_GreenMagenta == 0) && (_BlueYellow == 0))
zoomUV = barrelDistortion(zoomUV);
if (_BorderOnOff == 1)
theScreen.r = tex2D(_MainTex, zoomUV).r * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).r;
theScreen.g = tex2D(_MainTex, zoomUV).g * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).g;
theScreen.b = tex2D(_MainTex, zoomUV).b * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).b;
if (_BorderOnOff == 0)
theScreen.r = tex2D(_MainTex, zoomUV).r;
theScreen.g = tex2D(_MainTex, zoomUV).g;
theScreen.b = tex2D(_MainTex, zoomUV).b;
if ((_RedCyan != 0)
ENDCG
Subshader
ZTest Always Cull Off ZWrite Off
ColorMask RGB
Pass
CGPROGRAM
#pragma vertex vert_img
#pragma fragment fragLens
ENDCG
Fallback off
// shader
What is happening here? Can it be fixed?
Script:
void Start ()
if(!SystemInfo.supportsImageEffects)
enabled = false;
return;
void OnRenderImage (RenderTexture sourceTexture, RenderTexture destTexture)
if(LensShader != null)
material.SetFloat("_RedCyan", RedCyan * 10.0f);
material.SetFloat("_GreenMagenta", GreenMagenta * 10.0f);
material.SetFloat("_BlueYellow", BlueYellow * 10.0f);
material.SetFloat("_Zoom", 0.0f - Zoom);
material.SetFloat("_BarrelDistortion", BarrelDistortion);
material.SetTexture ("_BorderTex", TrimTexture);
if (TrimExtents == true)
material.SetInt("_BorderOnOff", 1);
else
material.SetInt("_BorderOnOff", 0);
Graphics.Blit(sourceTexture, destTexture, material);
else
Graphics.Blit(sourceTexture, destTexture);
void Update ()
void OnDisable ()
{
if(curMaterial)
DestroyImmediate(curMaterial);
c# unity3d shader virtual-reality
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
see my edit above
– skyguy
Mar 26 at 21:48
add a comment |
Ok, I'm building for Oculus rift and am just trying to get chromatic aberration, or really any post-processing effects to work. The only way the effects show up is if I apply them to my CenterEyeAnchor camera in the OVRCameraRig. This works in editor but when I plug a headset in, the screen gets split into 2 x the number of effects scripts I apply:
I've been trying legacy image effects scripts (the up to date one does nothing), as well as this downloaded shader for chromatic aberration:
Shader "Hidden/LensCAAndDistortion"
Properties
_MainTex ("RGB", 2D) = ""
_BorderTex ("Border", 2D) = ""
CGINCLUDE
#include "UnityCG.cginc"
uniform float _RedCyan;
uniform float _GreenMagenta;
uniform float _BlueYellow;
uniform float _Zoom;
uniform float _BarrelDistortion;
uniform int _BorderOnOff;
sampler2D _BorderTex;
sampler2D _MainTex;
half4 _MainTex_TexelSize;
half4 _UV_Transform = half4(1, 0, 0, 1);
float2 barrelDistortion(float2 theUV)
float2 h = theUV.xy - 0.5;
float r2 = h.x * h.x + h.y * h.y;
float f = 1 + r2 * (_BarrelDistortion * sqrt(r2));
return f * (1.0+_Zoom) * h + 0.5;
half4 fragLens (v2f_img i) : SV_Target
half2 zoomUV = i.uv;
float4 theScreen = tex2D(_MainTex, zoomUV);
if ((_RedCyan == 0) && (_GreenMagenta == 0) && (_BlueYellow == 0))
zoomUV = barrelDistortion(zoomUV);
if (_BorderOnOff == 1)
theScreen.r = tex2D(_MainTex, zoomUV).r * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).r;
theScreen.g = tex2D(_MainTex, zoomUV).g * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).g;
theScreen.b = tex2D(_MainTex, zoomUV).b * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).b;
if (_BorderOnOff == 0)
theScreen.r = tex2D(_MainTex, zoomUV).r;
theScreen.g = tex2D(_MainTex, zoomUV).g;
theScreen.b = tex2D(_MainTex, zoomUV).b;
if ((_RedCyan != 0)
ENDCG
Subshader
ZTest Always Cull Off ZWrite Off
ColorMask RGB
Pass
CGPROGRAM
#pragma vertex vert_img
#pragma fragment fragLens
ENDCG
Fallback off
// shader
What is happening here? Can it be fixed?
Script:
void Start ()
if(!SystemInfo.supportsImageEffects)
enabled = false;
return;
void OnRenderImage (RenderTexture sourceTexture, RenderTexture destTexture)
if(LensShader != null)
material.SetFloat("_RedCyan", RedCyan * 10.0f);
material.SetFloat("_GreenMagenta", GreenMagenta * 10.0f);
material.SetFloat("_BlueYellow", BlueYellow * 10.0f);
material.SetFloat("_Zoom", 0.0f - Zoom);
material.SetFloat("_BarrelDistortion", BarrelDistortion);
material.SetTexture ("_BorderTex", TrimTexture);
if (TrimExtents == true)
material.SetInt("_BorderOnOff", 1);
else
material.SetInt("_BorderOnOff", 0);
Graphics.Blit(sourceTexture, destTexture, material);
else
Graphics.Blit(sourceTexture, destTexture);
void Update ()
void OnDisable ()
{
if(curMaterial)
DestroyImmediate(curMaterial);
c# unity3d shader virtual-reality
Ok, I'm building for Oculus rift and am just trying to get chromatic aberration, or really any post-processing effects to work. The only way the effects show up is if I apply them to my CenterEyeAnchor camera in the OVRCameraRig. This works in editor but when I plug a headset in, the screen gets split into 2 x the number of effects scripts I apply:
I've been trying legacy image effects scripts (the up to date one does nothing), as well as this downloaded shader for chromatic aberration:
Shader "Hidden/LensCAAndDistortion"
Properties
_MainTex ("RGB", 2D) = ""
_BorderTex ("Border", 2D) = ""
CGINCLUDE
#include "UnityCG.cginc"
uniform float _RedCyan;
uniform float _GreenMagenta;
uniform float _BlueYellow;
uniform float _Zoom;
uniform float _BarrelDistortion;
uniform int _BorderOnOff;
sampler2D _BorderTex;
sampler2D _MainTex;
half4 _MainTex_TexelSize;
half4 _UV_Transform = half4(1, 0, 0, 1);
float2 barrelDistortion(float2 theUV)
float2 h = theUV.xy - 0.5;
float r2 = h.x * h.x + h.y * h.y;
float f = 1 + r2 * (_BarrelDistortion * sqrt(r2));
return f * (1.0+_Zoom) * h + 0.5;
half4 fragLens (v2f_img i) : SV_Target
half2 zoomUV = i.uv;
float4 theScreen = tex2D(_MainTex, zoomUV);
if ((_RedCyan == 0) && (_GreenMagenta == 0) && (_BlueYellow == 0))
zoomUV = barrelDistortion(zoomUV);
if (_BorderOnOff == 1)
theScreen.r = tex2D(_MainTex, zoomUV).r * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).r;
theScreen.g = tex2D(_MainTex, zoomUV).g * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).g;
theScreen.b = tex2D(_MainTex, zoomUV).b * tex2D(_BorderTex, ((zoomUV * 0.9375) + 0.03125)).b;
if (_BorderOnOff == 0)
theScreen.r = tex2D(_MainTex, zoomUV).r;
theScreen.g = tex2D(_MainTex, zoomUV).g;
theScreen.b = tex2D(_MainTex, zoomUV).b;
if ((_RedCyan != 0)
ENDCG
Subshader
ZTest Always Cull Off ZWrite Off
ColorMask RGB
Pass
CGPROGRAM
#pragma vertex vert_img
#pragma fragment fragLens
ENDCG
Fallback off
// shader
What is happening here? Can it be fixed?
Script:
void Start ()
if(!SystemInfo.supportsImageEffects)
enabled = false;
return;
void OnRenderImage (RenderTexture sourceTexture, RenderTexture destTexture)
if(LensShader != null)
material.SetFloat("_RedCyan", RedCyan * 10.0f);
material.SetFloat("_GreenMagenta", GreenMagenta * 10.0f);
material.SetFloat("_BlueYellow", BlueYellow * 10.0f);
material.SetFloat("_Zoom", 0.0f - Zoom);
material.SetFloat("_BarrelDistortion", BarrelDistortion);
material.SetTexture ("_BorderTex", TrimTexture);
if (TrimExtents == true)
material.SetInt("_BorderOnOff", 1);
else
material.SetInt("_BorderOnOff", 0);
Graphics.Blit(sourceTexture, destTexture, material);
else
Graphics.Blit(sourceTexture, destTexture);
void Update ()
void OnDisable ()
{
if(curMaterial)
DestroyImmediate(curMaterial);
c# unity3d shader virtual-reality
c# unity3d shader virtual-reality
edited Mar 26 at 21:48
skyguy
asked Mar 26 at 20:13
skyguyskyguy
2,7137 gold badges33 silver badges80 bronze badges
2,7137 gold badges33 silver badges80 bronze badges
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
see my edit above
– skyguy
Mar 26 at 21:48
add a comment |
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
see my edit above
– skyguy
Mar 26 at 21:48
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
see my edit above
– skyguy
Mar 26 at 21:48
see my edit above
– skyguy
Mar 26 at 21:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365547%2funity-post-processing-results-in-split-screen-in-vr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365547%2funity-post-processing-results-in-split-screen-in-vr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please post your script.
– 0xBFE1A8
Mar 26 at 21:02
see my edit above
– skyguy
Mar 26 at 21:48