- Home /
Single pass stereo rendering shader
Hi! I'm working with the ML1 and have to convert a shader to support single pass rendering. I have followed all the steps at https://docs.unity3d.com/Manual/SinglePassStereoRendering.html but i cannot get it working. I have not prior experience of shaders so would appreciate the help.
When i run in ML Remote shaders work as intended but when i build to device the Gameobject does not show on one eye.
Shader "Custom/Stencil/Mask OneZLess"
{
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Geometry-1" }
ColorMask 0
ZWrite off
Stencil
{
Ref 1
Comp always
Pass replace
}
Pass
{
Cull Back
ZTest Less
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 pos : SV_POSITION;
};
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
half4 frag(v2f i) : COLOR
{
return half4(1,1,0,1);
}
ENDCG
}
}
}
You'll need to supply a little more information first... usually all 3d setups render both eyes separately... e.g. 2 camera's one for each eye, then send all geometry twice, once to camera 1, once to camera 2. or slightly more efficiently... go through each object at a time, process once as much of the pipeline, then send to 2 cameras to render. I can think of a couple of ways you might do a render in one pass.... but you'd have to leaborate on your setup, hardware or software etc.... do you want to interleave raster lines... one for right eye then one for left... or are you passing in 2 cameras to the shader, plus screen information, and assu$$anonymous$$g the screen is split in two, and having the shader render both the left and right polygon? I think that would be possible, but would still need two render passes. Interleaved raster scan lines could work.... but you'd need special hard ware. the only other way that "might" be possible is 2 color red/blue 3d in one render pass. What is your setup ?
Your answer
Follow this Question
Related Questions
Sprite Mask Shader only renders on one Eye/Display (AR) 1 Answer
How do Image shaders interact with UI Canvas draw order? 0 Answers
How can i get my quad to only render my texture without stretching it? 1 Answer
Fade object transparency evenly from the edge inward 0 Answers
How to configure shaders? 1 Answer