Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the lobe model parameters
        /// </summary>
        /// <param name="_lobeType">Type of lobe to fit</param>
        /// <param name="_incomingDirection">Incoming light direction, pointing TOWARD the surface (Z-up)</param>
        /// <param name="_theta">Initial lobe theta angle</param>
        /// <param name="_roughness">Initial lobe roughness</param>
        /// <param name="_scale">Initial lobe scale</param>
        /// <param name="_flatteningFactor">Initial lobe flattening</param>
        /// <param name="_MaskingImportance">Initial lobe masking/shadowing importance</param>
        /// <param name="_oversizeFactor">Simulation oversize factor. A value of 1 makes the lobe fit exactly, a value higher than one will make the fit lobe smaller than the simulated data, a value lower than one will make the lob larger than the simulated data</param>
        /// <param name="_fitUsingCenterOfMass">If true, the fitting distance is measured against a sphere centered on the Center of Mass rather than the (0,0,0) origin. Precision is usually better when using this option.</param>
        public void             InitLobeData(LOBE_TYPE _lobeType,
                                             float3 _incomingDirection,
                                             double _theta,
                                             double _roughness,
                                             double _scale,
                                             double _flatteningFactor,
                                             double _maskingImportance,
                                             double _oversizeFactor,
                                             bool _fitUsingCenterOfMass)
        {
            // =========================================================================
            // Setup initial parameters
            m_lobeType = _lobeType;
            if (m_lobeType == LOBE_TYPE.MODIFIED_PHONG_ANISOTROPIC)
            {
                m_flatteningEval = EvalAnisotropicFlattening;
            }
            else
            {
                m_flatteningEval = EvalIsotropicFlattening;
            }

            m_direction   = _incomingDirection;
            m_direction.z = -m_direction.z;             // Mirror against surface to obtain reflected direction against which we'll compute masking/shadowing of incoming ray

            double incomingPhi = Math.Atan2(m_direction.y, m_direction.x);

            m_incomingDirection_CosPhi = Math.Cos(incomingPhi);
            m_incomingDirection_SinPhi = Math.Sin(incomingPhi);

            m_oversizeFactor       = _oversizeFactor;
            m_fitUsingCenterOfMass = _fitUsingCenterOfMass;

            Parameters = new double[] { _theta, _roughness, _scale, _flatteningFactor, _maskingImportance };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize the lobe model parameters
        /// </summary>
        /// <param name="_lobeType">Type of lobe to fit</param>
        /// <param name="_incomingDirection">Incoming light direction, pointing TOWARD the surface (Z-up)</param>
        /// <param name="_theta">Initial lobe theta angle</param>
        /// <param name="_roughness">Initial lobe roughness</param>
        /// <param name="_scale">Initial lobe scale</param>
        /// <param name="_flatteningFactor">Initial lobe flattening</param>
        /// <param name="_MaskingImportance">Initial lobe masking/shadowing importance</param>
        /// <param name="_oversizeFactor">Simulation oversize factor. A value of 1 makes the lobe fit exactly, a value higher than one will make the fit lobe smaller than the simulated data, a value lower than one will make the lob larger than the simulated data</param>
        /// <param name="_fitUsingCenterOfMass">If true, the fitting distance is measured against a sphere centered on the Center of Mass rather than the (0,0,0) origin. Precision is usually better when using this option.</param>
        public void InitLobeData(	LOBE_TYPE _lobeType,
										float3 _incomingDirection,
										double _theta,
										double _roughness,
										double _scale,
										double _flatteningFactor,
										double _maskingImportance,
										double _oversizeFactor,
										bool _fitUsingCenterOfMass )
        {
            // =========================================================================
            // Setup initial parameters
            m_lobeType = _lobeType;
            if ( m_lobeType == LOBE_TYPE.MODIFIED_PHONG_ANISOTROPIC )
                m_flatteningEval = EvalAnisotropicFlattening;
            else
                m_flatteningEval = EvalIsotropicFlattening;

            m_direction = _incomingDirection;
            m_direction.z = -m_direction.z;	// Mirror against surface to obtain reflected direction against which we'll compute masking/shadowing of incoming ray

            double	incomingPhi = Math.Atan2( m_direction.y, m_direction.x );
            m_incomingDirection_CosPhi = Math.Cos( incomingPhi );
            m_incomingDirection_SinPhi = Math.Sin( incomingPhi );

            m_oversizeFactor = _oversizeFactor;
            m_fitUsingCenterOfMass = _fitUsingCenterOfMass;

            Parameters = new double[] { _theta, _roughness, _scale, _flatteningFactor, _maskingImportance };
        }