Ejemplo n.º 1
0
        private ShaderNode GetShaderPart(ShaderBody part)
        {
            var texcoord60 = new TextureCoordinateNode("texcoord");

            var invert_transparency79 = new MathNode("invert_transparency");

            invert_transparency79.ins.Value1.Value = 1f;
            invert_transparency79.ins.Value2.Value = part.Transparency;
            invert_transparency79.Operation        = MathNode.Operations.Subtract;
            invert_transparency79.UseClamp         = false;

            var diffuse_texture61 = new ImageTextureNode("diffuse_texture");

            diffuse_texture61.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);
            diffuse_texture61.Projection       = TextureNode.TextureProjection.Flat;
            diffuse_texture61.ColorSpace       = TextureNode.TextureColorSpace.None;
            diffuse_texture61.Extension        = part.DiffuseTexture.Repeat ? TextureNode.TextureExtension.Repeat : TextureNode.TextureExtension.Clip;
            diffuse_texture61.Interpolation    = InterpolationType.Linear;
            diffuse_texture61.UseAlpha         = true;
            diffuse_texture61.IsLinear         = false;

            var weight_diffuse_amount_by_transparency_inv78 = new MathNode("weight_diffuse_amount_by_transparency_inv");

            weight_diffuse_amount_by_transparency_inv78.ins.Value1.Value = part.DiffuseTexture.Amount;
            weight_diffuse_amount_by_transparency_inv78.ins.Value2.Value = 0f;
            weight_diffuse_amount_by_transparency_inv78.Operation        = MathNode.Operations.Multiply;
            weight_diffuse_amount_by_transparency_inv78.UseClamp         = false;

            var invert_alpha76 = new MathNode("invert_alpha");

            invert_alpha76.ins.Value1.Value = 1f;
            invert_alpha76.ins.Value2.Value = 0f;
            invert_alpha76.Operation        = MathNode.Operations.Subtract;
            invert_alpha76.UseClamp         = false;

            var diffuse_texture_amount65 = new MixNode("diffuse_texture_amount");

            diffuse_texture_amount65.ins.Color1.Value = part.BaseColor;
            diffuse_texture_amount65.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            diffuse_texture_amount65.ins.Fac.Value    = 0f;
            diffuse_texture_amount65.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Add;
            diffuse_texture_amount65.UseClamp         = false;

            var honor_texture_repeat77 = new MathNode("honor_texture_repeat");

            honor_texture_repeat77.ins.Value1.Value = 1f;
            honor_texture_repeat77.ins.Value2.Value = part.DiffuseTexture.InvertRepeatAsFloat;
            honor_texture_repeat77.Operation        = MathNode.Operations.Multiply;
            honor_texture_repeat77.UseClamp         = false;

            var repeat_mixer75 = new MixNode("repeat_mixer");

            repeat_mixer75.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            repeat_mixer75.ins.Color2.Value = part.BaseColor;
            repeat_mixer75.ins.Fac.Value    = 1f;
            repeat_mixer75.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            repeat_mixer75.UseClamp         = false;

            var diffuse_behind_texture_through_alpha119 = new MixNode("diffuse_behind_texture_through_alpha");

            diffuse_behind_texture_through_alpha119.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            diffuse_behind_texture_through_alpha119.ins.Color2.Value = new ccl.float4(0f, 0f, 0f, 1f);
            diffuse_behind_texture_through_alpha119.ins.Fac.Value    = part.Transparency;
            diffuse_behind_texture_through_alpha119.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            diffuse_behind_texture_through_alpha119.UseClamp         = false;

            var multiply120 = new MathNode("multiply");

            multiply120.ins.Value1.Value = 0f;
            multiply120.ins.Value2.Value = part.DiffuseTexture.Amount;
            multiply120.Operation        = MathNode.Operations.Multiply;
            multiply120.UseClamp         = false;

            var multiply129 = new MathNode("multiply");

            multiply129.ins.Value1.Value = 0f;
            multiply129.ins.Value2.Value = 0f;
            multiply129.Operation        = MathNode.Operations.Multiply;
            multiply129.UseClamp         = false;

            var mix125 = new MixNode("mix");

            mix125.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            mix125.ins.Color2.Value = part.BaseColor;
            mix125.ins.Fac.Value    = 0f;
            mix125.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            mix125.UseClamp         = false;

            var separate_base_color73 = new SeparateRgbNode("separate_base_color");

            separate_base_color73.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var separate_diffuse_texture_color72 = new SeparateRgbNode("separate_diffuse_texture_color");

            separate_diffuse_texture_color72.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var subtract126 = new MathNode("subtract");

            subtract126.ins.Value1.Value = 0f;
            subtract126.ins.Value2.Value = 0f;
            subtract126.Operation        = MathNode.Operations.Subtract;
            subtract126.UseClamp         = false;

            var subtract127 = new MathNode("subtract");

            subtract127.ins.Value1.Value = 0f;
            subtract127.ins.Value2.Value = 0f;
            subtract127.Operation        = MathNode.Operations.Subtract;
            subtract127.UseClamp         = false;

            var subtract128 = new MathNode("subtract");

            subtract128.ins.Value1.Value = 0f;
            subtract128.ins.Value2.Value = 0f;
            subtract128.Operation        = MathNode.Operations.Subtract;
            subtract128.UseClamp         = false;

            var bump_texture69 = new ImageTextureNode("bump_texture");

            bump_texture69.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);
            bump_texture69.Projection       = TextureNode.TextureProjection.Flat;
            bump_texture69.ColorSpace       = TextureNode.TextureColorSpace.None;
            bump_texture69.Extension        = TextureNode.TextureExtension.Repeat;
            bump_texture69.Interpolation    = InterpolationType.Linear;
            bump_texture69.UseAlpha         = true;
            bump_texture69.IsLinear         = false;

            var bump_texture_to_bw70 = new RgbToBwNode("bump_texture_to_bw");

            bump_texture_to_bw70.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var bump_amount71 = new MathNode("bump_amount");

            bump_amount71.ins.Value1.Value = 4.66f;
            bump_amount71.ins.Value2.Value = part.BumpTexture.Amount;
            bump_amount71.Operation        = MathNode.Operations.Multiply;
            bump_amount71.UseClamp         = false;

            var final_base_color74 = new CombineRgbNode("final_base_color");

            final_base_color74.ins.R.Value = 0f;
            final_base_color74.ins.G.Value = 0f;
            final_base_color74.ins.B.Value = 0f;

            var bump68 = new BumpNode("bump");

            bump68.ins.Height.Value   = 0f;
            bump68.ins.Normal.Value   = new ccl.float4(0f, 0f, 0f, 1f);
            bump68.ins.Strength.Value = 0f;
            bump68.ins.Distance.Value = 0.1f;

            var diffuse82 = new DiffuseBsdfNode("diffuse");

            diffuse82.ins.Color.Value     = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            diffuse82.ins.Roughness.Value = 0f;
            diffuse82.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);

            var shadeless_bsdf94 = new EmissionNode("shadeless_bsdf");

            shadeless_bsdf94.ins.Color.Value    = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            shadeless_bsdf94.ins.Strength.Value = 1f;

            var attenuated_reflection_color104 = new MixNode("attenuated_reflection_color");

            attenuated_reflection_color104.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attenuated_reflection_color104.ins.Color2.Value = part.ReflectionColorGamma;
            attenuated_reflection_color104.ins.Fac.Value    = part.Reflectivity;
            attenuated_reflection_color104.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attenuated_reflection_color104.UseClamp         = false;

            var fresnel_based_on_constant124 = new FresnelNode("fresnel_based_on_constant");

            fresnel_based_on_constant124.ins.IOR.Value    = part.FresnelIOR;
            fresnel_based_on_constant124.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f);

            var simple_reflection110 = new CombineRgbNode("simple_reflection");

            simple_reflection110.ins.R.Value = part.Reflectivity;
            simple_reflection110.ins.G.Value = 0f;
            simple_reflection110.ins.B.Value = 0f;

            var fresnel_reflection111 = new CombineRgbNode("fresnel_reflection");

            fresnel_reflection111.ins.R.Value = 0f;
            fresnel_reflection111.ins.G.Value = 0f;
            fresnel_reflection111.ins.B.Value = 0f;

            var fresnel_reflection_if_reflection_used131 = new MathNode("fresnel_reflection_if_reflection_used");

            fresnel_reflection_if_reflection_used131.ins.Value1.Value = part.Reflectivity;
            fresnel_reflection_if_reflection_used131.ins.Value2.Value = part.FresnelReflectionsAsFloat;
            fresnel_reflection_if_reflection_used131.Operation        = MathNode.Operations.Multiply;
            fresnel_reflection_if_reflection_used131.UseClamp         = false;

            var select_reflection_or_fresnel_reflection109 = new MixNode("select_reflection_or_fresnel_reflection");

            select_reflection_or_fresnel_reflection109.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            select_reflection_or_fresnel_reflection109.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            select_reflection_or_fresnel_reflection109.ins.Fac.Value    = 1f;
            select_reflection_or_fresnel_reflection109.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            select_reflection_or_fresnel_reflection109.UseClamp         = false;

            var shadeless95 = new MixClosureNode("shadeless");

            shadeless95.ins.Fac.Value = part.ShadelessAsFloat;

            var glossy96 = new GlossyBsdfNode("glossy");

            glossy96.ins.Color.Value     = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            glossy96.ins.Roughness.Value = part.ReflectionRoughnessPow2;
            glossy96.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);

            var reflection_factor112 = new SeparateRgbNode("reflection_factor");

            reflection_factor112.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var attennuated_refraction_color106 = new MixNode("attennuated_refraction_color");

            attennuated_refraction_color106.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attennuated_refraction_color106.ins.Color2.Value = part.TransparencyColorGamma;
            attennuated_refraction_color106.ins.Fac.Value    = part.Transparency;
            attennuated_refraction_color106.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attennuated_refraction_color106.UseClamp         = false;

            var refraction84 = new RefractionBsdfNode("refraction");

            refraction84.ins.Color.Value     = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            refraction84.ins.Roughness.Value = part.RefractionRoughnessPow2;
            refraction84.ins.IOR.Value       = part.IOR;
            refraction84.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);
            refraction84.Distribution        = RefractionBsdfNode.RefractionDistribution.Beckmann;

            var diffuse_plus_glossy107 = new MixClosureNode("diffuse_plus_glossy");

            diffuse_plus_glossy107.ins.Fac.Value = 0f;

            var blend_in_transparency83 = new MixClosureNode("blend_in_transparency");

            blend_in_transparency83.ins.Fac.Value = part.Transparency;

            var separate_xyz100 = new SeparateXyzNode("separate_xyz");

            separate_xyz100.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);

            var multiply101 = new MathNode("multiply");

            multiply101.ins.Value1.Value = 0f;
            multiply101.ins.Value2.Value = -1f;
            multiply101.Operation        = MathNode.Operations.Multiply;
            multiply101.UseClamp         = false;

            var combine_xyz99 = new CombineXyzNode("combine_xyz");

            combine_xyz99.ins.X.Value = 0f;
            combine_xyz99.ins.Y.Value = 0f;
            combine_xyz99.ins.Z.Value = 0f;

            var environment_texture97 = new ImageTextureNode("environment_texture");

            environment_texture97.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);
            environment_texture97.Projection       = TextureNode.TextureProjection.Flat;
            environment_texture97.ColorSpace       = TextureNode.TextureColorSpace.None;
            environment_texture97.Extension        = TextureNode.TextureExtension.Repeat;
            environment_texture97.Interpolation    = InterpolationType.Linear;
            environment_texture97.UseAlpha         = true;
            environment_texture97.IsLinear         = false;

            var attenuated_environment_color102 = new MixNode("attenuated_environment_color");

            attenuated_environment_color102.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attenuated_environment_color102.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            attenuated_environment_color102.ins.Fac.Value    = part.EnvironmentTexture.Amount;
            attenuated_environment_color102.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attenuated_environment_color102.UseClamp         = false;

            var diffuse_glossy_and_refraction108 = new MixClosureNode("diffuse_glossy_and_refraction");

            diffuse_glossy_and_refraction108.ins.Fac.Value = part.Transparency;

            var diffuse98 = new DiffuseBsdfNode("diffuse");

            diffuse98.ins.Color.Value     = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            diffuse98.ins.Roughness.Value = 0f;
            diffuse98.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);

            var invert_roughness88 = new MathNode("invert_roughness");

            invert_roughness88.ins.Value1.Value = 1f;
            invert_roughness88.ins.Value2.Value = part.RefractionRoughnessPow2;
            invert_roughness88.Operation        = MathNode.Operations.Subtract;
            invert_roughness88.UseClamp         = false;

            var multiply_transparency89 = new MathNode("multiply_transparency");

            multiply_transparency89.ins.Value1.Value = 1f;
            multiply_transparency89.ins.Value2.Value = part.Transparency;
            multiply_transparency89.Operation        = MathNode.Operations.Multiply;
            multiply_transparency89.UseClamp         = false;

            var light_path86 = new LightPathNode("light_path");

            var multiply_with_shadowray90 = new MathNode("multiply_with_shadowray");

            multiply_with_shadowray90.ins.Value1.Value = 1f;
            multiply_with_shadowray90.ins.Value2.Value = 0f;
            multiply_with_shadowray90.Operation        = MathNode.Operations.Multiply;
            multiply_with_shadowray90.UseClamp         = false;

            var custom_environment_blend103 = new MixClosureNode("custom_environment_blend");

            custom_environment_blend103.ins.Fac.Value = part.EnvironmentTexture.Amount;

            var coloured_shadow_trans_color87 = new TransparentBsdfNode("coloured_shadow_trans_color");

            coloured_shadow_trans_color87.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var weight_for_shadowray_coloured_shadow91 = new MathNode("weight_for_shadowray_coloured_shadow");

            weight_for_shadowray_coloured_shadow91.ins.Value1.Value = 0f;
            weight_for_shadowray_coloured_shadow91.ins.Value2.Value = 1f;
            weight_for_shadowray_coloured_shadow91.Operation        = MathNode.Operations.Multiply;
            weight_for_shadowray_coloured_shadow91.UseClamp         = false;

            var transparency_texture62 = new ImageTextureNode("transparency_texture");

            transparency_texture62.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);
            transparency_texture62.Projection       = TextureNode.TextureProjection.Flat;
            transparency_texture62.ColorSpace       = TextureNode.TextureColorSpace.None;
            transparency_texture62.Extension        = TextureNode.TextureExtension.Repeat;
            transparency_texture62.Interpolation    = InterpolationType.Linear;
            transparency_texture62.UseAlpha         = true;
            transparency_texture62.IsLinear         = false;

            var transpluminance63 = new RgbToLuminanceNode("transpluminance");

            transpluminance63.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

            var invert_luminence64 = new MathNode("invert_luminence");

            invert_luminence64.ins.Value1.Value = 1f;
            invert_luminence64.ins.Value2.Value = 0f;
            invert_luminence64.Operation        = MathNode.Operations.Subtract;
            invert_luminence64.UseClamp         = false;

            var transparency_texture_amount67 = new MathNode("transparency_texture_amount");

            transparency_texture_amount67.ins.Value1.Value = 1f;
            transparency_texture_amount67.ins.Value2.Value = part.TransparencyTexture.Amount;
            transparency_texture_amount67.Operation        = MathNode.Operations.Multiply;
            transparency_texture_amount67.UseClamp         = false;

            var toggle_diffuse_texture_alpha_usage117 = new MathNode("toggle_diffuse_texture_alpha_usage");

            toggle_diffuse_texture_alpha_usage117.ins.Value1.Value = 1f;
            toggle_diffuse_texture_alpha_usage117.ins.Value2.Value = part.DiffuseTexture.UseAlphaAsFloat;
            toggle_diffuse_texture_alpha_usage117.Operation        = MathNode.Operations.Multiply;
            toggle_diffuse_texture_alpha_usage117.UseClamp         = false;

            var toggle_transparency_texture66 = new MathNode("toggle_transparency_texture");

            toggle_transparency_texture66.ins.Value1.Value = part.HasTransparencyTextureAsFloat;
            toggle_transparency_texture66.ins.Value2.Value = 0f;
            toggle_transparency_texture66.Operation        = MathNode.Operations.Multiply;
            toggle_transparency_texture66.UseClamp         = false;

            var coloured_shadow_mix_custom93 = new MixClosureNode("coloured_shadow_mix_custom");

            coloured_shadow_mix_custom93.ins.Fac.Value = 0f;

            var transparent80 = new TransparentBsdfNode("transparent");

            transparent80.ins.Color.Value = new ccl.float4(1f, 1f, 1f, 1f);

            var add_diffuse_texture_alpha118 = new MathNode("add_diffuse_texture_alpha");

            add_diffuse_texture_alpha118.ins.Value1.Value = 0f;
            add_diffuse_texture_alpha118.ins.Value2.Value = 0f;
            add_diffuse_texture_alpha118.Operation        = MathNode.Operations.Add;
            add_diffuse_texture_alpha118.UseClamp         = false;

            var custom_alpha_cutter85 = new MixClosureNode("custom_alpha_cutter");

            custom_alpha_cutter85.ins.Fac.Value = 0f;

            var principledbsdf132 = new UberBsdfNode("principledbsdf");

            principledbsdf132.ins.BaseColor.Value        = part.TransparencyColorGamma;
            principledbsdf132.ins.SubsurfaceColor.Value  = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            principledbsdf132.ins.Metallic.Value         = 0f;
            principledbsdf132.ins.Subsurface.Value       = 0f;
            principledbsdf132.ins.SubsurfaceRadius.Value = new ccl.float4(0f, 0f, 0f, 1f);
            principledbsdf132.ins.Specular.Value         = 0f;
            principledbsdf132.ins.Roughness.Value        = part.ReflectionRoughnessPow2;
            principledbsdf132.ins.SpecularTint.Value     = 0f;
            principledbsdf132.ins.Anisotropic.Value      = 0f;
            principledbsdf132.ins.Sheen.Value            = 0f;
            principledbsdf132.ins.SheenTint.Value        = 0f;
            principledbsdf132.ins.Clearcoat.Value        = 0f;
            principledbsdf132.ins.ClearcoatGloss.Value   = 0f;
            principledbsdf132.ins.IOR.Value                 = part.IOR;
            principledbsdf132.ins.Transparency.Value        = part.Transparency;
            principledbsdf132.ins.RefractionRoughness.Value = part.RefractionRoughnessPow2;
            principledbsdf132.ins.AnisotropicRotation.Value = 0f;
            principledbsdf132.ins.Normal.Value              = new ccl.float4(0f, 0f, 0f, 1f);
            principledbsdf132.ins.ClearcoatNormal.Value     = new ccl.float4(0f, 0f, 0f, 1f);
            principledbsdf132.ins.Tangent.Value             = new ccl.float4(0f, 0f, 0f, 1f);

            var coloured_shadow_mix_glass_principled116 = new MixClosureNode("coloured_shadow_mix_glass_principled");

            coloured_shadow_mix_glass_principled116.ins.Fac.Value = 0f;


            m_shader.AddNode(texcoord60);
            m_shader.AddNode(invert_transparency79);
            m_shader.AddNode(diffuse_texture61);
            m_shader.AddNode(weight_diffuse_amount_by_transparency_inv78);
            m_shader.AddNode(invert_alpha76);
            m_shader.AddNode(diffuse_texture_amount65);
            m_shader.AddNode(honor_texture_repeat77);
            m_shader.AddNode(repeat_mixer75);
            m_shader.AddNode(diffuse_behind_texture_through_alpha119);
            m_shader.AddNode(multiply120);
            m_shader.AddNode(multiply129);
            m_shader.AddNode(mix125);
            m_shader.AddNode(separate_base_color73);
            m_shader.AddNode(separate_diffuse_texture_color72);
            m_shader.AddNode(subtract126);
            m_shader.AddNode(subtract127);
            m_shader.AddNode(subtract128);
            m_shader.AddNode(bump_texture69);
            m_shader.AddNode(bump_texture_to_bw70);
            m_shader.AddNode(bump_amount71);
            m_shader.AddNode(final_base_color74);
            m_shader.AddNode(bump68);
            m_shader.AddNode(diffuse82);
            m_shader.AddNode(shadeless_bsdf94);
            m_shader.AddNode(attenuated_reflection_color104);
            m_shader.AddNode(fresnel_based_on_constant124);
            m_shader.AddNode(simple_reflection110);
            m_shader.AddNode(fresnel_reflection111);
            m_shader.AddNode(fresnel_reflection_if_reflection_used131);
            m_shader.AddNode(select_reflection_or_fresnel_reflection109);
            m_shader.AddNode(shadeless95);
            m_shader.AddNode(glossy96);
            m_shader.AddNode(reflection_factor112);
            m_shader.AddNode(attennuated_refraction_color106);
            m_shader.AddNode(refraction84);
            m_shader.AddNode(diffuse_plus_glossy107);
            m_shader.AddNode(blend_in_transparency83);
            m_shader.AddNode(separate_xyz100);
            m_shader.AddNode(multiply101);
            m_shader.AddNode(combine_xyz99);
            m_shader.AddNode(environment_texture97);
            m_shader.AddNode(attenuated_environment_color102);
            m_shader.AddNode(diffuse_glossy_and_refraction108);
            m_shader.AddNode(diffuse98);
            m_shader.AddNode(invert_roughness88);
            m_shader.AddNode(multiply_transparency89);
            m_shader.AddNode(light_path86);
            m_shader.AddNode(multiply_with_shadowray90);
            m_shader.AddNode(custom_environment_blend103);
            m_shader.AddNode(coloured_shadow_trans_color87);
            m_shader.AddNode(weight_for_shadowray_coloured_shadow91);
            m_shader.AddNode(transparency_texture62);
            m_shader.AddNode(transpluminance63);
            m_shader.AddNode(invert_luminence64);
            m_shader.AddNode(transparency_texture_amount67);
            m_shader.AddNode(toggle_diffuse_texture_alpha_usage117);
            m_shader.AddNode(toggle_transparency_texture66);
            m_shader.AddNode(coloured_shadow_mix_custom93);
            m_shader.AddNode(transparent80);
            m_shader.AddNode(add_diffuse_texture_alpha118);
            m_shader.AddNode(custom_alpha_cutter85);
            m_shader.AddNode(principledbsdf132);
            m_shader.AddNode(coloured_shadow_mix_glass_principled116);


            texcoord60.outs.UV.Connect(diffuse_texture61.ins.Vector);
            invert_transparency79.outs.Value.Connect(weight_diffuse_amount_by_transparency_inv78.ins.Value2);
            diffuse_texture61.outs.Alpha.Connect(invert_alpha76.ins.Value2);
            diffuse_texture61.outs.Color.Connect(diffuse_texture_amount65.ins.Color2);
            weight_diffuse_amount_by_transparency_inv78.outs.Value.Connect(diffuse_texture_amount65.ins.Fac);
            invert_alpha76.outs.Value.Connect(honor_texture_repeat77.ins.Value1);
            diffuse_texture_amount65.outs.Color.Connect(repeat_mixer75.ins.Color1);
            honor_texture_repeat77.outs.Value.Connect(repeat_mixer75.ins.Fac);
            repeat_mixer75.outs.Color.Connect(diffuse_behind_texture_through_alpha119.ins.Color1);
            diffuse_texture61.outs.Alpha.Connect(multiply120.ins.Value1);
            multiply120.outs.Value.Connect(multiply129.ins.Value1);
            invert_transparency79.outs.Value.Connect(multiply129.ins.Value2);
            multiply129.outs.Value.Connect(mix125.ins.Fac);
            diffuse_behind_texture_through_alpha119.outs.Color.Connect(separate_base_color73.ins.Image);
            mix125.outs.Color.Connect(separate_diffuse_texture_color72.ins.Image);
            separate_base_color73.outs.R.Connect(subtract126.ins.Value1);
            separate_diffuse_texture_color72.outs.R.Connect(subtract126.ins.Value2);
            separate_base_color73.outs.G.Connect(subtract127.ins.Value1);
            separate_diffuse_texture_color72.outs.G.Connect(subtract127.ins.Value2);
            separate_base_color73.outs.B.Connect(subtract128.ins.Value1);
            separate_diffuse_texture_color72.outs.B.Connect(subtract128.ins.Value2);
            texcoord60.outs.UV.Connect(bump_texture69.ins.Vector);
            bump_texture69.outs.Color.Connect(bump_texture_to_bw70.ins.Color);
            subtract126.outs.Value.Connect(final_base_color74.ins.R);
            subtract127.outs.Value.Connect(final_base_color74.ins.G);
            subtract128.outs.Value.Connect(final_base_color74.ins.B);
            bump_texture_to_bw70.outs.Val.Connect(bump68.ins.Height);
            bump_amount71.outs.Value.Connect(bump68.ins.Strength);
            final_base_color74.outs.Image.Connect(diffuse82.ins.Color);
            bump68.outs.Normal.Connect(diffuse82.ins.Normal);
            final_base_color74.outs.Image.Connect(shadeless_bsdf94.ins.Color);
            bump68.outs.Normal.Connect(fresnel_based_on_constant124.ins.Normal);
            fresnel_based_on_constant124.outs.Fac.Connect(fresnel_reflection111.ins.R);
            simple_reflection110.outs.Image.Connect(select_reflection_or_fresnel_reflection109.ins.Color1);
            fresnel_reflection111.outs.Image.Connect(select_reflection_or_fresnel_reflection109.ins.Color2);
            fresnel_reflection_if_reflection_used131.outs.Value.Connect(select_reflection_or_fresnel_reflection109.ins.Fac);
            diffuse82.outs.BSDF.Connect(shadeless95.ins.Closure1);
            shadeless_bsdf94.outs.Emission.Connect(shadeless95.ins.Closure2);
            attenuated_reflection_color104.outs.Color.Connect(glossy96.ins.Color);
            bump68.outs.Normal.Connect(glossy96.ins.Normal);
            select_reflection_or_fresnel_reflection109.outs.Color.Connect(reflection_factor112.ins.Image);
            attennuated_refraction_color106.outs.Color.Connect(refraction84.ins.Color);
            bump68.outs.Normal.Connect(refraction84.ins.Normal);
            shadeless95.outs.Closure.Connect(diffuse_plus_glossy107.ins.Closure1);
            glossy96.outs.BSDF.Connect(diffuse_plus_glossy107.ins.Closure2);
            reflection_factor112.outs.R.Connect(diffuse_plus_glossy107.ins.Fac);
            shadeless95.outs.Closure.Connect(blend_in_transparency83.ins.Closure1);
            refraction84.outs.BSDF.Connect(blend_in_transparency83.ins.Closure2);
            texcoord60.outs.EnvEmap.Connect(separate_xyz100.ins.Vector);
            separate_xyz100.outs.Y.Connect(multiply101.ins.Value1);
            separate_xyz100.outs.X.Connect(combine_xyz99.ins.X);
            multiply101.outs.Value.Connect(combine_xyz99.ins.Y);
            separate_xyz100.outs.Z.Connect(combine_xyz99.ins.Z);
            combine_xyz99.outs.Vector.Connect(environment_texture97.ins.Vector);
            environment_texture97.outs.Color.Connect(attenuated_environment_color102.ins.Color2);
            diffuse_plus_glossy107.outs.Closure.Connect(diffuse_glossy_and_refraction108.ins.Closure1);
            blend_in_transparency83.outs.Closure.Connect(diffuse_glossy_and_refraction108.ins.Closure2);
            attenuated_environment_color102.outs.Color.Connect(diffuse98.ins.Color);
            invert_roughness88.outs.Value.Connect(multiply_transparency89.ins.Value1);
            multiply_transparency89.outs.Value.Connect(multiply_with_shadowray90.ins.Value1);
            light_path86.outs.IsShadowRay.Connect(multiply_with_shadowray90.ins.Value2);
            diffuse_glossy_and_refraction108.outs.Closure.Connect(custom_environment_blend103.ins.Closure1);
            diffuse98.outs.BSDF.Connect(custom_environment_blend103.ins.Closure2);
            final_base_color74.outs.Image.Connect(coloured_shadow_trans_color87.ins.Color);
            multiply_with_shadowray90.outs.Value.Connect(weight_for_shadowray_coloured_shadow91.ins.Value1);
            texcoord60.outs.UV.Connect(transparency_texture62.ins.Vector);
            transparency_texture62.outs.Color.Connect(transpluminance63.ins.Color);
            transpluminance63.outs.Val.Connect(invert_luminence64.ins.Value2);
            invert_luminence64.outs.Value.Connect(transparency_texture_amount67.ins.Value1);
            invert_alpha76.outs.Value.Connect(toggle_diffuse_texture_alpha_usage117.ins.Value1);
            transparency_texture_amount67.outs.Value.Connect(toggle_transparency_texture66.ins.Value2);
            custom_environment_blend103.outs.Closure.Connect(coloured_shadow_mix_custom93.ins.Closure1);
            coloured_shadow_trans_color87.outs.BSDF.Connect(coloured_shadow_mix_custom93.ins.Closure2);
            weight_for_shadowray_coloured_shadow91.outs.Value.Connect(coloured_shadow_mix_custom93.ins.Fac);
            toggle_diffuse_texture_alpha_usage117.outs.Value.Connect(add_diffuse_texture_alpha118.ins.Value1);
            toggle_transparency_texture66.outs.Value.Connect(add_diffuse_texture_alpha118.ins.Value2);
            coloured_shadow_mix_custom93.outs.Closure.Connect(custom_alpha_cutter85.ins.Closure1);
            transparent80.outs.BSDF.Connect(custom_alpha_cutter85.ins.Closure2);
            add_diffuse_texture_alpha118.outs.Value.Connect(custom_alpha_cutter85.ins.Fac);
            bump68.outs.Normal.Connect(principledbsdf132.ins.Normal);
            bump68.outs.Normal.Connect(principledbsdf132.ins.ClearcoatNormal);
            principledbsdf132.outs.BSDF.Connect(coloured_shadow_mix_glass_principled116.ins.Closure1);
            coloured_shadow_trans_color87.outs.BSDF.Connect(coloured_shadow_mix_glass_principled116.ins.Closure2);
            weight_for_shadowray_coloured_shadow91.outs.Value.Connect(coloured_shadow_mix_glass_principled116.ins.Fac);

            if (part.HasDiffuseTexture)
            {
                RenderEngine.SetTextureImage(diffuse_texture61, part.DiffuseTexture);
                RenderEngine.SetProjectionMode(m_shader, part.DiffuseTexture, diffuse_texture61, texcoord60);
            }

            if (part.HasBumpTexture)
            {
                RenderEngine.SetTextureImage(bump_texture69, part.BumpTexture);
                RenderEngine.SetProjectionMode(m_shader, part.BumpTexture, bump_texture69, texcoord60);
            }

            if (part.HasTransparencyTexture)
            {
                RenderEngine.SetTextureImage(transparency_texture62, part.TransparencyTexture);
                RenderEngine.SetProjectionMode(m_shader, part.TransparencyTexture, transparency_texture62, texcoord60);
            }

            if (part.HasEnvironmentTexture)
            {
                RenderEngine.SetTextureImage(environment_texture97, part.EnvironmentTexture);
                RenderEngine.SetProjectionMode(m_shader, part.EnvironmentTexture, environment_texture97, texcoord60);
            }

            if (part.CyclesMaterialType == ShaderBody.CyclesMaterial.Glass)
            {
                return(coloured_shadow_mix_glass_principled116);
            }
            return(custom_alpha_cutter85);
        }
