Navigation: Surface Roughness > Sampled Random Surface Normal

 

Sampled Random Surface Normal

 

Contact Us: fredsupport@photonengr.com

 

 

 

Description


The Sampled Random Surface Normal roughness specification works by randomly perturbing the surface normals (during raytracing) according to a user-specified distribution of relative probabilities per angle (not solid angle).  Note that coherent rays which interact with a surface roughness model will be converted to geometric, incoherent rays.  It is not recommended that coherent raytracing be used with the surface roughness feature.

 

The following steps occur when a ray intersects a surface with an active Sampled Random Surface Normal roughness model:

 

1.

The ray's intersection position and the surface normal at that position are determined.

2.

A random number between 0 and 1 is generated and compared against the "Overall Roughness Probability" value (ORP).  If the random number is greater than the ORP then no perturbation of the surface normal is applied.   When the random number is less than the ORP, steps 3-5 are taken.  In this method, the ORP is similar to the Total Integrated Scatter (TIS) value for a surface scatter model

3.

A random angle value (q) is generated according to the specified probability distribution.  This angle, which is measured from the unperturbed surface normal, functions like the polar angle in a spherical coordinate system.

4.

Another random angle value (f) is is generated according to a probability distribution that takes into account the ray's incident direction, the value of q and and the resulting relative surface visibility.  The value f functions like the azimuthal angle in a spherical coordinate system.

5.

The perturbed surface normal is formed from q and f.  Using the ray's incident direction, it is tested to see whether reflection or refraction (both are always checked regardless of the surface's raytrace properties) would potentially transfer the ray to the wrong side of the surface.  If so, the perturbation is rejected and steps 3 - 5 are repeated (up to 10 times).  When the perturbation is determined to be valid, the ray interactions are then evaluated using the new surface normal direction.

 

 

Navigation


This feature can be accessed by selecting Sampled Random Surface Normal as the Type in the Create New Surface Roughness dialog box.

 

 

Controls


 

Control

Inputs / Description

Defaults

 

Overall

Probability value between 0 and 1 that a random surface normal deviation will be applied to the ray's intersection event.

1

Surface Normal Deviation

The surface normal deviation spreadsheet specifies the relative probability of a surface normal deviation occurring at each of the specified angles (in degrees).  Note that when defining an original data set (not converting from an existing scatter model) you will need to account for the relative surface visibility at each angle by multiplying by the sine of the angle (see Gaussian distribution example below).  The following options are available by right mouse clicking in the spreadsheet area:

Append, insert, or delete row: allows manual manipulation of the spreadsheet entries directly from the dialog.

Read or write distribution from text file: allows a roughness distribution to be read from a *.txt or *.dat file having the following format (note: "!" indicates a comment line which is not required for proper reading of data):

! Angle(deg)     Prob

ang01               prob01

ang02               prob02

ang03               prob03

...

Generate distribution using scatter model: populates the sampled random surface normal with a probability distribution which will reproduce the selected scatter model at normal incidence subject to the requirements of surface refraction.  The overall roughness probability is set to the normal incidence total integrated scatter (TIS) of the selected scatter model.

Normalize distribution entries to match overall probability: applies a scale factor to each of the probability values so that the integral of the probability values matches the overall roughness probability.

 

OK

Accept settings and close dialog box.

 

Cancel

Discard settings and close dialog box.

 

Help

Access the Help.

 

 

 

Application Notes


Generate Surface Roughness from Scatter Model

The parameters for a surface roughness model of the Sampled Random Surface Normal type can be generated from a scatter model.  This dialog is used to control the conversion process.  By right mouse clicking in the probability distribution spreadsheet, the option "Generate distribution using scatter model" can be selected and will open a dialog with the following controls:

Control

Inputs / Description

Defaults

 

Scatter Model

Drop down list of all scatter models currently on the object tree.  The selected scatter model will be used to populate the probability values for the roughness distribution.

Scatter node 0

