<?xml version="1.0" encoding="utf-8"?>

<CustomShader version="3">
    <Parameters>
        <Parameter name="partScale" target="partScale" type="float3"/>
    </Parameters>
    <LodLevel startDistance="0">
        <CodeInjections>
            <CodeInjection position="NUM_TEXCOORDS">
<![CDATA[
#ifdef ALPHA_TESTED
#undef ALPHA_TESTED
#endif
]]>
            </CodeInjection>
            <CodeInjection position="MATERIALINFO">
<![CDATA[
uniform float3 partScale;
]]>
            </CodeInjection>
            <CodeInjection position="POST_ALBEDO_FS">
<![CDATA[
albedo.xyz = lerp(albedo.xyz, albedo.xyz*partScale.xyz, albedo.w);
]]>
            </CodeInjection>


            <CodeInjection position="GET_REFLECTION_COLOR_FS">
<![CDATA[
#if defined(REFLECTION_MAP_2D) || defined(REFLECTION_MAP_CUBE)
    float fresnel2 = max(min(getFresnel(facing, cReflectionCoeff, 3.0)*0.3, 0.1), 0.075);
    fresnel2 *= tex2D(baseMap, In.vs.ALBEDOMAP_TEXCOORD).a;
    res = lerp(oColor.xyz, getReflectionColorTex(In, globals, normal, tangentSpaceNormal, viewDir), fresnel2);
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
    <LodLevel startDistance="30">
        <CodeInjections>
            <CodeInjection position="NUM_TEXCOORDS">
<![CDATA[
#ifdef ALPHA_TESTED
#undef ALPHA_TESTED
#endif

#if defined(REFLECTION_MAP_CUBE)
#undef REFLECTION_MAP_CUBE
#endif
]]>
            </CodeInjection>
            <CodeInjection position="MATERIALINFO">
<![CDATA[
uniform float3 partScale;
]]>
            </CodeInjection>
            <CodeInjection position="POST_ALBEDO_FS">
<![CDATA[
albedo.xyz = lerp(albedo.xyz, albedo.xyz*partScale.xyz, albedo.w);
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>