Ejemplo n.º 2
0
        private ShaderNode GetShaderPart(ShaderBody part)
        {
            var texcoord207 = new TextureCoordinateNode("texcoord");

            var diffuse_texture208 = new ImageTextureNode("diffuse_texture");

            diffuse_texture208.Projection    = TextureNode.TextureProjection.Flat;
            diffuse_texture208.ColorSpace    = TextureNode.TextureColorSpace.None;
            diffuse_texture208.Extension     = part.DiffuseTexture.Repeat ? TextureNode.TextureExtension.Repeat : TextureNode.TextureExtension.Clip;
            diffuse_texture208.Interpolation = InterpolationType.Smart;
            diffuse_texture208.UseAlpha      = true;
            diffuse_texture208.IsLinear      = false;

            var diffuse_texture_alpha_amount192 = new MathMultiply("diffuse_texture_alpha_amount");

            diffuse_texture_alpha_amount192.ins.Value2.Value = part.DiffuseTexture.Amount;
            diffuse_texture_alpha_amount192.Operation        = MathNode.Operations.Multiply;
            diffuse_texture_alpha_amount192.UseClamp         = false;

            var invert_transparency189 = new MathSubtract("invert_transparency");

            invert_transparency189.ins.Value1.Value = 1f;
            invert_transparency189.ins.Value2.Value = part.Transparency;
            invert_transparency189.Operation        = MathNode.Operations.Subtract;
            invert_transparency189.UseClamp         = false;

            var diff_tex_alpha_multiplied_with_inv_transparency193 = new MathMultiply("diff_tex_alpha_multiplied_with_inv_transparency");

            diff_tex_alpha_multiplied_with_inv_transparency193.Operation = MathNode.Operations.Multiply;
            diff_tex_alpha_multiplied_with_inv_transparency193.UseClamp  = false;

            var bump_texture209 = new ImageTextureNode("bump_texture");

            bump_texture209.Projection    = TextureNode.TextureProjection.Flat;
            bump_texture209.ColorSpace    = TextureNode.TextureColorSpace.None;
            bump_texture209.Extension     = TextureNode.TextureExtension.Repeat;
            bump_texture209.Interpolation = InterpolationType.Smart;
            bump_texture209.UseAlpha      = true;
            bump_texture209.IsLinear      = false;

            var bump_texture_to_bw210 = new RgbToBwNode("bump_texture_to_bw");

            var bump_amount194 = new MathMultiply("bump_amount");

            bump_amount194.ins.Value1.Value = 4.66f;
            bump_amount194.ins.Value2.Value = part.BumpTexture.Amount;
            bump_amount194.Operation        = MathNode.Operations.Multiply;
            bump_amount194.UseClamp         = false;

            var diffuse_base_color_through_alpha244 = new MixNode("diffuse_base_color_through_alpha");

            diffuse_base_color_through_alpha244.ins.Color1.Value = part.BaseColor;
            diffuse_base_color_through_alpha244.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            diffuse_base_color_through_alpha244.UseClamp         = false;

            var bump211 = new BumpNode("bump");

            bump211.ins.Normal.Value   = new ccl.float4(0f, 0f, 0f, 1f);
            bump211.ins.Distance.Value = 0.1f;

            var light_path232 = new LightPathNode("light_path");

            var final_diffuse212 = new DiffuseBsdfNode("final_diffuse");

            final_diffuse212.ins.Roughness.Value = 0f;

            var shadeless_bsdf213 = new EmissionNode("shadeless_bsdf");

            shadeless_bsdf213.ins.Strength.Value = 1f;

            var shadeless_on_cameraray246 = new MathMultiply("shadeless_on_cameraray");

            shadeless_on_cameraray246.ins.Value2.Value = part.ShadelessAsFloat;
            shadeless_on_cameraray246.Operation        = MathNode.Operations.Multiply;
            shadeless_on_cameraray246.UseClamp         = false;

            var attenuated_reflection_color214 = new MixNode("attenuated_reflection_color");

            attenuated_reflection_color214.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attenuated_reflection_color214.ins.Color2.Value = part.ReflectionColorGamma;
            attenuated_reflection_color214.ins.Fac.Value    = part.Reflectivity;
            attenuated_reflection_color214.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attenuated_reflection_color214.UseClamp         = false;

            var fresnel_based_on_constant215 = new FresnelNode("fresnel_based_on_constant");

            fresnel_based_on_constant215.ins.IOR.Value = part.FresnelIOR;

            var simple_reflection216 = new CombineRgbNode("simple_reflection");

            simple_reflection216.ins.R.Value = part.Reflectivity;
            simple_reflection216.ins.G.Value = 0f;
            simple_reflection216.ins.B.Value = 0f;

            var fresnel_reflection217 = new CombineRgbNode("fresnel_reflection");

            fresnel_reflection217.ins.G.Value = 0f;
            fresnel_reflection217.ins.B.Value = 0f;

            var fresnel_reflection_if_reflection_used195 = new MathMultiply("fresnel_reflection_if_reflection_used");

            fresnel_reflection_if_reflection_used195.ins.Value1.Value = part.Reflectivity;
            fresnel_reflection_if_reflection_used195.ins.Value2.Value = part.FresnelReflectionsAsFloat;
            fresnel_reflection_if_reflection_used195.Operation        = MathNode.Operations.Multiply;
            fresnel_reflection_if_reflection_used195.UseClamp         = false;

            var select_reflection_or_fresnel_reflection218 = new MixNode("select_reflection_or_fresnel_reflection");

            select_reflection_or_fresnel_reflection218.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            select_reflection_or_fresnel_reflection218.UseClamp  = false;

            var shadeless219 = new MixClosureNode("shadeless");

            var glossy220 = new GlossyBsdfNode("glossy");

            glossy220.ins.Roughness.Value = part.ReflectionRoughnessPow2;

            var reflection_factor221 = new SeparateRgbNode("reflection_factor");

            var attennuated_refraction_color222 = new MixNode("attennuated_refraction_color");

            attennuated_refraction_color222.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attennuated_refraction_color222.ins.Color2.Value = part.TransparencyColorGamma;
            attennuated_refraction_color222.ins.Fac.Value    = part.Transparency;
            attennuated_refraction_color222.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attennuated_refraction_color222.UseClamp         = false;

            var refraction223 = new RefractionBsdfNode("refraction");

            refraction223.ins.Roughness.Value = part.RefractionRoughnessPow2;
            refraction223.ins.IOR.Value       = part.IOR;
            refraction223.Distribution        = RefractionBsdfNode.RefractionDistribution.GGX;

            var diffuse_plus_glossy224 = new MixClosureNode("diffuse_plus_glossy");

            var blend_in_transparency225 = new MixClosureNode("blend_in_transparency");

            blend_in_transparency225.ins.Fac.Value = part.Transparency;

            var separate_envmap_texco226 = new SeparateXyzNode("separate_envmap_texco");

            var flip_sign_envmap_texco_y196 = new MathMultiply("flip_sign_envmap_texco_y");

            flip_sign_envmap_texco_y196.ins.Value2.Value = -1f;
            flip_sign_envmap_texco_y196.Operation        = MathNode.Operations.Multiply;
            flip_sign_envmap_texco_y196.UseClamp         = false;

            var recombine_envmap_texco227 = new CombineXyzNode("recombine_envmap_texco");

            var environment_texture228 = new ImageTextureNode("environment_texture");

            environment_texture228.Projection    = TextureNode.TextureProjection.Flat;
            environment_texture228.ColorSpace    = TextureNode.TextureColorSpace.None;
            environment_texture228.Extension     = TextureNode.TextureExtension.Repeat;
            environment_texture228.Interpolation = InterpolationType.Smart;
            environment_texture228.UseAlpha      = true;
            environment_texture228.IsLinear      = false;

            var attenuated_environment_color229 = new MixNode("attenuated_environment_color");

            attenuated_environment_color229.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f);
            attenuated_environment_color229.ins.Fac.Value    = part.EnvironmentTexture.Amount;
            attenuated_environment_color229.BlendType        = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
            attenuated_environment_color229.UseClamp         = false;

            var diffuse_glossy_and_refraction230 = new MixClosureNode("diffuse_glossy_and_refraction");

            diffuse_glossy_and_refraction230.ins.Fac.Value = part.Transparency;

            var environment_map_diffuse231 = new DiffuseBsdfNode("environment_map_diffuse");

            environment_map_diffuse231.ins.Roughness.Value = 0f;
            environment_map_diffuse231.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);

            var invert_roughness197 = new MathSubtract("invert_roughness");

            invert_roughness197.ins.Value1.Value = 1f;
            invert_roughness197.ins.Value2.Value = part.RefractionRoughnessPow2;
            invert_roughness197.Operation        = MathNode.Operations.Subtract;
            invert_roughness197.UseClamp         = false;

            var multiply_transparency198 = new MathMultiply("multiply_transparency");

            multiply_transparency198.ins.Value2.Value = part.Transparency;
            multiply_transparency198.Operation        = MathNode.Operations.Multiply;
            multiply_transparency198.UseClamp         = false;

            var multiply_with_shadowray199 = new MathMultiply("multiply_with_shadowray");

            multiply_with_shadowray199.Operation = MathNode.Operations.Multiply;
            multiply_with_shadowray199.UseClamp  = false;

            var custom_environment_blend233 = new MixClosureNode("custom_environment_blend");

            custom_environment_blend233.ins.Fac.Value = part.EnvironmentTexture.Amount;

            var coloured_shadow_trans_color234 = new TransparentBsdfNode("coloured_shadow_trans_color");

            var weight_for_shadowray_coloured_shadow200 = new MathMultiply("weight_for_shadowray_coloured_shadow");

            weight_for_shadowray_coloured_shadow200.ins.Value2.Value = 1f;
            weight_for_shadowray_coloured_shadow200.Operation        = MathNode.Operations.Multiply;
            weight_for_shadowray_coloured_shadow200.UseClamp         = false;

            var diffuse_from_emission_color247 = new DiffuseBsdfNode("diffuse_from_emission_color");

            diffuse_from_emission_color247.ins.Color.Value     = part.EmissionColorGamma;
            diffuse_from_emission_color247.ins.Roughness.Value = 0f;
            diffuse_from_emission_color247.ins.Normal.Value    = new ccl.float4(0f, 0f, 0f, 1f);

            var shadeless_emission249 = new EmissionNode("shadeless_emission");

            shadeless_emission249.ins.Color.Value    = part.EmissionColorGamma;
            shadeless_emission249.ins.Strength.Value = 1f;

            var coloured_shadow_mix_custom237 = new MixClosureNode("coloured_shadow_mix_custom");

            var diffuse_or_shadeless_emission250 = new MixClosureNode("diffuse_or_shadeless_emission");

            var invert_alpha191 = new MathSubtract("invert_alpha");

            invert_alpha191.ins.Value1.Value = 1f;
            invert_alpha191.Operation        = MathNode.Operations.Subtract;
            invert_alpha191.UseClamp         = false;

            var transparency_texture235 = new ImageTextureNode("transparency_texture");

            transparency_texture235.Projection    = TextureNode.TextureProjection.Flat;
            transparency_texture235.ColorSpace    = TextureNode.TextureColorSpace.None;
            transparency_texture235.Extension     = TextureNode.TextureExtension.Repeat;
            transparency_texture235.Interpolation = InterpolationType.Smart;
            transparency_texture235.UseAlpha      = true;
            transparency_texture235.IsLinear      = false;

            var transpluminance236 = new RgbToLuminanceNode("transpluminance");

            var invert_luminence201 = new MathSubtract("invert_luminence");

            invert_luminence201.ins.Value1.Value = 1f;
            invert_luminence201.Operation        = MathNode.Operations.Subtract;
            invert_luminence201.UseClamp         = false;

            var transparency_texture_amount202 = new MathMultiply("transparency_texture_amount");

            transparency_texture_amount202.ins.Value2.Value = part.TransparencyTexture.Amount;
            transparency_texture_amount202.Operation        = MathNode.Operations.Multiply;
            transparency_texture_amount202.UseClamp         = false;

            var toggle_diffuse_texture_alpha_usage203 = new MathMultiply("toggle_diffuse_texture_alpha_usage");

            toggle_diffuse_texture_alpha_usage203.ins.Value2.Value = part.DiffuseTexture.UseAlphaAsFloat;
            toggle_diffuse_texture_alpha_usage203.Operation        = MathNode.Operations.Multiply;
            toggle_diffuse_texture_alpha_usage203.UseClamp         = false;

            var toggle_transparency_texture204 = new MathMultiply("toggle_transparency_texture");

            toggle_transparency_texture204.ins.Value1.Value = part.HasTransparencyTextureAsFloat;
            toggle_transparency_texture204.Operation        = MathNode.Operations.Multiply;
            toggle_transparency_texture204.UseClamp         = false;

            var add_emission_to_final248 = new AddClosureNode("add_emission_to_final");

            var transparent238 = new TransparentBsdfNode("transparent");

            transparent238.ins.Color.Value = new ccl.float4(1f, 1f, 1f, 1f);

            var add_diffuse_texture_alpha205 = new MathAdd("add_diffuse_texture_alpha");

            add_diffuse_texture_alpha205.Operation = MathNode.Operations.Add;
            add_diffuse_texture_alpha205.UseClamp  = false;

            var custom_alpha_cutter239 = new MixClosureNode("custom_alpha_cutter");

            var principledbsdf240 = new PrincipledBsdfNode("principledbsdf");

            principledbsdf240.ins.BaseColor.Value           = part.BaseColor;
            principledbsdf240.ins.Subsurface.Value          = 0f;
            principledbsdf240.ins.SubsurfaceRadius.Value    = new ccl.float4(0f, 0f, 0f, 1f);
            principledbsdf240.ins.SubsurfaceColor.Value     = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
            principledbsdf240.ins.Metallic.Value            = 0f;
            principledbsdf240.ins.Specular.Value            = 0f;
            principledbsdf240.ins.SpecularTint.Value        = 0f;
            principledbsdf240.ins.Roughness.Value           = part.ReflectionRoughnessPow2;
            principledbsdf240.ins.Anisotropic.Value         = 0f;
            principledbsdf240.ins.AnisotropicRotation.Value = 0f;
            principledbsdf240.ins.Sheen.Value                 = 0f;
            principledbsdf240.ins.SheenTint.Value             = 0f;
            principledbsdf240.ins.Clearcoat.Value             = 0f;
            principledbsdf240.ins.ClearcoatGloss.Value        = 0f;
            principledbsdf240.ins.IOR.Value                   = part.IOR;
            principledbsdf240.ins.Transmission.Value          = part.Transparency;
            principledbsdf240.ins.TransmissionRoughness.Value = part.RefractionRoughnessPow2;
            principledbsdf240.ins.Tangent.Value               = new ccl.float4(0f, 0f, 0f, 1f);

            var coloured_shadow_mix_glass_principled241 = new MixClosureNode("coloured_shadow_mix_glass_principled");


            m_shader.AddNode(texcoord207);
            m_shader.AddNode(diffuse_texture208);
            m_shader.AddNode(diffuse_texture_alpha_amount192);
            m_shader.AddNode(invert_transparency189);
            m_shader.AddNode(diff_tex_alpha_multiplied_with_inv_transparency193);
            m_shader.AddNode(bump_texture209);
            m_shader.AddNode(bump_texture_to_bw210);
            m_shader.AddNode(bump_amount194);
            m_shader.AddNode(diffuse_base_color_through_alpha244);
            m_shader.AddNode(bump211);
            m_shader.AddNode(light_path232);
            m_shader.AddNode(final_diffuse212);
            m_shader.AddNode(shadeless_bsdf213);
            m_shader.AddNode(shadeless_on_cameraray246);
            m_shader.AddNode(attenuated_reflection_color214);
            m_shader.AddNode(fresnel_based_on_constant215);
            m_shader.AddNode(simple_reflection216);
            m_shader.AddNode(fresnel_reflection217);
            m_shader.AddNode(fresnel_reflection_if_reflection_used195);
            m_shader.AddNode(select_reflection_or_fresnel_reflection218);
            m_shader.AddNode(shadeless219);
            m_shader.AddNode(glossy220);
            m_shader.AddNode(reflection_factor221);
            m_shader.AddNode(attennuated_refraction_color222);
            m_shader.AddNode(refraction223);
            m_shader.AddNode(diffuse_plus_glossy224);
            m_shader.AddNode(blend_in_transparency225);
            m_shader.AddNode(separate_envmap_texco226);
            m_shader.AddNode(flip_sign_envmap_texco_y196);
            m_shader.AddNode(recombine_envmap_texco227);
            m_shader.AddNode(environment_texture228);
            m_shader.AddNode(attenuated_environment_color229);
            m_shader.AddNode(diffuse_glossy_and_refraction230);
            m_shader.AddNode(environment_map_diffuse231);
            m_shader.AddNode(invert_roughness197);
            m_shader.AddNode(multiply_transparency198);
            m_shader.AddNode(multiply_with_shadowray199);
            m_shader.AddNode(custom_environment_blend233);
            m_shader.AddNode(coloured_shadow_trans_color234);
            m_shader.AddNode(weight_for_shadowray_coloured_shadow200);
            m_shader.AddNode(diffuse_from_emission_color247);
            m_shader.AddNode(shadeless_emission249);
            m_shader.AddNode(coloured_shadow_mix_custom237);
            m_shader.AddNode(diffuse_or_shadeless_emission250);
            m_shader.AddNode(invert_alpha191);
            m_shader.AddNode(transparency_texture235);
            m_shader.AddNode(transpluminance236);
            m_shader.AddNode(invert_luminence201);
            m_shader.AddNode(transparency_texture_amount202);
            m_shader.AddNode(toggle_diffuse_texture_alpha_usage203);
            m_shader.AddNode(toggle_transparency_texture204);
            m_shader.AddNode(add_emission_to_final248);
            m_shader.AddNode(transparent238);
            m_shader.AddNode(add_diffuse_texture_alpha205);
            m_shader.AddNode(custom_alpha_cutter239);
            m_shader.AddNode(principledbsdf240);
            m_shader.AddNode(coloured_shadow_mix_glass_principled241);


            texcoord207.outs.UV.Connect(diffuse_texture208.ins.Vector);
            diffuse_texture208.outs.Alpha.Connect(diffuse_texture_alpha_amount192.ins.Value1);
            diffuse_texture_alpha_amount192.outs.Value.Connect(diff_tex_alpha_multiplied_with_inv_transparency193.ins.Value1);
            invert_transparency189.outs.Value.Connect(diff_tex_alpha_multiplied_with_inv_transparency193.ins.Value2);
            texcoord207.outs.UV.Connect(bump_texture209.ins.Vector);
            bump_texture209.outs.Color.Connect(bump_texture_to_bw210.ins.Color);
            diffuse_texture208.outs.Color.Connect(diffuse_base_color_through_alpha244.ins.Color2);
            diff_tex_alpha_multiplied_with_inv_transparency193.outs.Value.Connect(diffuse_base_color_through_alpha244.ins.Fac);
            bump_texture_to_bw210.outs.Val.Connect(bump211.ins.Height);
            bump_amount194.outs.Value.Connect(bump211.ins.Strength);
            diffuse_base_color_through_alpha244.outs.Color.Connect(final_diffuse212.ins.Color);
            bump211.outs.Normal.Connect(final_diffuse212.ins.Normal);
            diffuse_base_color_through_alpha244.outs.Color.Connect(shadeless_bsdf213.ins.Color);
            light_path232.outs.IsCameraRay.Connect(shadeless_on_cameraray246.ins.Value1);
            bump211.outs.Normal.Connect(fresnel_based_on_constant215.ins.Normal);
            fresnel_based_on_constant215.outs.Fac.Connect(fresnel_reflection217.ins.R);
            simple_reflection216.outs.Image.Connect(select_reflection_or_fresnel_reflection218.ins.Color1);
            fresnel_reflection217.outs.Image.Connect(select_reflection_or_fresnel_reflection218.ins.Color2);
            fresnel_reflection_if_reflection_used195.outs.Value.Connect(select_reflection_or_fresnel_reflection218.ins.Fac);
            final_diffuse212.outs.BSDF.Connect(shadeless219.ins.Closure1);
            shadeless_bsdf213.outs.Emission.Connect(shadeless219.ins.Closure2);
            shadeless_on_cameraray246.outs.Value.Connect(shadeless219.ins.Fac);
            attenuated_reflection_color214.outs.Color.Connect(glossy220.ins.Color);
            bump211.outs.Normal.Connect(glossy220.ins.Normal);
            select_reflection_or_fresnel_reflection218.outs.Color.Connect(reflection_factor221.ins.Image);
            attennuated_refraction_color222.outs.Color.Connect(refraction223.ins.Color);
            bump211.outs.Normal.Connect(refraction223.ins.Normal);
            shadeless219.outs.Closure.Connect(diffuse_plus_glossy224.ins.Closure1);
            glossy220.outs.BSDF.Connect(diffuse_plus_glossy224.ins.Closure2);
            reflection_factor221.outs.R.Connect(diffuse_plus_glossy224.ins.Fac);
            shadeless219.outs.Closure.Connect(blend_in_transparency225.ins.Closure1);
            refraction223.outs.BSDF.Connect(blend_in_transparency225.ins.Closure2);
            texcoord207.outs.EnvEmap.Connect(separate_envmap_texco226.ins.Vector);
            separate_envmap_texco226.outs.Y.Connect(flip_sign_envmap_texco_y196.ins.Value1);
            separate_envmap_texco226.outs.X.Connect(recombine_envmap_texco227.ins.X);
            flip_sign_envmap_texco_y196.outs.Value.Connect(recombine_envmap_texco227.ins.Y);
            separate_envmap_texco226.outs.Z.Connect(recombine_envmap_texco227.ins.Z);
            recombine_envmap_texco227.outs.Vector.Connect(environment_texture228.ins.Vector);
            environment_texture228.outs.Color.Connect(attenuated_environment_color229.ins.Color2);
            diffuse_plus_glossy224.outs.Closure.Connect(diffuse_glossy_and_refraction230.ins.Closure1);
            blend_in_transparency225.outs.Closure.Connect(diffuse_glossy_and_refraction230.ins.Closure2);
            attenuated_environment_color229.outs.Color.Connect(environment_map_diffuse231.ins.Color);
            invert_roughness197.outs.Value.Connect(multiply_transparency198.ins.Value1);
            multiply_transparency198.outs.Value.Connect(multiply_with_shadowray199.ins.Value1);
            light_path232.outs.IsShadowRay.Connect(multiply_with_shadowray199.ins.Value2);
            diffuse_glossy_and_refraction230.outs.Closure.Connect(custom_environment_blend233.ins.Closure1);
            environment_map_diffuse231.outs.BSDF.Connect(custom_environment_blend233.ins.Closure2);
            diffuse_base_color_through_alpha244.outs.Color.Connect(coloured_shadow_trans_color234.ins.Color);
            multiply_with_shadowray199.outs.Value.Connect(weight_for_shadowray_coloured_shadow200.ins.Value1);
            custom_environment_blend233.outs.Closure.Connect(coloured_shadow_mix_custom237.ins.Closure1);
            coloured_shadow_trans_color234.outs.BSDF.Connect(coloured_shadow_mix_custom237.ins.Closure2);
            weight_for_shadowray_coloured_shadow200.outs.Value.Connect(coloured_shadow_mix_custom237.ins.Fac);
            diffuse_from_emission_color247.outs.BSDF.Connect(diffuse_or_shadeless_emission250.ins.Closure1);
            shadeless_emission249.outs.Emission.Connect(diffuse_or_shadeless_emission250.ins.Closure2);
            shadeless_on_cameraray246.outs.Value.Connect(diffuse_or_shadeless_emission250.ins.Fac);
            diffuse_texture208.outs.Alpha.Connect(invert_alpha191.ins.Value2);
            texcoord207.outs.UV.Connect(transparency_texture235.ins.Vector);
            transparency_texture235.outs.Color.Connect(transpluminance236.ins.Color);
            transpluminance236.outs.Val.Connect(invert_luminence201.ins.Value2);
            invert_luminence201.outs.Value.Connect(transparency_texture_amount202.ins.Value1);
            invert_alpha191.outs.Value.Connect(toggle_diffuse_texture_alpha_usage203.ins.Value1);
            transparency_texture_amount202.outs.Value.Connect(toggle_transparency_texture204.ins.Value2);
            coloured_shadow_mix_custom237.outs.Closure.Connect(add_emission_to_final248.ins.Closure1);
            diffuse_or_shadeless_emission250.outs.Closure.Connect(add_emission_to_final248.ins.Closure2);
            toggle_diffuse_texture_alpha_usage203.outs.Value.Connect(add_diffuse_texture_alpha205.ins.Value1);
            toggle_transparency_texture204.outs.Value.Connect(add_diffuse_texture_alpha205.ins.Value2);
            add_emission_to_final248.outs.Closure.Connect(custom_alpha_cutter239.ins.Closure1);
            transparent238.outs.BSDF.Connect(custom_alpha_cutter239.ins.Closure2);
            add_diffuse_texture_alpha205.outs.Value.Connect(custom_alpha_cutter239.ins.Fac);
            bump211.outs.Normal.Connect(principledbsdf240.ins.Normal);
            bump211.outs.Normal.Connect(principledbsdf240.ins.ClearcoatNormal);
            principledbsdf240.outs.BSDF.Connect(coloured_shadow_mix_glass_principled241.ins.Closure1);
            coloured_shadow_trans_color234.outs.BSDF.Connect(coloured_shadow_mix_glass_principled241.ins.Closure2);
            weight_for_shadowray_coloured_shadow200.outs.Value.Connect(coloured_shadow_mix_glass_principled241.ins.Fac);

            if (part.HasDiffuseTexture)
            {
                RenderEngine.SetTextureImage(diffuse_texture208, part.DiffuseTexture);
                RenderEngine.SetProjectionMode(m_shader, part.DiffuseTexture, diffuse_texture208, texcoord207);
            }

            if (part.HasBumpTexture)
            {
                RenderEngine.SetTextureImage(bump_texture209, part.BumpTexture);
                RenderEngine.SetProjectionMode(m_shader, part.BumpTexture, bump_texture209, texcoord207);
            }

            if (part.HasTransparencyTexture)
            {
                RenderEngine.SetTextureImage(transparency_texture235, part.TransparencyTexture);
                RenderEngine.SetProjectionMode(m_shader, part.TransparencyTexture, transparency_texture235, texcoord207);
            }

            if (part.HasEnvironmentTexture)
            {
                RenderEngine.SetTextureImage(environment_texture228, part.EnvironmentTexture);
                RenderEngine.SetProjectionMode(m_shader, part.EnvironmentTexture, environment_texture228, texcoord207);
            }

            if (part.CyclesMaterialType == ShaderBody.CyclesMaterial.Glass)
            {
                return(coloured_shadow_mix_glass_principled241);
            }
            return(custom_alpha_cutter239);
        }
