Ejemplo n.º 1
0
        /// <summary>
        /// Renders the properties in the block.
        /// </summary>
        protected override void OnGUIOpen()
        {
            EditorGUI.BeginChangeCheck();
            float val = EditorGUILayout.Popup(Styles.mappingModeText, (int)m_MappingMode.floatValue, MappingModeNames);

            if (EditorGUI.EndChangeCheck())
            {
                Material material = materialEditor.target as Material;
                Undo.RecordObject(material, "Change Mapping Mode");
                m_MappingMode.floatValue = val;
            }

            AxFMappingMode mappingMode = (AxFMappingMode)m_MappingMode.floatValue;

            m_MappingMask.vectorValue = AxFGUI.AxFMappingModeToMask(mappingMode);

            if (mappingMode >= AxFMappingMode.PlanarXY)
            {
                ++EditorGUI.indentLevel;
                materialEditor.ShaderProperty(m_PlanarSpace, Styles.planarSpaceText);
                --EditorGUI.indentLevel;
            }

            materialEditor.ShaderProperty(m_MaterialTilingOffset, Styles.materialTilingOffsetText);

            // We only display the ray tracing option if the asset supports it
            if ((RenderPipelineManager.currentPipeline as HDRenderPipeline).rayTracingSupported)
            {
                materialEditor.ShaderProperty(m_RayTracingTexFilteringScale, Styles.rayTracingTexFilteringScaleText);
            }
        }
        void DrawMainAxfSurfaceInputsGUI()
        {
            EditorGUI.BeginChangeCheck();
            float val = EditorGUILayout.Popup(Styles.mappingModeText, (int)m_MappingMode.floatValue, MappingModeNames);

            if (EditorGUI.EndChangeCheck())
            {
                Material material = materialEditor.target as Material;
                Undo.RecordObject(material, "Change Mapping Mode");
                m_MappingMode.floatValue = val;
            }

            AxFMappingMode mappingMode = (AxFMappingMode)m_MappingMode.floatValue;

            m_MappingMask.vectorValue = AxFGUI.AxFMappingModeToMask(mappingMode);

            if (mappingMode >= AxFMappingMode.PlanarXY)
            {
                ++EditorGUI.indentLevel;
                materialEditor.ShaderProperty(m_PlanarSpace, Styles.planarSpaceText);
                --EditorGUI.indentLevel;
            }

            materialEditor.ShaderProperty(m_MaterialTilingOffset, Styles.materialTilingOffsetText);
        }
