浏览代码

Shader changes to support XR in Lightweight Pipeline

/RenderPassXR_Sandbox
robbiesri 8 年前
当前提交
34caf919
共有 3 个文件被更改,包括 13 次插入0 次删除
  1. 4
      Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipeline.shader
  2. 2
      Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipelineCore.cginc
  3. 7
      Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader

4
Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipeline.shader


#pragma shader_feature _EMISSION
#pragma shader_feature _ _REFLECTION_CUBEMAP _REFLECTION_PROBE
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
#pragma multi_compile _ _SINGLE_DIRECTIONAL_LIGHT
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ _LIGHT_PROBES_ON

v2f vert(LightweightVertexInput v)
{
v2f o = (v2f)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.uv01.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uv01.zw = v.lightmapUV * unity_LightmapST.xy + unity_LightmapST.zw;

2
Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipelineCore.cginc


float4 tangent : TANGENT;
float3 texcoord : TEXCOORD0;
float2 lightmapUV : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f

half4 viewDir : TEXCOORD5; // xyz: viewDir
UNITY_FOG_COORDS_PACKED(6, half4) // x: fogCoord, yzw: vertexColor
float4 hpos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
// Per object light list data

7
Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader


CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
#pragma multi_compile_fog
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON

{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f

float4 vertex : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;

v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);

正在加载...
取消
保存