Ejemplo n.º 3
0
        public override Shader GetShader()
        {
            if (!string.IsNullOrEmpty(m_original_background.Xml))
            {
                var xml = m_original_background.Xml;
                Shader.ShaderFromXml(ref m_shader, xml);
            }
            else
            {
                var texcoord210 = new TextureCoordinateNode("texcoord");

                var bg_env_texture255 = new EnvironmentTextureNode("bg_env_texture");
                bg_env_texture255.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                bg_env_texture255.ColorSpace    = TextureNode.TextureColorSpace.None;
                bg_env_texture255.Extension     = TextureNode.TextureExtension.Repeat;
                bg_env_texture255.Interpolation = InterpolationType.Linear;
                bg_env_texture255.IsLinear      = false;

                var bg_color_or_texture259 = new MixNode("bg_color_or_texture");
                bg_color_or_texture259.ins.Color1.Value = m_original_background.Color1AsFloat4;
                bg_color_or_texture259.ins.Fac.Value    = m_original_background.HasBgEnvTextureAsFloat;
                bg_color_or_texture259.BlendType        = MixNode.BlendTypes.Mix;
                bg_color_or_texture259.UseClamp         = false;

                var separate_bg_color265 = new SeparateRgbNode("separate_bg_color");

                var skylight_strength_factor302 = new MathMultiply("skylight_strength_factor");
                skylight_strength_factor302.ins.Value1.Value = m_original_background.BgStrength;
                skylight_strength_factor302.ins.Value2.Value = m_original_background.NonSkyEnvStrengthFactor;
                skylight_strength_factor302.Operation        = MathNode.Operations.Multiply;
                skylight_strength_factor302.UseClamp         = false;

                var factor_r262 = new MathMultiply("factor_r");
                factor_r262.Operation = MathNode.Operations.Multiply;
                factor_r262.UseClamp  = false;

                var factor_g263 = new MathMultiply("factor_g");
                factor_g263.Operation = MathNode.Operations.Multiply;
                factor_g263.UseClamp  = false;

                var factor_b264 = new MathMultiply("factor_b");
                factor_b264.Operation = MathNode.Operations.Multiply;
                factor_b264.UseClamp  = false;

                var gradienttexture281 = new GradientTextureNode("gradienttexture");

                var factored_bg_color266 = new CombineRgbNode("factored_bg_color");

                var gradient_colorramp282 = new ColorRampNode("gradient_colorramp");
                gradient_colorramp282.ColorBand.Stops.Add(new ColorStop()
                {
                    Color = new ccl.float4(0.9411765f, 0.5803922f, 0.07843138f, 1f), Position = 0f
                });
                gradient_colorramp282.ColorBand.Stops.Add(new ColorStop()
                {
                    Color = new ccl.float4(0.5019608f, 0f, 0f, 1f), Position = 1f
                });

                var refl_env_texture256 = new EnvironmentTextureNode("refl_env_texture");
                refl_env_texture256.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                refl_env_texture256.ColorSpace    = TextureNode.TextureColorSpace.None;
                refl_env_texture256.Extension     = TextureNode.TextureExtension.Repeat;
                refl_env_texture256.Interpolation = InterpolationType.Linear;
                refl_env_texture256.IsLinear      = false;

                var refl_color_or_texture260 = new MixNode("refl_color_or_texture");
                refl_color_or_texture260.ins.Color1.Value = m_original_background.ReflectionColorAs4float;
                refl_color_or_texture260.ins.Fac.Value    = m_original_background.HasReflEnvTextureAsFloat;
                refl_color_or_texture260.BlendType        = MixNode.BlendTypes.Mix;
                refl_color_or_texture260.UseClamp         = false;

                var separate_refl_color270 = new SeparateRgbNode("separate_refl_color");

                var skylight_strength_factor303 = new MathMultiply("skylight_strength_factor");
                skylight_strength_factor303.ins.Value1.Value = m_original_background.ReflStrength;
                skylight_strength_factor303.ins.Value2.Value = m_original_background.NonSkyEnvStrengthFactor;
                skylight_strength_factor303.Operation        = MathNode.Operations.Multiply;
                skylight_strength_factor303.UseClamp         = false;

                var factor_refl_r267 = new MathMultiply("factor_refl_r");
                factor_refl_r267.Operation = MathNode.Operations.Multiply;
                factor_refl_r267.UseClamp  = false;

                var factor_refl_g268 = new MathMultiply("factor_refl_g");
                factor_refl_g268.Operation = MathNode.Operations.Multiply;
                factor_refl_g268.UseClamp  = false;

                var factor_refl_b269 = new MathMultiply("factor_refl_b");
                factor_refl_b269.Operation = MathNode.Operations.Multiply;
                factor_refl_b269.UseClamp  = false;

                var light_path235 = new LightPathNode("light_path");

                var use_reflect_refract_when_glossy_and_reflection285 = new MathMultiply("use_reflect_refract_when_glossy_and_reflection");
                use_reflect_refract_when_glossy_and_reflection285.Operation = MathNode.Operations.Multiply;
                use_reflect_refract_when_glossy_and_reflection285.UseClamp  = false;

                var gradient_or_other283 = new MixNode("gradient_or_other");
                gradient_or_other283.ins.Fac.Value = m_original_background.UseGradientAsFloat;
                gradient_or_other283.BlendType     = MixNode.BlendTypes.Mix;
                gradient_or_other283.UseClamp      = false;

                var factored_refl_color271 = new CombineRgbNode("factored_refl_color");

                var refl_env_when_enabled286 = new MathMultiply("refl_env_when_enabled");
                refl_env_when_enabled286.ins.Value1.Value = m_original_background.UseCustomReflectionEnvironmentAsFloat;
                refl_env_when_enabled286.Operation        = MathNode.Operations.Multiply;
                refl_env_when_enabled286.UseClamp         = false;

                var skycolor_or_final_bg284 = new MixNode("skycolor_or_final_bg");
                skycolor_or_final_bg284.ins.Color2.Value = m_original_background.SkyColorAs4float;
                skycolor_or_final_bg284.ins.Fac.Value    = m_original_background.UseSkyColorAsFloat;
                skycolor_or_final_bg284.BlendType        = MixNode.BlendTypes.Mix;
                skycolor_or_final_bg284.UseClamp         = false;

                var sky_env_texture257 = new EnvironmentTextureNode("sky_env_texture");
                sky_env_texture257.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                sky_env_texture257.ColorSpace    = TextureNode.TextureColorSpace.None;
                sky_env_texture257.Extension     = TextureNode.TextureExtension.Repeat;
                sky_env_texture257.Interpolation = InterpolationType.Linear;
                sky_env_texture257.IsLinear      = false;

                var sky_color_or_texture258 = new MixNode("sky_color_or_texture");
                sky_color_or_texture258.ins.Fac.Value = m_original_background.HasSkyEnvTextureAsFloat;
                sky_color_or_texture258.BlendType     = MixNode.BlendTypes.Mix;
                sky_color_or_texture258.UseClamp      = false;

                var separate_sky_color275 = new SeparateRgbNode("separate_sky_color");

                var sky_or_not261 = new MathMultiply("sky_or_not");
                sky_or_not261.ins.Value1.Value = m_original_background.SkyStrength;
                sky_or_not261.ins.Value2.Value = m_original_background.SkylightEnabledAsFloat;
                sky_or_not261.Operation        = MathNode.Operations.Multiply;
                sky_or_not261.UseClamp         = false;

                var factor_sky_r272 = new MathMultiply("factor_sky_r");
                factor_sky_r272.Operation = MathNode.Operations.Multiply;
                factor_sky_r272.UseClamp  = false;

                var factor_sky_g273 = new MathMultiply("factor_sky_g");
                factor_sky_g273.Operation = MathNode.Operations.Multiply;
                factor_sky_g273.UseClamp  = false;

                var factor_sky_b274 = new MathMultiply("factor_sky_b");
                factor_sky_b274.Operation = MathNode.Operations.Multiply;
                factor_sky_b274.UseClamp  = false;

                var factored_sky_color276 = new CombineRgbNode("factored_sky_color");

                var non_camera_rays290 = new MathSubtract("non_camera_rays");
                non_camera_rays290.ins.Value1.Value = 1f;
                non_camera_rays290.Operation        = MathNode.Operations.Subtract;
                non_camera_rays290.UseClamp         = false;

                var camera_and_transmission294 = new MathAdd("camera_and_transmission");
                camera_and_transmission294.Operation = MathNode.Operations.Add;
                camera_and_transmission294.UseClamp  = false;

                var invert_refl_switch300 = new MathSubtract("invert_refl_switch");
                invert_refl_switch300.ins.Value1.Value = 1f;
                invert_refl_switch300.Operation        = MathNode.Operations.Subtract;
                invert_refl_switch300.UseClamp         = false;

                var invert_cam_and_transm292 = new MathSubtract("invert_cam_and_transm");
                invert_cam_and_transm292.ins.Value1.Value = 1f;
                invert_cam_and_transm292.Operation        = MathNode.Operations.Subtract;
                invert_cam_and_transm292.UseClamp         = false;

                var refl_bg_or_custom_env291 = new MixNode("refl_bg_or_custom_env");
                refl_bg_or_custom_env291.BlendType = MixNode.BlendTypes.Mix;
                refl_bg_or_custom_env291.UseClamp  = false;

                var light_with_bg_or_sky289 = new MixNode("light_with_bg_or_sky");
                light_with_bg_or_sky289.BlendType = MixNode.BlendTypes.Mix;
                light_with_bg_or_sky289.UseClamp  = false;

                var if_not_cam_nor_transm_nor_glossyrefl301 = new MathMultiply("if_not_cam_nor_transm_nor_glossyrefl");
                if_not_cam_nor_transm_nor_glossyrefl301.Operation = MathNode.Operations.Multiply;
                if_not_cam_nor_transm_nor_glossyrefl301.UseClamp  = false;

                var mix295 = new MixNode("mix");
                mix295.BlendType = MixNode.BlendTypes.Mix;
                mix295.UseClamp  = false;

                var final_bg280 = new BackgroundNode("final_bg");
                final_bg280.ins.Strength.Value = 1f;


                m_shader.AddNode(texcoord210);
                m_shader.AddNode(bg_env_texture255);
                m_shader.AddNode(bg_color_or_texture259);
                m_shader.AddNode(separate_bg_color265);
                m_shader.AddNode(skylight_strength_factor302);
                m_shader.AddNode(factor_r262);
                m_shader.AddNode(factor_g263);
                m_shader.AddNode(factor_b264);
                m_shader.AddNode(gradienttexture281);
                m_shader.AddNode(factored_bg_color266);
                m_shader.AddNode(gradient_colorramp282);
                m_shader.AddNode(refl_env_texture256);
                m_shader.AddNode(refl_color_or_texture260);
                m_shader.AddNode(separate_refl_color270);
                m_shader.AddNode(skylight_strength_factor303);
                m_shader.AddNode(factor_refl_r267);
                m_shader.AddNode(factor_refl_g268);
                m_shader.AddNode(factor_refl_b269);
                m_shader.AddNode(light_path235);
                m_shader.AddNode(use_reflect_refract_when_glossy_and_reflection285);
                m_shader.AddNode(gradient_or_other283);
                m_shader.AddNode(factored_refl_color271);
                m_shader.AddNode(refl_env_when_enabled286);
                m_shader.AddNode(skycolor_or_final_bg284);
                m_shader.AddNode(sky_env_texture257);
                m_shader.AddNode(sky_color_or_texture258);
                m_shader.AddNode(separate_sky_color275);
                m_shader.AddNode(sky_or_not261);
                m_shader.AddNode(factor_sky_r272);
                m_shader.AddNode(factor_sky_g273);
                m_shader.AddNode(factor_sky_b274);
                m_shader.AddNode(factored_sky_color276);
                m_shader.AddNode(non_camera_rays290);
                m_shader.AddNode(camera_and_transmission294);
                m_shader.AddNode(invert_refl_switch300);
                m_shader.AddNode(invert_cam_and_transm292);
                m_shader.AddNode(refl_bg_or_custom_env291);
                m_shader.AddNode(light_with_bg_or_sky289);
                m_shader.AddNode(if_not_cam_nor_transm_nor_glossyrefl301);
                m_shader.AddNode(mix295);
                m_shader.AddNode(final_bg280);


                texcoord210.outs.Generated.Connect(bg_env_texture255.ins.Vector);
                bg_env_texture255.outs.Color.Connect(bg_color_or_texture259.ins.Color2);
                bg_color_or_texture259.outs.Color.Connect(separate_bg_color265.ins.Image);
                separate_bg_color265.outs.R.Connect(factor_r262.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_r262.ins.Value2);
                separate_bg_color265.outs.G.Connect(factor_g263.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_g263.ins.Value2);
                separate_bg_color265.outs.B.Connect(factor_b264.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_b264.ins.Value2);
                texcoord210.outs.Window.Connect(gradienttexture281.ins.Vector);
                factor_r262.outs.Value.Connect(factored_bg_color266.ins.R);
                factor_g263.outs.Value.Connect(factored_bg_color266.ins.G);
                factor_b264.outs.Value.Connect(factored_bg_color266.ins.B);
                gradienttexture281.outs.Fac.Connect(gradient_colorramp282.ins.Fac);
                texcoord210.outs.Generated.Connect(refl_env_texture256.ins.Vector);
                refl_env_texture256.outs.Color.Connect(refl_color_or_texture260.ins.Color2);
                refl_color_or_texture260.outs.Color.Connect(separate_refl_color270.ins.Image);
                separate_refl_color270.outs.R.Connect(factor_refl_r267.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_r267.ins.Value2);
                separate_refl_color270.outs.G.Connect(factor_refl_g268.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_g268.ins.Value2);
                separate_refl_color270.outs.B.Connect(factor_refl_b269.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_b269.ins.Value2);
                light_path235.outs.IsGlossyRay.Connect(use_reflect_refract_when_glossy_and_reflection285.ins.Value1);
                light_path235.outs.IsReflectionRay.Connect(use_reflect_refract_when_glossy_and_reflection285.ins.Value2);
                factored_bg_color266.outs.Image.Connect(gradient_or_other283.ins.Color1);
                gradient_colorramp282.outs.Color.Connect(gradient_or_other283.ins.Color2);
                factor_refl_r267.outs.Value.Connect(factored_refl_color271.ins.R);
                factor_refl_g268.outs.Value.Connect(factored_refl_color271.ins.G);
                factor_refl_b269.outs.Value.Connect(factored_refl_color271.ins.B);
                use_reflect_refract_when_glossy_and_reflection285.outs.Value.Connect(refl_env_when_enabled286.ins.Value2);
                gradient_or_other283.outs.Color.Connect(skycolor_or_final_bg284.ins.Color1);
                texcoord210.outs.Generated.Connect(sky_env_texture257.ins.Vector);
                skycolor_or_final_bg284.outs.Color.Connect(sky_color_or_texture258.ins.Color1);
                sky_env_texture257.outs.Color.Connect(sky_color_or_texture258.ins.Color2);
                sky_color_or_texture258.outs.Color.Connect(separate_sky_color275.ins.Image);
                separate_sky_color275.outs.R.Connect(factor_sky_r272.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_r272.ins.Value2);
                separate_sky_color275.outs.G.Connect(factor_sky_g273.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_g273.ins.Value2);
                separate_sky_color275.outs.B.Connect(factor_sky_b274.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_b274.ins.Value2);
                factor_sky_r272.outs.Value.Connect(factored_sky_color276.ins.R);
                factor_sky_g273.outs.Value.Connect(factored_sky_color276.ins.G);
                factor_sky_b274.outs.Value.Connect(factored_sky_color276.ins.B);
                light_path235.outs.IsCameraRay.Connect(non_camera_rays290.ins.Value2);
                light_path235.outs.IsCameraRay.Connect(camera_and_transmission294.ins.Value1);
                light_path235.outs.IsTransmissionRay.Connect(camera_and_transmission294.ins.Value2);
                refl_env_when_enabled286.outs.Value.Connect(invert_refl_switch300.ins.Value2);
                camera_and_transmission294.outs.Value.Connect(invert_cam_and_transm292.ins.Value2);
                gradient_or_other283.outs.Color.Connect(refl_bg_or_custom_env291.ins.Color1);
                factored_refl_color271.outs.Image.Connect(refl_bg_or_custom_env291.ins.Color2);
                refl_env_when_enabled286.outs.Value.Connect(refl_bg_or_custom_env291.ins.Fac);
                gradient_or_other283.outs.Color.Connect(light_with_bg_or_sky289.ins.Color1);
                factored_sky_color276.outs.Image.Connect(light_with_bg_or_sky289.ins.Color2);
                non_camera_rays290.outs.Value.Connect(light_with_bg_or_sky289.ins.Fac);
                invert_refl_switch300.outs.Value.Connect(if_not_cam_nor_transm_nor_glossyrefl301.ins.Value1);
                invert_cam_and_transm292.outs.Value.Connect(if_not_cam_nor_transm_nor_glossyrefl301.ins.Value2);
                refl_bg_or_custom_env291.outs.Color.Connect(mix295.ins.Color1);
                light_with_bg_or_sky289.outs.Color.Connect(mix295.ins.Color2);
                if_not_cam_nor_transm_nor_glossyrefl301.outs.Value.Connect(mix295.ins.Fac);
                mix295.outs.Color.Connect(final_bg280.ins.Color);

                // extra code

                gradient_colorramp282.ColorBand.Stops.Clear();
                // bottom color on 0.0f
                gradient_colorramp282.ColorBand.InsertColorStop(m_original_background.Color2AsFloat4, 0.0f);
                // top color on 1.0f
                gradient_colorramp282.ColorBand.InsertColorStop(m_original_background.Color1AsFloat4, 1.0f);

                // rotate the window vector
                gradienttexture281.Rotation = RenderEngine.CreateFloat4(0.0, 0.0, 1.570796);

                if (m_original_background.BackgroundFill == BackgroundStyle.Environment && m_original_background.HasBgEnvTexture)
                {
                    RenderEngine.SetTextureImage(bg_env_texture255, m_original_background.BgTexture);
                    _SetEnvironmentProjection(m_original_background.BgTexture, bg_env_texture255);
                    bg_env_texture255.Rotation = m_original_background.BgTexture.Transform.z;
                }
                if (m_original_background.BackgroundFill == BackgroundStyle.WallpaperImage && m_original_background.Wallpaper.HasTextureImage)
                {
                    RenderEngine.SetTextureImage(bg_env_texture255, m_original_background.Wallpaper);
                    bg_env_texture255.Projection = TextureNode.EnvironmentProjection.Wallpaper;
                }
                if (m_original_background.HasReflEnvTexture)
                {
                    RenderEngine.SetTextureImage(refl_env_texture256, m_original_background.ReflectionTexture);
                    _SetEnvironmentProjection(m_original_background.ReflectionTexture, refl_env_texture256);
                }
                if (m_original_background.HasSkyEnvTexture)
                {
                    RenderEngine.SetTextureImage(sky_env_texture257, m_original_background.SkyTexture);
                    _SetEnvironmentProjection(m_original_background.SkyTexture, sky_env_texture257);
                }

                final_bg280.outs.Background.Connect(m_shader.Output.ins.Surface);
            }

            // phew, done.
            m_shader.FinalizeGraph();
            m_shader.Tag();

            return(m_shader);
        }