public override void GenerateShader(MaterialGeneratorContext context)
        {
            base.GenerateShader(context);

            var attributes = context.CurrentMaterialDescriptor.Attributes;

            int glassPassIndex = context.PassIndex % 2;

            if (attributes.CullMode == CullMode.None)
            {
                context.MaterialPass.CullMode = context.PassIndex < 2 ? CullMode.Back : CullMode.Front;
            }
            else
            {
                context.MaterialPass.CullMode = attributes.CullMode;
            }

            // Compute transmittance
            context.GetShading(this).LightDependentExtraModels.Add(new ShaderClassSource("MaterialTransmittanceReflectanceStream"));

            context.Parameters.Set(MaterialTransmittanceReflectanceStreamKeys.RefractiveIndex, RefractiveIndex);
            context.MaterialPass.HasTransparency = true;
            if (glassPassIndex == 0)
            {
                // Transmittance pass
                context.MaterialPass.BlendState = new BlendStateDescription(Blend.Zero, Blend.SourceColor)
                {
                    RenderTarget0 = { AlphaSourceBlend = Blend.One, AlphaDestinationBlend = Blend.Zero }
                };

                // Shader output is matTransmittance
                // Note: we make sure to run after MaterialTransparencyBlendFeature so that shadingColorAlpha is fully updated
                context.AddFinalCallback(MaterialShaderStage.Pixel, AddMaterialSurfaceTransmittanceShading, MaterialTransparencyBlendFeature.ShadingColorAlphaFinalCallbackOrder + 1);
            }
            else if (glassPassIndex == 1)
            {
                // Reflectance pass
                context.MaterialPass.BlendState = BlendStates.Additive;
            }
        }