RenderToolbox SphereRenderer


I. User Reference

Geometry

Point Lights

After choosing the appropriate settings, click ‘Add light’ in order to add the specified light to the list of lights. In order to change the settings of a light, it must be removed and replaced by a light with correct settings. Click ‘Plot Spectrum’ to view a graph of the SPD of the selected light.

Ambient Lights
The ambient light is specified by the same parameters as the point lights.

Diffuse Reflectance

Specular Reflectance
Settings do not differ from those of the diffuse reflectance.

Specular Blur
Allows the user to set a flat specular blur of the set magnitude or a user specified specular blur.

Tone Mapping
Choose a tone mapping method from the menu, and set the parameters in the list. Tone maps are functions listed in the toneMaps folder in the same folder as ward_gui.m. If ‘lock’ is not selected, each tone map function automatically determines the settings most appropriate for the rendered image. If ‘lock’ is selected, the tone map applies the settings from the last time the selected tone map was run unlocked. Do not select ‘lock’ on the first run of a tone map.

II. Program Scheme

1) ward_gui-initializes GUI based on ward.fig. contains callbacks to each GUI elements
  1. ward_gui_OpeningFcn-called at start of program. sets defauls parameters, loads info from data files and populates menus
    1. loadLightsAndColors-first loads files [light_name].mat from ‘lights’ folder. Within each of these files must be a vactor S_[light_name] specifying the sampling wavelengths of the light SPD. The SPD must reside in the variable [light_name]. The function splines the SPD into the wavelength spectrum specified in handles.sampleVec. loadLightsAndColors next populates the lights popupmenu allowing the user to choose from available light sources, setting the default to D65 daylight, should that file exist in the ‘lights’ folder. The function next follows the same procedure to load available SRFs from the ‘colors’ folder. As before, these files must contain the vector S_[color_name] and [color_name], respectively specifying the sample wavelength spectrum and SRF.
    2. loadToneMap-This function looks in the folder ‘toneMaps’ for available tone mapping functions, and populates the tone map popup menu with the available choices. (see the tone map section below for more information)
    3. Macbeth Colors-ward_gui next loads the Macbeth colors from ‘sur_macbeth’, a file that must exist somewhere on the MATLAB path. It splines the loaded array, with a presumed title of ‘sur_macbeth’ and saves it in handles.macbethColors.
    4. Default values-ward_gui now sets a few of the GUI elements to their default values, and adds a lightwith these values (see addLight)
  2. pushbutton_addLight_Callback-called when user clicks the button ‘Add Light’
  3. addLight-Saves light, as specified in GUI in handles.lights(i) i is the number of the current light, saved in handles.currentLight, which increases by one after each addition of a light. The function places the specified SPD in handles.lights(i).spd, the name of the SPD (day light, flat, etc…) in handles.lights(i).spdString, the light position in handles.lights(i).position and the scale factor in handles.lights(i).scaleFactor. The function then refreshes the listbox of light sources to reflect the newly added light.
  4. pushbutton_render_Callback-called when the user clicks the ‘Render’ button.
    1. doRender-renders an image of the sphere. (see render section below)
  5. pushbutton_removeLight_Callback-called when user clicks the button ‘Remove Light’
    1. removeLight-Removes the selected light from handles.lights, and shifts the subsequent elements of handles.lights forward one position. Refreshes the listbox to reflect changes.
  6. pushbutton_plotAmbientLight_Callback, pushbutton_plotLight_Callback
    1. plotAmbientLight, plotPointLight called respectively. Plot the SPD of either the ambient light or the selected point light, as specified in the GUI
  7. pushbutton_plotDiffuseReflectance_Callback, pushbutton_plotSpecularReflectance_Callback-plot the SRF of either the diffuse reflectance or the specular reflectance.
  8. popupmenu_toneMapFiles_Callback-called when the user selects a new tone map from the tone map popup menu
    1. updateToneMapParameterList-populates the tone map parameter list boxwiththe parameters appropriate tothe selected tone map (see tone map section below for more information)
    2. updateToneMapParameterValue-updates the value of the parameter value text box to reflect newly selected parameter. This is necessary after updating the parameter list because the first element of the refreshed list is selected by default requiring the text box to reflect this change.
  9. listbox_toneMapParameterList_Callback-called when the user selects and element from the tone map parameter list.
    1. updateToneMapParameterValue-displays the value of the current parameter in the text box.
    2. edit_toneMapParameterValue_Callback-called when the user changes the value in the tone map parameter text box
    3. setToneMapParameterValue-updates the appropriate value stored in handles.[tonemap_name].[parameter_name].

