1.
float3 lightDir = ResolvedView.AtmosphereLightDirection[0].xyz;
float3 forwardDir = TransformLocalVectorToWorld(Parameters, MaterialFloat3(0.00000000,0.00000000,1.00000000).xyz);
float switchShadowTex = dot(lightDir.x,TransformLocalVectorToWorld(Parameters, MaterialFloat3(1.00000000,0.00000000,0.00000000).x));
float var_FaceShadow;
if (switchShadowTex < 0.0)
{
var_FaceShadow = InputColor1;
}
else
{
var_FaceShadow = InputColor2;
}
float faceShadowRange = (dot(lightDir.xz,forwardDir.xz) + 1) / 2 ;
float4 faceShadow = var_FaceShadow < faceShadowRange ? 0.0 : 1.0 ;
float3 emissive = faceShadow.rgb;
return emissive;
2.
3.
4.
/*
half LeftTex;
half RightTex;
*/
//
half3 L = ResolvedView.AtmosphereLightDirection[0].xyz;
//-----SDF----
half3 FrontDir = TransformLocalVectorToWorld(Parameters, MaterialFloat3(1.00000000,0.00000000,0.00000000).xyz);
half3 LeftDir = TransformLocalVectorToWorld(Parameters, MaterialFloat3(0.00000000,1.00000000,0.00000000).xyz);
half LerpMax = 1;
half LerpMin = 0.5;
half LerpValue = 0.5;
half SDFValue = 0.5;
//
half FoL = dot(normalize(FrontDir.rg), normalize(L.rg));
half LoL = dot(normalize(LeftDir), L);
if(LeftTex > FoL)
{
LerpMax = 1;
}
else
{
LerpMax = 0.5;
}
//
if(RightTex > -FoL)
{
LerpMin = 1;
}
else
{
LerpMin = 0.5;
}
if (FoL > 0)
{
LerpValue = LerpMax;
}
else
{
LerpValue = LerpMin;
}
if(LoL < 0)
{
SDFValue = LerpValue;
}
else
{
SDFValue = ShadowColor;
}
SDFValue = saturate(SDFValue);
//--------------
return SDFValue;