The Extended Scripted (BSDF given by user-script) scatter model allows the user to specify a custom BSDF function by using FRED's BASIC scripting language. The input and output parameters of the Extended Scripted scatter model extend the capability of the standard Scripted scatter model by allowing the user to additionally define polarization properties of the scattered rays. For a description of the input and output parameters available in the script, please see the T_SCATTERSCRIPTEX help page.
For polarized rays, the polarized field is defined in the following way, E = Sqrt( rayflux ) * (Ap p + As s + Ad d) * Exp[i(2p/l)OPL] with d being the ray's direction vector and s and p defining the s-polarization and p-polarization vectors. With the exception of immersion in a birefringent material, s is perpendicular to p, s x p = d (therefore p = d x s) and Ad = 0. The amplitude coefficients Ap, As and Ad are complex, Ap = Apreal + i Apimag As = Asreal + i Asimag Ad = Adreal + i Adimag
The ray quantities input into and output from the routine are defined in the local coordinate system of the surface. Specification of ray data in this coordinate system is different from the standard Scripted scatter model, which constructs a "surface normal local" coordinate system local to the ray intersection point on the surface and the surface normal. Ray data in the local coordinate system of the surface allows for the capability of creating an anisotropic scatter model whose BSDF function is dependent on the orientation of the scattering surface.
This feature can be accessed by selecting Extended Scripted (BSDF given by user-script) as the Scatter Type in the Create a new scatter model dialog box.
The example below demonstrates the EvalScatter subroutine of an Extended Scripted scatter model in which the rays become linearly s-polarized along the local X-axis of the scattering surface after undergoing the scattering event.
Sub EvalScatter( ByRef t As T_SCATTERSCRIPTEX )
Const refl = 1.0
If Not t.g_TISrequest Then t.g_Xscat_s = 1.0 t.g_Yscat_s = 0.0 t.g_Zscat_s = 0.0 t.g_Ascat_r_s = 1.0 t.g_Ascat_i_s = 0.0 t.g_Ascat_r_p = 0.0 t.g_Ascat_i_p = 0.0 t.g_BSDF = refl / PI() Else t.g_Xpos=0 : t.g_Ypos=0 : t.g_Zpos=0 : t.g_frac=1 : t.g_w=0.5875618 t.g_numA=101 : t.g_numB=101 End If
End Sub
It is strongly recommended that the script make no modifications to other nodes in the FRED document.
If a change is made to the document during the raytrace by way of the scripted entity, the state of the document as seen by each individual thread of the raytrace will be inconsistently defined and the results of the raytrace may not be valid.
Extended Scripted scatterer Test dialog ABg – for polished surface scatter Binomial - plane symmetric case of general Polynomial Extended Harvey-Shack - shift variant form of the Harvey-Shack model Flat Black Paint – specify Total Integrated Scatter (TIS) Harvey-Shack – for polished surface scatter K-Correlation – analytic PSD Lambertian – for diffuse scatter Phong – cosn from specular Polynomial - General polynomial with diffuse and Lorentzian component Scripted - User-defined scattering function Surface Particle (Mie) – for particulate contamination Tabulated BSDF – measured BSDF data Tabulated PSD – measured PSD data
|
||||||||||||||||||||||||||||||||||||||||||||||||||