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

<CustomShader version="2" classRequirement="">
    <LodLevel startDistance="0">
        <Parameters>
            <Parameter name="partScale" target="partScale" type="float3"/>
        </Parameters>

        <CodeInjections>
	        <CodeInjection position="NUM_TEXCOORDS">
<![CDATA[
#ifdef ALPHA_TESTED
#undef ALPHA_TESTED
#endif
]]>
            </CodeInjection>
            <CodeInjection position="MATERIALINFO">
<![CDATA[
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, reflectionRefractionCoeffScale[0], 3.0)*0.3, 0.1), 0.075);
	fresnel2 *= tex2D(baseMap, getTexCoords(In, globals, ALBEDOMAP_TEXCOORD)).a;
    res = lerp(oColor.xyz, getReflectionColorTex(In, globals, normal, viewDir), fresnel2);
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
    <LodLevel startDistance="30">
        <Parameters>
            <Parameter name="partScale" target="partScale" type="float3"/>
        </Parameters>

        <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[
float3 partScale;
]]>
            </CodeInjection>
            <CodeInjection position="POST_ALBEDO_FS">
<![CDATA[
albedo.xyz = lerp(albedo.xyz, albedo.xyz*partScale.xyz, albedo.w);
]]>
	        </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>
