// Caution: this function must match the one in HDLightEditor.UpdateLightIntensity - any change need to be replicated
        public void ConvertPhysicalLightIntensityToLightIntensity()
        {
            var light = gameObject.GetComponent <Light>();

            if (lightTypeExtent == LightTypeExtent.Punctual)
            {
                switch (light.type)
                {
                case LightType.Directional:
                    light.intensity = Mathf.Max(0, directionalIntensity);
                    break;

                case LightType.Point:
                    light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity));
                    break;

                case LightType.Spot:

                    if (enableSpotReflector)
                    {
                        if (spotLightShape == SpotLightShape.Cone)
                        {
                            light.intensity = LightUtils.ConvertSpotLightIntensity(Mathf.Max(0, punctualIntensity), light.spotAngle * Mathf.Deg2Rad, true);
                        }
                        else if (spotLightShape == SpotLightShape.Pyramid)
                        {
                            float angleA, angleB;
                            LightUtils.CalculateAnglesForPyramid(aspectRatio, light.spotAngle,
                                                                 out angleA, out angleB);

                            light.intensity = LightUtils.ConvertFrustrumLightIntensity(Mathf.Max(0, punctualIntensity), angleA, angleB);
                        }
                        else     // Box shape, fallback to punctual light.
                        {
                            light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity));
                        }
                    }
                    else
                    {
                        // Spot should used conversion which take into account the angle, and thus the intensity vary with angle.
                        // This is not easy to manipulate for lighter, so we simply consider any spot light as just occluded point light. So reuse the same code.
                        light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity));
                        // TODO: What to do with box shape ?
                        // var spotLightShape = (SpotLightShape)m_AdditionalspotLightShape.enumValueIndex;
                    }
                    break;
                }
            }
            else if (lightTypeExtent == LightTypeExtent.Rectangle)
            {
                light.intensity = LightUtils.ConvertRectLightIntensity(Mathf.Max(0, areaIntensity), shapeWidth, shapeHeight);
            }
            else if (lightTypeExtent == LightTypeExtent.Line)
            {
                light.intensity = LightUtils.CalculateLineLightIntensity(Mathf.Max(0, areaIntensity), shapeWidth);
            }
        }