Anda di halaman 1dari 2

MATLAB code

NEW! GUI for 2D and 3D ray-tracing simulations of light scattering and


absorption of rough surfaces.
GOA (v1.01)
DESCRIPTION: GUI for ray-tracing simulations of light scattering of 1D and 2D rough surfaces, either in
Monte Carlo mode using random rough surface generation or by loading previously saved surfaces.
INPUT: Surface properties (Monte Carlo mode), light properties and material properties.
OUTPUT: Directional-hemispherical reflectance, BRDF, scattering points, amount of shadowing, etc.
REQUIREMENTS: MATLAB, Statistics and Signal Processing Toolboxes.

Figure 2: Screenshot of GUI, click thumbnail to open a larger version in a new window.

2D ray-tracing
[R,drcscat,scat,shad,w] = goa2D (f,x,thd,n1,k1,n2,k2,nfrp,dstrb,br)
DESCRIPTION: calculates the directional-hemispherical reflectance for light incident from a medium with
complex refractive index n1 + i*k1 on a 1-d rough surface y=f(x) with complex refractive index n2 + i*k2 with
the
angle
of
incidence
thd
(in
degrees)
with
nfrp
first
reflection
points.
INPUT: f-surface height, x-surface point, thd-(global) angle of incidence in degrees, n1-refractive index of
medium 1, k1-extinction coefficient of medium 1, n2-refractive index of medium 2, k2-extinction coefficient of
medium 2, nfrp-number of first reflection points (rays), dstrb-ray distribution (type 'uni' for uniform and
'gauss'
for
gaussian),
br-beam
radius
OUTPUT: R-directional-hemispherical reflectance, drcscat-differential reflection coefficient, scat-mean
number of scattering events per each incident ray, shad-amount of shadowing (percentage), w-percentage of
rays removed due to warnings

3D ray-tracing
[R,b1,b2,b3,scat,shad,w] = goa3D (f,x,y,thd,phd,n1,k1,n2,k2,nfrp,dstrb,br)

DESCRIPTION: calculates the directional-hemispherical reflectance for light incident from a medium with
complex refractive index n1 + i*k1 on a 2-d rough surface z=f(x,y) with complex refractive index n2 + i*k2 with
the angle of incidence thd (polar) and phd (azimuth) with nfrp 2 first reflection points.
INPUT: f-surface height, x-surface point, y-surface point, thd-(global) polar angle of incidence in degrees, phd(global) azimuth angle of incidence in degrees, n1-refractive index of medium 1, k1-extinction coefficient of
medium 1, n2-refractive index of medium 2, k2-extinction coefficient of medium 2, nfrp-number of first
reflection points (rays) along square side, dstrb-ray distribution (type 'uni' for uniform and 'gauss' for
gaussian),
br-beam
radius
OUTPUT: R-directional-hemispherical reflectance, b1-first order scattering brdf, b2-second order scattering
brdf, b3-third and higher order scattering brdf, scat-mean number of scattering events per each incident ray,
shad-amount of shadowing (percentage), w-percentage of rays removed due to warnings

Hint!
To get good results from the ray-tracing algorithms, observe that the surface given as input needs to properly
sampled. The Fresnel approximation, i.e. the assumption of local flatness, puts a more strict demand on the
surface sampling frequency than for instance the Nyquist sampling theorem does (see under surface generation
tab). Local flatness means the surface derivative must be a smoothly varying function. Therefore it may be
necessary to use more surface points for surfaces with higher rms slopes. The warning signal w basically keeps
account for errors due to failures of the Fresnel approximation and can be used as an indication of whether a
higher sampling frequency is needed. In order to minimize the uncertainty, try to keep it as low as possible
(preferably 0). Please also note that to get dense statistics for the brdf you will need more rays than necessary
for convergence of reflectance/absorptance (and perhaps even larger surfaces and/or multiple realizations of
surfaces, see Monte Carlo code below).

Anda mungkin juga menyukai