This is the documentation for Enlighten.

Lua bindings reference

Overview

This reference provides lists of the available Lua bindings. These functions can be executed from the Lua console (opened using Tab) or from the auto loaded script.

Most of the Lua bindings are to aid development and automate certain tasks, such as demonstrations or inspecting the contents of the scene. Common functionality is more readily accessed from the UI.

Scene management

LoadScene( string )

Loads the given scene.

LoadLights( string )

Loads the given light configuration, smoothly interpolating from the currently light configuration.

LoadLightsImmediate( string )

Loads the given light configuration and applies it immediately.

ExtractSceneFromCache( string folderPath )

Extracts a state dump of a scene that was fed to the precompute API, and re-loads it into GeoRadiosity. The scene is extracted but not precomputed, and if the Precompute button is subsequently pressed, the whole precompute process (including GeoConvert) will be run.

StartPrecompute( )

Precomputes the currently loaded scene.

SetWorldUnitScale( float )

Sets the scale used by GeoRadiosity for rendering. This property changes the size of GUI widgets and the speed of the camera.

SetWorldPermutation( string )

Sets the world orientation with a string, such as +x-z-y.

GotoStartPoint( int )

Moves the camera to the given start point. Start points are authored in 3ds Max/Maya.

PrintSceneDesc( )

Prints useful statistics about the currently loaded scene.

SetLightConfigInterpolationTime( float )

Sets the light configuration interpolation period to a given number of seconds. During this period an old light configuration is faded out as the new loaded one is faded in.

GetCameraPosition( )

Outputs the position and rotation of the current camera as a string.

SetCameraPosition( float x, float y, float z)

Sets the XYZ position of the camera.

SetCameraPositionAndRotation(
 float x, float y, float z,
 float yaw, float pitch, float bank)

Sets the XYZ position and yaw/pitch/bank rotation of the camera.

Rendering

SetRendererMode( string )

Sets the renderer mode used by GeoRadiosity. Depending on the scene that is loaded, some or all of modes selectable on the Rendering tab may be available. The parameter should be of the same form as Scene/Solid where the two names come from the radio buttons on the Rendering tab of GeoRadiosity.

CaptureBackBuffer(
 string fileName, string fileFormat )

Captures the backbuffer and saves it to a file in the given format. The first parameter is the path to which to save the screenshot. It is appended with _(%SceneName%)###.XXX, where %SceneName% is the name of the currently loaded scene, ### is an incremented number starting at 000 and XXX is the file extension specified by the second parameter. Supported file formats are tga, png, bmp, jpg and dds. For example, if Arches.scene is loaded, the first call to CaptureBackBuffer("C:\MyScreenshots\Screenshot", "png") saves the file C:\MyScreenshots\Screenshot(Arches)_000.png.

ToggleRadUpload( )

Toggles uploading of radiosity results to the GPU.

ToggleFullscreen( )

Toggles fullscreen rendering mode. (Fullscreen mode can also be toggled by pressing Alt + Enter.)

ToggleShowEditGui( )

Toggles rendering of all GUI elements. Can be used to clear the screen completely.

SetFullscreen( boolean )

Enables / disables the fullscreen rendering mode.

SetRenderAllMeshes( boolean )

Enables rendering of all meshes in geometry objects. By default, GeoRadiosity renders only the first mesh in each Geometry object, because usually the first mesh is the "render mesh" and subsequent meshes are LOD levels, target meshes etc. However, some authoring pipelines may place multiple meshes intended for rendering into single Geometry objects. The SetRenderAllMeshes function allows you to override the default behaviour and force rendering of all meshes. This is especially useful when using the ExtractSceneFromCache functionality on scenes authored with unknown authoring pipelines where you do not know the roles of the individual meshes.

SetLargestSceneSize( float )

Sets the maximum value for the scene size parameter from which near and far plane distances are derived. This is required so that enormous scenes such as {{Cornellbox_10_units_100_boxes}} render correctly. (For that scene, use app.SetLargestSceneSize(10000.0);)

Post-processing

At the end of the rendering pipeline, the scene is split into a tonemapped part and non-tonemapped part. There are two (de)saturation controls, one for each part.

float GetTonemapSaturationPerc( )

Returns the current saturation control. 1 = normal; 0 = greyscale.

SetTonemapSaturationPerc( float )

Sets the saturation control.

float GetNonTonemapSaturationPerc( )

Same as GetTonemapSaturationPerc( ), for the non-tonemapped part.

SetNonTonemapSaturationPerc( float )

Same as GetTonemapSaturationPerc( ), for the non-tonemapped part.

SetRadTonemapping( boolean )

Whether to tonemap the indirect lighting or not.

Debugging

SetGlobalLodLevel( int )

Sets the LOD level to render at. Negative values disable it (the default).

GetGlobalLodLevel( )

Gets the currently set LOD level.

SetProbeSetLod( int index, int level )

Sets a specified LOD level for probe solving for a specific probe set. The first parameter is the probe set index, and the second the LOD level. Specifying -1 for the probe set index sets the LOD for all probe sets.

DisplayHtmlReport( )

Opens a report in your default browser showing the breakdown of Enlighten memory usage both in each system and in the scene in total.

LoadRadTaskDumps(
 int platform, int workspace )

Loads output generated by GeoRadTestBed. Used for testing the output from the console versions of Enlighten. Each platform saves files with different names; to select the required platform and workspace, pass in integer values from the table below.

Platform 
Windows0
Albedo workspace type 
Full Albedo workspace0
Cluster Albedo workspace1

Miscellaneous

ShowErrorDialog( string )

Enables console error messages from Lua scripts.

GetEnvVariable( string )

Gets the given environment variable as a string (PC only).

LoadScript( string )

Loads and runs the given Lua script.

LoadEnvScriptFile( string )

Loads and runs the Lua script from the filename stored in the given environment variable (PC only).

BindKeyToAction( string, int )

Binds the key given by the string to the given function pointer. For example:

loadLights = function() app.LoadLights( myLightsString ); end
app.BindKeyToAction("1", loadLights);
DefaultScriptEnvVariable( )

Retrieves the default Lua script name (currently GEO_RAD_SCRIPT).

InMediasRes( )

Positions the camera at the centre of the world bounding box.

HoldView( )

Stores the camera settings (position and orientation) in the registry (Windows only).

FetchView( )

Restores the camera settings (position and orientation) from the registry (Windows only).

RunDelayedScript(
 int frameDelay, string luaString )

The Lua code passed in (luaString) is invoked at a later stage, after frameDelay rendered frames have passed.