Ejemplo n.º 3
0
        // All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change
        static public void SetupMaterialKeywordsAndPass(Material material)
        {
            material.SetupBaseUnlitKeywords();
            material.SetupBaseUnlitPass();

            AxfBrdfType BRDFType = (AxfBrdfType)material.GetFloat(kAxF_BRDFType);

            CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_SVBRDF", BRDFType == AxfBrdfType.SVBRDF);
            CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_CAR_PAINT", BRDFType == AxfBrdfType.CAR_PAINT);
            CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_BTF", BRDFType == AxfBrdfType.BTF);


            // Mapping Modes:
            AxFMappingMode mappingMode = (AxFMappingMode)material.GetFloat(kMappingMode);

            // Make sure the mask is synched:
            material.SetVector(kMappingMask, AxFMappingModeToMask(mappingMode));

            bool mappingIsPlanar = (mappingMode >= AxFMappingMode.PlanarXY) && (mappingMode < AxFMappingMode.Triplanar);
            bool planarIsLocal   = (material.GetFloat(kPlanarSpace) > 0.0f);

            CoreUtils.SetKeyword(material, "_MAPPING_PLANAR", mappingIsPlanar);
            CoreUtils.SetKeyword(material, "_MAPPING_TRIPLANAR", mappingMode == AxFMappingMode.Triplanar);

            if (mappingIsPlanar || mappingMode == AxFMappingMode.Triplanar)
            {
                CoreUtils.SetKeyword(material, "_PLANAR_LOCAL", planarIsLocal);
            }

            // Note: for ShaderPass defines for vertmesh/varyingmesh setup, we still use the same
            // defines _REQUIRE_UV2 and _REQUIRE_UV3, and thus if eg _REQUIRE_UV3 is defined, _REQUIRE_UV2 will
            // be assumed to be needed. But here in the AxFData sampling code, we use these to indicate precisely
            // the single set used (if not using planar/triplanar) only and thus add _REQUIRE_UV1.
            // Extra UVs might be transfered but we only need and support a single set at a time for the whole material.
            CoreUtils.SetKeyword(material, "_REQUIRE_UV1", mappingMode == AxFMappingMode.UV1);
            CoreUtils.SetKeyword(material, "_REQUIRE_UV2", mappingMode == AxFMappingMode.UV2);
            CoreUtils.SetKeyword(material, "_REQUIRE_UV3", mappingMode == AxFMappingMode.UV3);

            // Keywords for opt-out of decals and SSR:
            bool decalsEnabled = material.HasProperty(kEnableDecals) && material.GetFloat(kEnableDecals) > 0.0f;

            CoreUtils.SetKeyword(material, "_DISABLE_DECALS", decalsEnabled == false);
            bool ssrEnabled = material.HasProperty(kEnableSSR) && material.GetFloat(kEnableSSR) > 0.0f;

            CoreUtils.SetKeyword(material, "_DISABLE_SSR", ssrEnabled == false);
            CoreUtils.SetKeyword(material, "_ENABLE_GEOMETRIC_SPECULAR_AA", material.HasProperty(kEnableGeometricSpecularAA) && material.GetFloat(kEnableGeometricSpecularAA) > 0.0f);
            CoreUtils.SetKeyword(material, "_SPECULAR_OCCLUSION_NONE", material.HasProperty(kSpecularOcclusionMode) && material.GetFloat(kSpecularOcclusionMode) == 0.0f);

            BaseLitGUI.SetupStencil(material, receivesSSR: ssrEnabled, useSplitLighting: false);

            if (material.HasProperty(kAddPrecomputedVelocity))
            {
                CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Renders the properties in the block.
        /// </summary>
        protected override void OnGUIOpen()
        {
            materialEditor.PopupShaderProperty(m_MappingMode, Styles.mappingModeText, MappingModeNames);

            AxFMappingMode mappingMode = (AxFMappingMode)m_MappingMode.floatValue;

            m_MappingMask.vectorValue = AxFAPI.AxFMappingModeToMask(mappingMode);

            if (mappingMode >= AxFMappingMode.PlanarXY)
            {
                ++EditorGUI.indentLevel;
                materialEditor.ShaderProperty(m_PlanarSpace, Styles.planarSpaceText);
                --EditorGUI.indentLevel;
            }

            materialEditor.ShaderProperty(m_MaterialTilingOffset, Styles.materialTilingOffsetText);

            // We only display the ray tracing option if the asset supports it
            if ((RenderPipelineManager.currentPipeline as HDRenderPipeline).rayTracingSupported)
            {
                materialEditor.ShaderProperty(m_RayTracingTexFilteringScale, Styles.rayTracingTexFilteringScaleText);
            }
        }
Ejemplo n.º 5
0
        static public Vector4 AxFMappingModeToMask(AxFMappingMode mappingMode)
        {
            Vector4 mask = Vector4.zero;

            if (mappingMode <= AxFMappingMode.UV3)
            {
                float X, Y, Z, W;
                X    = (mappingMode == AxFMappingMode.UV0) ? 1.0f : 0.0f;
                Y    = (mappingMode == AxFMappingMode.UV1) ? 1.0f : 0.0f;
                Z    = (mappingMode == AxFMappingMode.UV2) ? 1.0f : 0.0f;
                W    = (mappingMode == AxFMappingMode.UV3) ? 1.0f : 0.0f;
                mask = new Vector4(X, Y, Z, W);
            }
            else if (mappingMode < AxFMappingMode.Triplanar)
            {
                float X, Y, Z, W;
                X    = (mappingMode == AxFMappingMode.PlanarYZ) ? 1.0f : 0.0f;
                Y    = (mappingMode == AxFMappingMode.PlanarZX) ? 1.0f : 0.0f;
                Z    = (mappingMode == AxFMappingMode.PlanarXY) ? 1.0f : 0.0f;
                W    = 0.0f;
                mask = new Vector4(X, Y, Z, W);
            }
            return(mask);
        }
Ejemplo n.º 6
0
        // All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change
        static public void SetupAxFKeywordsAndPass(Material material)
        {
            material.SetupBaseUnlitKeywords();
            material.SetupBaseUnlitPass();

            AxfBrdfType BRDFType = (AxfBrdfType)material.GetFloat(kAxF_BRDFType);

            CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_SVBRDF", BRDFType == AxfBrdfType.SVBRDF);
            CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_CAR_PAINT", BRDFType == AxfBrdfType.CAR_PAINT);
            //unsupported for now: CoreUtils.SetKeyword(material, "_AXF_BRDF_TYPE_BTF", BRDFType == AxfBrdfType.BTF);


            // Mapping Modes:
            AxFMappingMode mappingMode = (AxFMappingMode)material.GetFloat(kMappingMode);

            // Make sure the mask is synched:
            material.SetVector(kMappingMask, AxFMappingModeToMask(mappingMode));

            bool mappingIsPlanar = (mappingMode >= AxFMappingMode.PlanarXY) && (mappingMode < AxFMappingMode.Triplanar);
            bool planarIsLocal   = (material.GetFloat(kPlanarSpace) > 0.0f);

            CoreUtils.SetKeyword(material, "_MAPPING_PLANAR", mappingIsPlanar);
            CoreUtils.SetKeyword(material, "_MAPPING_TRIPLANAR", mappingMode == AxFMappingMode.Triplanar);

            if (mappingIsPlanar || mappingMode == AxFMappingMode.Triplanar)
            {
                CoreUtils.SetKeyword(material, "_PLANAR_LOCAL", planarIsLocal);
            }

            // Note: for ShaderPass defines for vertmesh/varyingmesh setup, we still use the same
            // defines _REQUIRE_UV2 and _REQUIRE_UV3, and thus if eg _REQUIRE_UV3 is defined, _REQUIRE_UV2 will
            // be assumed to be needed. But here in the AxFData sampling code, we use these to indicate precisely
            // the single set used (if not using planar/triplanar) only and thus add _REQUIRE_UV1.
            // Extra UVs might be transfered but we only need and support a single set at a time for the whole material.
            CoreUtils.SetKeyword(material, "_REQUIRE_UV1", mappingMode == AxFMappingMode.UV1);
            CoreUtils.SetKeyword(material, "_REQUIRE_UV2", mappingMode == AxFMappingMode.UV2);
            CoreUtils.SetKeyword(material, "_REQUIRE_UV3", mappingMode == AxFMappingMode.UV3);

            // Keywords for opt-out of decals and SSR:
            bool decalsEnabled = material.HasProperty(kEnableDecals) && material.GetFloat(kEnableDecals) > 0.0f;

            CoreUtils.SetKeyword(material, "_DISABLE_DECALS", !decalsEnabled);

            bool ssrEnabled = false;

            if (material.GetSurfaceType() == SurfaceType.Transparent)
            {
                ssrEnabled = material.HasProperty(kReceivesSSRTransparent) ? material.GetFloat(kReceivesSSRTransparent) != 0 : false;
            }
            else
            {
                ssrEnabled = material.HasProperty(kReceivesSSR) ? material.GetFloat(kReceivesSSR) != 0 : false;
            }
            CoreUtils.SetKeyword(material, "_DISABLE_SSR", material.HasProperty(kReceivesSSR) && material.GetFloat(kReceivesSSR) == 0.0f);
            CoreUtils.SetKeyword(material, "_DISABLE_SSR_TRANSPARENT", material.HasProperty(kReceivesSSRTransparent) && material.GetFloat(kReceivesSSRTransparent) == 0.0);
            CoreUtils.SetKeyword(material, "_ENABLE_GEOMETRIC_SPECULAR_AA", material.HasProperty(kEnableGeometricSpecularAA) && material.GetFloat(kEnableGeometricSpecularAA) > 0.0f);
            CoreUtils.SetKeyword(material, "_SPECULAR_OCCLUSION_NONE", material.HasProperty(kSpecularOcclusionMode) && material.GetFloat(kSpecularOcclusionMode) == 0.0f);

            BaseLitGUI.SetupStencil(material, receivesSSR: ssrEnabled, useSplitLighting: false);

            if (material.HasProperty(kAddPrecomputedVelocity))
            {
                CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0);
            }
            //
            // Patch for raytracing for now: mirror int props as float explicitly
            //
            uint flags = (uint)material.GetFloat(kFlags);

            flags |= (uint)AxF.FeatureFlags.AxfDebugTest; // force bit 23 = 1
            material.SetFloat(kFlagsB, flags);

            uint SVBRDFType     = (uint)material.GetFloat(kSVBRDF_BRDFType);
            uint SVBRDFVariants = (uint)material.GetFloat(kSVBRDF_BRDFVariants);

            SvbrdfDiffuseType          diffuseType    = (SvbrdfDiffuseType)(SVBRDFType & 0x1);
            SvbrdfSpecularType         specularType   = (SvbrdfSpecularType)((SVBRDFType >> 1) & 0x7);
            SvbrdfFresnelVariant       fresnelVariant = (SvbrdfFresnelVariant)(SVBRDFVariants & 0x3);
            SvbrdfSpecularVariantWard  wardVariant    = (SvbrdfSpecularVariantWard)((SVBRDFVariants >> 2) & 0x3);
            SvbrdfSpecularVariantBlinn blinnVariant   = (SvbrdfSpecularVariantBlinn)((SVBRDFVariants >> 4) & 0x3);

            material.SetFloat(kSVBRDF_BRDFType_DiffuseType, (float)diffuseType);
            material.SetFloat(kSVBRDF_BRDFType_SpecularType, (float)specularType);
            material.SetFloat(kSVBRDF_BRDFVariants_FresnelType, (float)fresnelVariant);
            material.SetFloat(kSVBRDF_BRDFVariants_WardType, (float)wardVariant);
            material.SetFloat(kSVBRDF_BRDFVariants_BlinnType, (float)blinnVariant);

            material.SetFloat(kCarPaint2_FlakeMaxThetaI + kIntPropAsFloatSuffix, material.GetFloat(kCarPaint2_FlakeMaxThetaI));
            material.SetFloat(kCarPaint2_FlakeNumThetaF + kIntPropAsFloatSuffix, material.GetFloat(kCarPaint2_FlakeNumThetaF));
            material.SetFloat(kCarPaint2_FlakeNumThetaI + kIntPropAsFloatSuffix, material.GetFloat(kCarPaint2_FlakeNumThetaI));
        }
        void DrawAxfSurfaceOptionsGUI()
        {
            //materialEditor.ShaderProperty(m_MappingMode, Styles.mappingModeText);
            EditorGUI.BeginChangeCheck();
            float val = EditorGUILayout.Popup(Styles.mappingModeText, (int)m_MappingMode.floatValue, MappingModeNames);

            if (EditorGUI.EndChangeCheck())
            {
                Material material = materialEditor.target as Material;
                Undo.RecordObject(material, "Change Mapping Mode");
                m_MappingMode.floatValue = val;
            }

            AxFMappingMode mappingMode = (AxFMappingMode)m_MappingMode.floatValue;

            m_MappingMask.vectorValue = AxFGUI.AxFMappingModeToMask(mappingMode);

            if (mappingMode >= AxFMappingMode.PlanarXY)
            {
                ++EditorGUI.indentLevel;
                materialEditor.ShaderProperty(m_PlanarSpace, Styles.planarSpaceText);
                --EditorGUI.indentLevel;
            }

            materialEditor.ShaderProperty(m_MaterialTilingOffset, Styles.materialTilingOffsetText);

            AxfBrdfType AxF_BRDFType = (AxfBrdfType)m_AxF_BRDFType.floatValue;

            AxF_BRDFType = (AxfBrdfType)EditorGUILayout.Popup("BRDF Type", (int)AxF_BRDFType, AxfBrdfTypeNames);
            m_AxF_BRDFType.floatValue = (float)AxF_BRDFType;

            // Extract flag:
            uint flags = (uint)m_Flags.floatValue;

            ExtractFlags(flags,
                         out bool anisotropy, out bool clearcoat, out bool clearcoatRefraction, out bool useHeightMap, out bool brdfColorDiagonalClamp,
                         out bool honorMinRoughness);

            switch (AxF_BRDFType)
            {
            case AxfBrdfType.SVBRDF:
            {
                EditorGUILayout.Space();
                ++EditorGUI.indentLevel;

                // Read as compact flags
                //uint    flags = (uint)m_Flags.floatValue;
                uint BRDFType     = (uint)m_SVBRDF_BRDFType.floatValue;
                uint BRDFVariants = (uint)m_SVBRDF_BRDFVariants.floatValue;

                SvbrdfDiffuseType          diffuseType    = (SvbrdfDiffuseType)(BRDFType & 0x1);
                SvbrdfSpecularType         specularType   = (SvbrdfSpecularType)((BRDFType >> 1) & 0x7);
                SvbrdfFresnelVariant       fresnelVariant = (SvbrdfFresnelVariant)(BRDFVariants & 0x3);
                SvbrdfSpecularVariantWard  wardVariant    = (SvbrdfSpecularVariantWard)((BRDFVariants >> 2) & 0x3);
                SvbrdfSpecularVariantBlinn blinnVariant   = (SvbrdfSpecularVariantBlinn)((BRDFVariants >> 4) & 0x3);

                // Expand as user-friendly UI
//                     EditorGUILayout.LabelField( "Flags", EditorStyles.boldLabel );
                EditorGUILayout.LabelField("BRDF Variants", EditorStyles.boldLabel);

                diffuseType  = (SvbrdfDiffuseType)EditorGUILayout.Popup("Diffuse Type", (int)diffuseType, SvbrdfDiffuseTypeNames);
                specularType = (SvbrdfSpecularType)EditorGUILayout.Popup("Specular Type", (int)specularType, SvbrdfSpecularTypeNames);

                if (specularType == SvbrdfSpecularType.WARD)
                {
                    fresnelVariant = (SvbrdfFresnelVariant)EditorGUILayout.Popup("Fresnel Variant", (int)fresnelVariant, SvbrdfFresnelVariantNames);
                    wardVariant    = (SvbrdfSpecularVariantWard)EditorGUILayout.Popup("Ward Variant", (int)wardVariant, SvbrdfSpecularVariantWardNames);
                }
                else if (specularType == SvbrdfSpecularType.BLINN_PHONG)
                {
                    blinnVariant = (SvbrdfSpecularVariantBlinn)EditorGUILayout.Popup("Blinn Variant", (int)blinnVariant, SvbrdfSpecularVariantBlinnNames);
                }

                // Regular maps
                materialEditor.TexturePropertySingleLine(Styles.diffuseColorMapText, m_DiffuseColorMap, m_DiffuseColorMapST);
                materialEditor.TexturePropertySingleLine(Styles.specularColorMapText, m_SpecularColorMap, m_SpecularColorMapST);
                materialEditor.TexturePropertySingleLine(Styles.specularLobeMapText, m_SpecularLobeMap, m_SpecularLobeMapST);
                m_SpecularLobeMapScale.floatValue = EditorGUILayout.FloatField(Styles.specularLobeMapScaleText, m_SpecularLobeMapScale.floatValue);
                materialEditor.TexturePropertySingleLine(Styles.fresnelMapText, m_FresnelMap, m_FresnelMapST);
                materialEditor.TexturePropertySingleLine(Styles.normalMapText, m_NormalMap, m_NormalMapST);

                // Alpha
                materialEditor.TexturePropertySingleLine(Styles.alphaMapText, m_AlphaMap, m_AlphaMapST);

                // Displacement
                //TODO: unsupported for now
                //useHeightMap = EditorGUILayout.Toggle("Enable Displacement Map", useHeightMap);
                useHeightMap = false;
                if (useHeightMap)
                {
                    ++EditorGUI.indentLevel;
                    materialEditor.TexturePropertySingleLine(Styles.heightMapText, m_HeightMap, m_HeightMapST);
                    materialEditor.ShaderProperty(m_SVBRDF_HeightMapMaxMM, "Max Displacement (mm)");
                    --EditorGUI.indentLevel;
                }

                // Anisotropy
                anisotropy = EditorGUILayout.Toggle("Is Anisotropic", anisotropy);
                if (anisotropy)
                {
                    ++EditorGUI.indentLevel;
                    materialEditor.TexturePropertySingleLine(Styles.anisoRotationMapText, m_AnisoRotationMap, m_AnisoRotationMapST);
                    --EditorGUI.indentLevel;
                }

                // Clearcoat
                clearcoat = EditorGUILayout.Toggle("Enable Clearcoat", clearcoat);
                if (clearcoat)
                {
                    ++EditorGUI.indentLevel;
                    materialEditor.TexturePropertySingleLine(Styles.clearcoatColorMapText, m_ClearcoatColorMap, m_ClearcoatColorMapST);
                    materialEditor.TexturePropertySingleLine(Styles.clearcoatNormalMapText, m_ClearcoatNormalMap, m_ClearcoatNormalMapST);
                    clearcoatRefraction = EditorGUILayout.Toggle("Enable Refraction", clearcoatRefraction);
                    // The IOR map is always required for the coat F0, while in the CAR_PAINT model, the IOR
                    // is given by a scalar value.
                    materialEditor.TexturePropertySingleLine(Styles.clearcoatIORMapText, m_ClearcoatIORMap, m_ClearcoatIORMapST);
                    --EditorGUI.indentLevel;
                }

                BRDFType  = 0;
                BRDFType |= (uint)diffuseType;
                BRDFType |= ((uint)specularType) << 1;

                BRDFVariants  = 0;
                BRDFVariants |= (uint)fresnelVariant;
                BRDFVariants |= ((uint)wardVariant) << 2;
                BRDFVariants |= ((uint)blinnVariant) << 4;

//                    cmd.SetGlobalFloat( HDShaderIDs._TexturingModeFlags, *(float*) &texturingModeFlags );
                m_SVBRDF_BRDFType.floatValue     = (float)BRDFType;
                m_SVBRDF_BRDFVariants.floatValue = (float)BRDFVariants;

                --EditorGUI.indentLevel;
                break;
            }

            case AxfBrdfType.CAR_PAINT:
            {
                EditorGUILayout.Space();
                ++EditorGUI.indentLevel;

                useHeightMap = false;

                // Expand as user-friendly UI

                // Regular maps
                materialEditor.TexturePropertySingleLine(Styles.BRDFColorMapText, m_CarPaint2_BRDFColorMap);
                m_CarPaint2_BRDFColorMapScale.floatValue = EditorGUILayout.FloatField(Styles.BRDFColorMapScaleText, m_CarPaint2_BRDFColorMapScale.floatValue);

                brdfColorDiagonalClamp = EditorGUILayout.Toggle("BRDF Color Table Diagonal Clamping", brdfColorDiagonalClamp);
                if (brdfColorDiagonalClamp)
                {
                    ++EditorGUI.indentLevel;
                    m_CarPaint2_BRDFColorMapUVScale.vectorValue = EditorGUILayout.Vector2Field(Styles.BRDFColorMapUVScaleText, m_CarPaint2_BRDFColorMapUVScale.vectorValue);
                    --EditorGUI.indentLevel;
                }


                //materialEditor.TexturePropertySingleLine(Styles.BTFFlakesMapText, m_CarPaint2_BTFFlakeMap, m_CarPaint2_BTFFlakeMapST);
                materialEditor.TexturePropertySingleLine(Styles.BTFFlakesMapText, m_CarPaint2_BTFFlakeMap, m_CarPaint2_BTFFlakeMapST);
                //EditorGUILayout.LabelField( "Texture Dimension = " + m_CarPaint_BTFFlakesMap_sRGB.textureDimension );
                //EditorGUILayout.LabelField( "Texture Format = " + m_CarPaint_BTFFlakesMap_sRGB.textureValue. );
                m_CarPaint2_BTFFlakeMapScale.floatValue = EditorGUILayout.FloatField(Styles.BTFFlakesMapScaleText, m_CarPaint2_BTFFlakeMapScale.floatValue);

                materialEditor.TexturePropertySingleLine(Styles.thetaFI_sliceLUTMapText, m_CarPaint2_FlakeThetaFISliceLUTMap);

                //m_CarPaint2_FlakeMaxThetaI = FindProperty(m_CarPaint2_FlakeMaxThetaIText);
                //m_CarPaint2_FlakeNumThetaF = FindProperty(m_CarPaint2_FlakeNumThetaFText);
                //m_CarPaint2_FlakeNumThetaI = FindProperty(m_CarPaint2_FlakeNumThetaIText);

                m_CarPaint2_CTDiffuse.floatValue  = EditorGUILayout.FloatField(Styles.CarPaintCTDiffuseText, m_CarPaint2_CTDiffuse.floatValue);
                m_CarPaint2_LobeCount.floatValue  = Mathf.Floor(Mathf.Clamp(EditorGUILayout.FloatField(Styles.CarPaintLobeCountText, m_CarPaint2_LobeCount.floatValue), 0f, 3f));
                m_CarPaint2_CTF0s.vectorValue     = EditorGUILayout.Vector3Field(Styles.CarPaintCTF0sText, m_CarPaint2_CTF0s.vectorValue);
                m_CarPaint2_CTCoeffs.vectorValue  = EditorGUILayout.Vector3Field(Styles.CarPaintCTCoeffsText, m_CarPaint2_CTCoeffs.vectorValue);
                m_CarPaint2_CTSpreads.vectorValue = EditorGUILayout.Vector3Field(Styles.CarPaintCTSpreadsText, m_CarPaint2_CTSpreads.vectorValue);
                materialEditor.ShaderProperty(m_SVBRDF_HeightMapMaxMM, "Max Displacement (mm)");

                // Clearcoat
                clearcoat = EditorGUILayout.Toggle("Enable Clearcoat", clearcoat);
                if (clearcoat)
                {
                    ++EditorGUI.indentLevel;
//                        materialEditor.TexturePropertySingleLine( Styles.clearcoatColorMapText, m_ClearcoatColorMap );
                    //materialEditor.TexturePropertySingleLine(Styles.clearcoatNormalMapText, m_ClearcoatNormalMap);
                    materialEditor.TexturePropertySingleLine(Styles.clearcoatNormalMapText, m_ClearcoatNormalMap, m_ClearcoatNormalMapST);
                    //materialEditor.TexturePropertySingleLine(Styles.clearcoatNormalMapText, m_ClearcoatNormalMap, m_ClearcoatNormalMapST);

//                        materialEditor.TexturePropertySingleLine( Styles.clearcoatIORMapText, m_ClearcoatIORMap );
                    m_CarPaint2_ClearcoatIOR.floatValue = EditorGUILayout.FloatField(Styles.CarPaintIORText, m_CarPaint2_ClearcoatIOR.floatValue);
                    --EditorGUI.indentLevel;
                    clearcoatRefraction = EditorGUILayout.Toggle("Enable Refraction", clearcoatRefraction);
                }

//                    cmd.SetGlobalFloat( HDShaderIDs._TexturingModeFlags, *(float*) &texturingModeFlags );

                --EditorGUI.indentLevel;
                break;
            }
            }

            // Finally write back flags:
            flags = GenFlags(anisotropy, clearcoat, clearcoatRefraction, useHeightMap, brdfColorDiagonalClamp,
                             honorMinRoughness);
            m_Flags.floatValue = (float)flags;
        }//DrawAxfSurfaceOptionsGUI