Scatter Angle Range

Min

Minimum surface normal angular deviation (deg.)

0

Max

Maximum surface normal angular deviation (deg.)

90

# of Samples

Number of probability samples within the minimum and maximum surface normal deviation angular ranges.

120

Conversion Mode

Reflection/Transmission

Specifies whether the conversion is performed for surface reflection or transmission.  The conversion method is different for these two cases.

 

If Transmission is selected, the material index values for n1 and n2 must be supplied.  Because of the nature of refraction when traveling from a high index to a low index, there is a fundamental limitation to the angular range that can be achieved by tilting the local surface normal.  This limit corresponds to the surface normal tilt at which the refracted ray's angular deviation is 90 degrees.  A one degree margin of error is automatically imposed on the maximum angle for stability purposes.

Reflection

Refractive Indices

Refractive index values to be applied when generating a roughness model in transmission from an existing scatter model.

 

Note: Right mouse clicking on a material node on the object tree and selecting "Detailed Report" from the list menu will print a listing of refractive index values for currently defined source wavelengths.

n1 = 1.5

n2 = 1.0

Max allowed transmission scatter angle

Computed maximum surface normal deviation angle for supplied refractive index values n1 and n2.

47.2

 

OK

Accept settings and close dialog box.

 

Cancel

Discard settings and close dialog box.

 

Help

Access the Help.

 

 

 

Gaussian Surface Roughness

In the case where a Gaussian distribution of surface normal deviations is desired, the following script can be used to generate an appropriate roughness model by specifying the HWHM value of the Gaussian function.  Note that each probability value is multiplied by sin(q) to account for the solid angle projection.

 

Sub Main

 

          'This script creates a surface roughness model with sampled random surface normals

          'according to a gaussian distribution.

 

          Dim numSamps As Long

          Dim hwhm As Double, maxAng As Double, overallProb As Double

          '----------------

          'USER INPUT

          '----------------

          'number of samples to use in the SRSN roughness model

          numSamps = 90

          'maximum angular deviation for sample points in degrees

          maxAng = 1

          'half-width half-max of the gaussian distribution in degrees

          hwhm = 0.175 'degrees

          'probability of surface normal deviation occuring on intersection

          overallProb = 0.98

          '----------------

          'Derived parameters

          Dim c As Double

          c = hwhm/Sqr(2*Log(2))

 

          'Create a new sampled random surface normal (SRSN) roughness model

          Dim roughNode As Long

          roughNode = SurfRoughSRSNCreate( "Gaussian Roughness", "HWHM=" & CStr(hwhm) )

 

          'Dynamically size the arrays for the SRSN sample entries

          Dim angles() As Double

                    ReDim angles( numSamps-1 )

          Dim relProbs() As Double

                    ReDim relProbs( numSamps-1 )

          Dim curSamp As Long

 

          'Set entries for the gaussian SRSN model

          For curSamp = 0 To numSamps-1

                    'Assign angle and gaussian probability with sin(theta) correction factor

                    'Populate angle sample value

                    If curSamp = 0 Then

                              angles(curSamp) = 1e-6

                    Else

                              angles(curSamp) = curSamp*(maxAng/(numSamps-1))

                    End If

                    'Populate probability value

                    relProbs(curSamp) = Exp(-(angles(curSamp)/(Sqr(2)*c))^2)

                    relProbs(curSamp) = relProbs(curSamp)*Sin(DegToRad(angles(curSamp)))

          Next curSamp

 

          'Set the entries to the surface roughness node

          SurfRoughSRSNSetEntries( roughNode, angles(), relProbs() )

 

          'Set the overall probability for the roughness

          SurfRoughSRSNSetOverallRoughnessProbability( roughNode, overallProb )

 

          'Update the document

          Update

 

End Sub

 

 

Related Topics


Surface Roughness

Create New Surface Roughness

 

 

 

 

 

Copyright © Photon Engineering, LLC