2) doRender-topmost level function that executes the rendering
  1. getGUIParams-returns user settings from gui as struct. (see params in section IV below).
  2. render(params)-takes params, returned by getGUIParams or programmed manually, and renders an image of the sphere.
    1. calculateSurfaceGeometry(params)-returns a list of geometry information for each pixel of the image in list form (see section V for notes on list vs. square form). The function returns two arrays, anglesOut and geometry out. render only uses anglesOut. (see anglesOut and geometryOut in section IV below)
    2. ward(params, angles)-calulates the hyperspectral illuminance of each pixel based on the ward model. Params is usually supplied by getGUIParams. Returns the lists reflectedLight, reflectedDiffuseLight, reflectedAmbientLight and reflectedSpecularLight. In each of these lists, each column has params.numSamples elements representing the hyperspectral illuminance for one pixel. Slices in the third dimention represent the luminance of each pixel due to each of the different light sources, the first source corresponding to the first slice, etc…
      (1) ward_DiffuseLight, ward_AmbientLight and ward_SpecularLight -take the same params and angles variables as ward.
    3. toneMap(params,reflectedLight, reflectedDiffuseLight, reflectedSpecularLight, reflectedAmbientLight) maps hyperspectral in list formvalues to a list of XYZ color values according to the tone map specified in params.toneMapName. toneMap only passes the arrays


III. Tone maps

(not written yet)

IV. Array and Struct Contents

1) params-returned by getGUISettings

sampleVec

[start increment numIncrements]

radius

scaler, measured in pixels

viewPoint

(x,y,z) row vector specifying position of view point

numLightSources

scaler

lightCoords

(x,y,z), one row per light

lightIntensity

SPD, one col per light, the first column corresponding to the first point light, etc… each col must have the same number of elements as specified in the number of increments (sampleVec(3))

daylightIntensity

SPD, one one column, must have the same number of elements as specified in the number of increments (sampleVec(3))

ambientLightIntensity

SPD, one one column, must have the same number of elements as specified in the number of increments (sampleVec(3))

diffuseConst

one row,  must have the same number of elements as specified in the number of increments (sampleVec(3))

specularConst

one row,  must have the same number of elements as specified in the number of increments (sampleVec(3))

specularBlurConst

one row,  must have the same number of elements as specified in the number of increments (sampleVec(3))

toneMapName

string, name of current  tone map to be used. must match the name of a function in the ‘toneMaps’ folder

toneMapLock

boolean,

[tonemap_name]

contains subfields, each titled with the name of a parameter and set equal to the value of that parameter as specified in the GUI

xmin

scaler, minimum x coord of local coordinate system

xmax

scaler, maximum x coord of local coordinate system

ymin

scaler, minimum y coord of local coordinate system

ymax

scaler, maximum y coord of local coordinate system

rows

scaler, number of rows in square image of sphere

cols

scaler, number of cols in square image of sphere

numPoints

scaler, number of points in square image (=rows*cols)

numLightSources

scaler, number of light sources

numSamples

scaler, number of sample wavelentgs (=sampleVec(3))



2) anglesOut-returned from calculateSurfaceGeometry

row 1

cos(theta_incident)

row 2

cos(theta_reflected)

row 3

cos(delta)

row 4

tan^2(delta)




3) geometryOut-returned from calculateSurfaceGeometry

rows 1-3

x, y and z coords of the pixel in local cords (see local coords vs. array indices)

rows 4-6

x, y and z coords of the surface norm (specified in Ward)

rows 7-9

x, y and z coords of the reflectance vector (specified in Ward)

row 10-12

x, y and z coords of the half vector (specified in Ward)

There are 4 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki