- Home /
Stereoscopic postscreen effect UV differences (multi pass)
I tried to strech the image in a postscreen effect by simply multiplying the u texture coordinate with a factor.
However the image comes out differently on each eye. With a factor of 1.5 the Image is compressed to 2/3 on the left eye but to 1/2 on the right.
As I thought and tested the UV space in a postscreen effect should be 0 to 1. Thus I cannot explain the difference in both eyes.
Although I am rendering in multi pass mode I tried to use UnityStereoScreenSpaceUVAdjust which did not change anything.
Here is the shader + script in text form:
Shader "Hidden/UVOffset"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
half4 _MainTex_ST;
fixed4 frag(v2f_img i) : SV_Target
{
i.uv.x *= 1.5;
fixed4 col = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST));
if (i.uv.x >1) col = fixed4(0, 0, 0, 1);
return col;
}
ENDCG
}
}
}
[ExecuteInEditMode]
public class UVOffset : MonoBehaviour
{
public Shader Shader;
private Material material;
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (this.material == null) this.material = new Material(this.Shader);
Graphics.Blit(source, destination, material);
}
}
This is the same code attached as a zip: UVOffsetPostFX.zip
The render Settings are as follows:
I hope anybody can help me with that because it is pretty specific and it seems like few people are using quadbuffered 3d.
Your answer
![](https://koobas.hobune.stream/wayback/20220612105419im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
3D Custom Render Texture 0 Answers
Represent Land 3D Area End 0 Answers
Image Effect - Screen coordinates 1 Answer
RenderTexture clears after Blit 0 Answers
3D Text - Stroke/Outline 4 Answers