- Home /
StereoRenderShader not work on lwrp, How to fix it?
I want to use HTC StereoRenderShader in lwrp, but it can't work properly. How can I modify it? Please Help,Thanks!
Shader "Custom/StereoRenderShader"
{
Properties
{
_LeftEyeTexture("Left Eye Texture", 2D) = "white" {}
_RightEyeTexture("Right Eye Texture", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
#include "UnityInstancing.cginc"
ENDCG
SubShader
{
Tags{ "RenderType" = "Opaque" }
//Cull OFF
CGPROGRAM
#pragma surface surf Standard
#pragma multi_compile __ STEREO_RENDER
#pragma target 3.0
sampler2D _LeftEyeTexture;
sampler2D _RightEyeTexture;
struct Input
{
float2 uv_MainTex;
float4 screenPos;
};
void surf(Input IN, inout SurfaceOutputStandard o)
{
float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
#if UNITY_SINGLE_PASS_STEREO
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
screenUV = (screenUV - scaleOffset.zw) / scaleOffset.xy;
#endif
if (unity_StereoEyeIndex == 0)
{
fixed4 color = tex2D(_LeftEyeTexture, screenUV);
o.Albedo = color.xyz;
}
else
{
fixed4 color = tex2D(_RightEyeTexture, screenUV);
o.Albedo = color.xyz;
}
}
ENDCG
}
Fallback "Diffuse"
}
Comment
Your answer
Follow this Question
Related Questions
separate vert and frag shader functions in two distinct URP Render Features 0 Answers
How to get mesh renderer in SRP after culling pass 0 Answers
Is it possible to use Lightweight Render Pipeline shader in Vuforia AR scene? 0 Answers
Is it possible to pass scene color to Sample Texture 2D LOD (URP, Shader Graph)? 0 Answers
How to Use DrawMeshInstancedIndirect with new Render Pipeline (LDRP or HDRP) 0 Answers