我最近在我现有的Unity项目中添加了“轻量级渲染管道”,并将所有材质转换为轻量级。但是,有一种材料不能自动转换。现在是我处理LWRP的时候了,我真的不知道如何手动更改它。
有人可以帮我吗?
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "PPP/BendWorld2"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert //addshadow
//Global properities to be set by BendControllerRadial
uniform half3 _CurveOrigin;
uniform fixed3 _ReferenceDirection;
uniform half _Curvature;
uniform fixed3 _Scale;
uniform half _FlatMargin;
uniform half _HorizonWaveFrequency;
sampler2D _MainTex;
fixed4 _Color;
//uniform float _Curvature;
struct Input
{
float2 uv_MainTex;
};
half4 Bend(half4 v)
{
half4 wpos = mul(unity_ObjectToWorld, v);
half2 xzDist = (wpos.xz - _CurveOrigin.xz) / _Scale.xz;
half dist = length(xzDist);
half2 direction = lerp(_ReferenceDirection.xz, xzDist, min(dist, 1));
half theta = acos(clamp(dot(normalize(direction), _ReferenceDirection), -1, 1));
dist = max(0, dist - _FlatMargin);
wpos.y -= dist * dist * _Curvature * cos(theta * _HorizonWaveFrequency);
wpos = mul(unity_WorldToObject, wpos);
return wpos;
}
void vert(inout appdata_full v)
{
/*float4 worldSpace = mul(unity_ObjectToWorld, v.vertex);
worldSpace.xyz -= _WorldSpaceCameraPos.xyz;
worldSpace = float4(0.0f, (worldSpace.x * worldSpace.x) * -_Curvature, 0.0f, 0.0f);
v.vertex = mul(unity_WorldToObject, worldSpace);*/
half4 vpos = Bend(v.vertex);
v.vertex = vpos;
}
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/Diffuse"
}