Table of Contents

Corona Rendering Core


Most render settings can be set using the Maxscript. You can list the settings using show renderers.current command. They are also listed here: Render Settings.

There are several published functions that can be called using the CoronaRenderer.CoronaFp interface. You can list them by executing showInterface CoronaRenderer.CoronaFp command. Most functions return an integer, that is zero on success, and nonzero on failure.

Adding new functions is very easy, so contact us if you need any.

FunctionParametersDescription
showVfb<boolean>showDisplays or hides the VFB window. When the argument is true, calling it is the same as clicking “Show VFB” button in the UI.
resumeRender()
Resumes the last rendering. Same as clicking “Resume last” button in the Actions tab.
loadAndResume<string>filenameSame as resumeRender, but loads the last render from a given previously dumped EXR file.
dumpVfb<string>filenameSaves the current VFB contents to given file so it can be resumed later using loadAndResume.
setDisplayedChannel<integer>channelIf using Corona VFB, it sets the currently displayed channel. 0 is beauty channel, 1 is alpha, and higher values are extra render passes.
getVfbContent<integer>channel <boolean>toneMapping <boolean>renderStampReturns bitmap with one render channel from the current framebuffer. Optionally can include tone mapping and renderstamp. Does not return integer code, but directly the bitmap (or null if the call failed).
resetSettings()
Resets the render settings to default values. Same as clicking “Reset Settings” button in Actions tab.
exportScene<string>filename <bool>renderImmediatelyExports the scene to given file so it can be loaded in the Corona standalone application. If renderImmediately is true, then the application will also look for the standalone executable and try to run it immediately.
getStatistic<int>statisticIdReturns one of the statistics from the table below, in double precision floating point format. Returns results from the currently active render or last render. If no render occured yet in the session, or 3dsmax was reset/renderer changed after the last render, then the results are undefined.
getBlackbodyColor<float>temperatureReturns the color of a black body emitter with specified temperature (given in Kelvins). The returned value is in HDR linear sRGB color space (without gamma correction). The result is normalized - the brightest color channel is always equal to 1, and the absolute brightness of the color does not correspond to the reality (only ratio between different color channels is meaningful). Input color must be in range 1000-99000K
loadDrIpFile<string>filenameLoads a text file containing 1 IP per line into the DR nodes list. Same as clicking on the button “From file…” in UI and selecting the provided file.
startInteractive()
Starts the interactive rendering in Corona pop-out WX VFB.
startInteractiveDocked()
Starts the interactive rendering in the Corona viewport-docked VFB. The viewport (extended view) needs to be present and inactive for this method to work. The command returns the following codes:
0 - Success
1 - Failure - Corona is not selected as the active renderer
2 - Failure - Corona is already rendering
3 - Failure - No valid docked window available
stopRender()
Stops any render that is currently going on
reparseInteractive()
While in interactive rendering session, reparses the entire scene and restarts interactive rendering.
getRenderType()
Returns 0 if there is currently no render going on, 1 for offline (non-interactive rendering), 2 for interactive rendering with docked VFB, and 3 for interactive rendering in regular Corona VFB.
saveAllElements<string>filenameSaves all render elements to specified location - same as when using the Corona VFB button functionality. The provided parameter is the filename of beauty channel, other filenames are derived from it.
showLightMixSetupDialog()
Shows the LightMix setup dialog, if not currently rendering.
getVersionNumber()
Returns current Corona version encoded as a single comparable 64-bit integer version number. Version numbers returned in earlier builds are always lower than version numbers returned in later builds.
getVersionString()
Returns current Corona version formatted as a human-readable string. It is suitable to be presented to the user.
getVersionMajorNumber()
Returns current Corona version major number.
getVersionMinorNumber()
Returns current Corona version minor number.
getVersionBuildType()
Returns current Corona version build type formatted as string. I.e. one of “StableRelease”, “ReleaseCandidate”, and “DailyBuild”.
showListerDialog<integer>tabOpens Corona Lister dialog window. The tab argument determines which tab will be selected when opening the dialog, where 0 means last active tab, 1 means Lights tab and 2 means Scatters tab.
bakeLightMix()
Bakes the current LightMix configuration into the scene. This is the same as clicking the corresponding bake button in VFB.
getScriptsDirectory()
Returns a path to a directory where MAXScript scripts bundled with Corona (e.g. Corona Converter or Corona Proxy Exporter) are stored.
getDefaultRoughnessMode()
Returns the default mode for the Corona PhysicalMtl roughness mode, as set in the Corona System Settings. 0 = use roughness, 1 = use glossiness.
getDefaultIorMode()
Returns the default mode for the Corona PhysicalMtl IOR mode, as set in the Corona System Settings. 0 = use IOR, 1 = use Disney Specular.
showErrorWindow()
Shows the Corona Error Window.
Statistic IDMeaning
0Number of elapsed passes
1Number of primitives in the scene, not counting instances
2Number of primitives in the scene with instancing
3Average number of rays processed per second
4Average number of rays processed for each image sample
5Total render time in milliseconds
6Total time spent in the rendering phase (in milliseconds). This time is used for deciding when to stop progressive rendering with a time limit set.
7Estimated noise amount in the picture, in percents. Returns 0 if no estimate is available.
8Estimated remaining rendering time (in milliseconds). Returns 0 if no estimate is available.
9Memory currently allocated by Corona.
10Peak memory allocated by Corona during the last rendering.
11Virtual memory currently used by the process.
12Peak virtual memory currently used by the process.
13Virtual memory used by the system.
14Scene parsing time in ms.
15Displacement primitives.

Corona Proxy API


To invoke a method on proxy object [proxy], use CProxy.ProxyFp.[method_name] [proxy] [optional further args]

FunctionParametersdescription
getOriginalObjectName<node>proxyReturns string containing the name of the original object from which the proxy was created.
getOriginalMaterialName<node>proxyReturns string containing the name of material of the original object from which the proxy was created.
fromScene<node>proxy <node>source <filename>filenameCreates a proxy from scene object source, and saves it to file specified by filename
fromSceneAnimated<node>proxy <node>source <filename>filename <integer>frameFrom <integer>frameTo <integer>pointCloudSize <integer>samplesPerFrameSame as the other fromScene, but allows to specify additional parameters - animation range (frameFrom - frameTo), size of viewport display point cloud to precompute and store in the file, and number of motion blur samples to take
duplicateToMesh<node>proxyCreates a 3ds Max Editable Mesh from the proxy (does not delete the proxy). Same as clicking the Duplicate to mesh button in the UI.

Corona Material Library API


There are several published functions that can be invoked using the CoronaMaterialLibrary.MaterialLibraryFp interface. You can list them by executing showInterface CoronaMaterialLibrary.MaterialLibraryFp.

FunctionParametersdescription
isInstalled()
Returns TRUE if the library is currently installed. Returns FALSE otherwise (user de-selected it during Corona installation).
showBrowserIfPossible<boolean>showDisplays or hides the browser window for the library, if possible. Returns 0 if it has succeeded, non-zero if it has failed.

Corona Scatter API


Valid until version 8 in which Corona Scatter has been replaced with more advanced Chaos Scatter with its own API.

There are several published methods invokable on every CScatter object. You can list them by executing s = CScatter(); showInterfaces s. Look for the ScatterFpInterface interface there.

FunctionParametersDescription
update<interval>timeInterval <integer>referenceTimeUpdates scattering of instances for the given non-empty time interval. The specified reference time determines scattering parameters that cannot be interpolated. It is expected to lie in the interval. Returns 0 on success. Returns 1 if the user does not have a valid license. Currently, only 1 time frame long intervals are supported.
clear()
Clears scattering of instances created by last update call. Can be called to free allocated resources, but maps depending on the scatter object may be evaluated incorrectly then.
getModelCount()
Returns number of all model objects. These are original objects that get instanced by the scatter object. The count is relevant to last update call.
getModelNode<integer>indexReturns node of a model object selected by the given index. The node is relevant to last update call. It returns null if the node got deleted meanwhile. If the index is outside [0, N) interval, where N is the count returned by getModelCount, it returns null too.
getInstanceCount()
Returns number of instances. All instances scattered throughout the whole time interval specified for last update call are accounted here. For example, if scattering gets updated for 2 time frames long interval and in the first frame get scattered instances A, B, C and in the second frame get scattered instances B and D, it will return 4.
convertInstancesToGeometry<integer>timeConverts (duplicates) all instances scattered at the given time to true geometry objects. Expects the time to lie in the interval specified for last update call. Returns 0 on success. Note this may be costly for great number of instances.


There are also several published methods that can be called using the CScatter.StaticFpInterface interface. You can list them by executing showInterface CScatter.StaticFpInterface command.

FunctionParametersDescription
getVersionNumber()
Returns current plugin version encoded as a single comparable 64-bit integer version number. Version numbers returned in earlier builds are always lower than those returned in later builds.
getVersionString()
Returns current plugin version formatted as a human-readable string. It is suitable to be presented to the user.

Example scripts



Shows the Corona VFB:

CoronaRenderer.CoronaFp.showvfb true


Stops current rendering (same as pressing the STOP button in the VFB):

CoronaRenderer.CoronaFP.stopRender()


Draws a render region in the VFB (we are assuming that the output resolution is 1280×720):

renderers.current.system_vfbRegions = #([1280,720,0], [0,0,0], [1280,720,0], [10,20,0], [100,200,0], [0,0,0])


Clears all VFB regions (the VFB has to be closed first):

renderers.current.system_vfbRegions_enabled=false


Exports the current scene from 3ds max to C:\Corona\ as myscene.scn and does not start rendering it:

CoronaRenderer.CoronaFp.exportScene @"C:\Corona\myscene.scn" false


Dumps the current content of the VFB to the specified CXR file:

CoronaRenderer.CoronaFp.dumpVfb "D:/yourfilename.cxr"


Converts Teapot001 into a proxy and saves it as C:\proxy\myproxy.cgeo:

CProxy.ProxyFp.fromScene (CProxy()) $Teapot001 @"C:\proxy\myproxy.cgeo"


Converts my_proxy back to mesh:

CProxy.ProxyFp.duplicateToMesh  $my_proxy



Corona 8 New Tone Mapping Pipeline Examples



Getting last operator:

getProperty renderers.current "colorMap.pipeline"


Each operator holds the next operator (in the UI it's the one above):

getProperty (getProperty renderers.current "colorMap.pipeline") "colorMappingOperator.nextOperator"


The particular parameter values can be obtained as:

getProperty (getProperty renderers.current "colorMap.pipeline") "colorMappingOperator.opacity"


Looking for specific operator using name & setting of property:

pipeline = getProperty renderers.current "colorMap.pipeline"
while pipeline != undefined do
(
	operatorClass = classOf pipeline
	if operatorClass == WhiteBalanceOperatorPlugin then exit
	pipeline = getProperty pipeline "colorMappingOperator.nextOperator"
)
if pipeline != undefined then setProperty pipeline "colorMappingOperator.colorTemperature" 8000


- the previous code only sets the value to the first operator it finds, in case it is necessary to have a more complex pipeline with multiple operators of the same type, it is easier to create it from scratch and set the parameters right away, see below

Adding of operator (it is necessary to set unique ID) - replaces current pipeline with single contrast operator:

op = ContrastOperatorPlugin()
setProperty op "colorMappingOperator.id" 1
setProperty op "colorMappingOperator.enabled" true
setProperty op "colorMappingOperator.contrast" 0.4
setProperty renderers.current "colorMap.pipeline" op


Building own pipeline with multiple operators:

op = ContrastOperatorPlugin()
setProperty op "colorMappingOperator.id" 1
setProperty renderers.current "colorMap.pipeline" op
op2 = GreenMagentaTintOperatorPlugin()
setProperty op2 "colorMappingOperator.id" 2
setProperty op "colorMappingOperator.nextOperator" op2


All operators:

ContrastOperatorPlugin
CurvesOperatorPlugin
SimpleExposureOperatorPlugin
PhotographicExposureOperatorPlugin
FilmicOperatorPlugin
AdvancedFilmicOperatorPlugin
GreenMagentaTintOperatorPlugin
LutOperatorPlugin
ReinhardOperatorPlugin
SaturationOperatorPlugin
TintOperatorPlugin
ToneCurveOperatorPlugin
VignetteOperatorPlugin
WhiteBalanceOperatorPlugin
AcesOtOperatorPlugin


(The following are for internal purposes, no need to add them manually or change their values):

LinearToSrgbOperatorPlugin
SrgbToLinearOperatorPlugin
IdentityOperatorPlugin (assigned when user deletes all items from UI)


All parameters:

Main paramblock (renderers.current):
T_BOOL, PARAM_COLORMAP_ENABLED, "colorMap.enabled"
T_FLOAT, PARAM_COLORMAP_GAMMA, "colorMap.gamma"
TYPE_REFTARG, PARAM_COLORMAP_PIPELINE, "colorMap.pipeline"

ACES
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_ACES_OT_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_ACES_OT_OP_OPACITY, TYPE_FLOAT, _T("colorMappingOperator.opacity"),

CONTRAST
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_CONTRAST_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_CONTRAST_OP_CONTRAST, TYPE_FLOAT, _T("colorMappingOperator.contrast"),

CURVES
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_CURVES_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_CURVES_OP_MASTER_NODES, TYPE_POINT3_TAB, _T("colorMappingOperator.master.nodes"),
PARAM_CURVES_OP_MASTER_INTERPOL, TYPE_INT, _T("colorMappingOperator.master.interpol"),
PARAM_CURVES_OP_RED_NODES, TYPE_POINT3_TAB, _T("colorMappingOperator.r.nodes"),
PARAM_CURVES_OP_RED_INTERPOL, TYPE_INT, _T("colorMappingOperator.r.interpol"),
PARAM_CURVES_OP_GREEN_NODES, TYPE_POINT3_TAB, _T("colorMappingOperator.g.nodes"),
PARAM_CURVES_OP_GREEN_INTERPOL, TYPE_INT, _T("colorMappingOperator.g.interpol"),
PARAM_CURVES_OP_BLUE_NODES, TYPE_POINT3_TAB, _T("colorMappingOperator.b.nodes"),
PARAM_CURVES_OP_BLUE_INTERPOL, TYPE_INT, _T("colorMappingOperator.b.interpol"),

FILMIC
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_FILMIC_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_FILMIC_OP_HIGHLIGHTS_COMPRESSION, TYPE_FLOAT, _T("colorMappingOperator.highlightCompression"),
PARAM_FILMIC_OP_RICH_SHADOWS, TYPE_FLOAT, _T("colorMappingOperator.richShadows"),

ADV FILMIC
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_FILMIC_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_ADVANCED_FILMIC_OP_TOE_STRENGTH, TYPE_FLOAT, _T("colorMappingOperator.toeStrength"),
PARAM_ADVANCED_FILMIC_OP_TOE_LENGTH, TYPE_FLOAT, _T("colorMappingOperator.toeLength"),
PARAM_ADVANCED_FILMIC_OP_SHOULDER_STRENGTH, TYPE_FLOAT, _T("colorMappingOperator.shoulderStrength"),
PARAM_ADVANCED_FILMIC_OP_SHOULDER_LENGTH, TYPE_FLOAT, _T("colorMappingOperator.shoulderLength"),
PARAM_ADVANCED_FILMIC_OP_SHOULDER_ANGLE, TYPE_FLOAT, _T("colorMappingOperator.shoulderAngle"),

GM TINT
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_GMTINT_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_GMTINT_OP_GREEN_MAGENTA_TINT, TYPE_FLOAT, _T("colorMappingOperator.greenMagentaTint"),

LUT
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_LUT_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_LUT_OP_PATH, TYPE_FILENAME, _T("colorMappingOperator.path"),
PARAM_LUT_OP_OPACITY, TYPE_FLOAT, _T("colorMappingOperator.opacity"),
PARAM_LUT_OP_LOGARITHMIC, TYPE_BOOL, _T("colorMappingOperator.logarithmic"),

PHOTOGRAPHIC EXPOSURE
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_EXPOSURE_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),

REINHARD
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_REINHARD_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_REINHARD_OP_HIGHLIGHT_COMPRESSION, TYPE_FLOAT, _T("colorMappingOperator.highlightCompression"),

SATURATION
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_SATURATION_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_SATURATION_OP_SATURATION, TYPE_FLOAT, _T("colorMappingOperator.saturation"),

SIMPLE EXPOSURE
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_EXPOSURE_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_EXPOSURE_OP_SIMPLE_EXPOSURE, TYPE_FLOAT,_T("colorMappingOperator.simpleExposure"),

TINT
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_TINT_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_TINT_OP_TINT, TYPE_RGBA, _T("colorMappingOperator.tint"),

TONE CURVE
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_TONE_CURVE_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_TONE_CURVE_OP_HIGHLIGHTS, TYPE_FLOAT, _T("colorMappingOperator.highlights"),
PARAM_TONE_CURVE_OP_LIGHTS, TYPE_FLOAT, _T("colorMappingOperator.lights"),
PARAM_TONE_CURVE_OP_DARKS, TYPE_FLOAT, _T("colorMappingOperator.darks"),
PARAM_TONE_CURVE_OP_SHADOWS, TYPE_FLOAT, _T("colorMappingOperator.shadows"),

VIGNETTE
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_VIGNETTE_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_VIGNETTE_OP_INTENSITY, TYPE_FLOAT, _T("colorMappingOperator.intensity"),
PARAM_VIGNETTE_OP_FALLOFF, TYPE_FLOAT, _T("colorMappingOperator.falloff"),

WHITE BALANCE
PARAM_COLOR_MAP_PREDECESSOR, TYPE_REFTARG, _T("colorMappingOperator.nextOperator"),
PARAM_WHITE_BALANCE_OP_ENABLED, TYPE_BOOL, _T("colorMappingOperator.enabled"),
PARAM_WHITE_BALANCE_OP_COLOR_TEMPERATURE, TYPE_FLOAT, _T("colorMappingOperator.colorTemperature"),

Chaos Scatter MAXScript API


There are several published methods callable for every Chaos Scatter object. You can list them all by executing showInterface ChaosScatter.FpInterface (check out MAXScript Listener output).

FunctionParametersDescription
update<interval>timeInterval
<integer>referenceTime
Updates scatter for the given non-empty time interval, while blocking caller. The specified reference time determines scattering parameters that cannot be interpolated. It is expected to lie in the interval. Returns 0 on success. Returns 1 if the user does not have a valid license. Does nothing if the update is not needed. Currently, only 1 time frame long intervals are supported.
clear
Clears scatter created by last update call. Can be called to free allocated resources, but e.g. maps depending on the scatter object may be evaluated incorrectly then.
getModelCount
Returns number of all model objects. These are original objects that get instanced by the scatter object. The count is relevant to last update call.
getModelNode<integer>indexReturns node of model object selected by the given index. The node is relevant to last update call. It returns null if the node got deleted meanwhile. If the index is outside [0, N) interval, where N is the count returned by getModelCount, it returns null too. Because of performance reasons and if possible, it is suggested to prevent massive repetitive calls of this method with the same index.
getInstanceCount
Returns overall number of instances. All instances scattered throughout the whole time interval specified for last update call are accounted here. For example, if scatter gets updated for 2 time frames long interval and in the first frame get scattered instances A, B, C and in the second frame get scattered instances B and D, it will return 4.
convertInstancesToGeometry<integer>timeConverts (duplicates) all instances scattered at the given time to true geometry objects. Expects the time to lie in the interval specified for last update call. Returns 0 on success. Calling it may be costly for great number of instances.
saveConfiguration<string>filePath
<integer>reserved
Saves scatter configuration to specified file. Its format is unspecified but can be loaded back with loadConfiguration. Returns 0 on success.
loadConfiguration<string>filePathLoads scatter configuration from specified file. Expects the file to be previously saved with saveConfiguration. Returns 0 on success.


Example code for already existing Chaos Scatter object named 'Chaos Scatter001':

$'Chaos Scatter001'.saveConfiguration "C:/Temp/Export.mbc" 0


There are also properties that can be set. You can list them all by executing the following code (check out MAXScript Listener output):

showProperties $'Chaos Scatter001'

Property names have changed (are more clear) compared to Corona Scatter available in Corona 7 or older.


There are also several published free-standing functions. You can list them all by executing showInterface ChaosScatter.StaticFpInterface (check out MAXScript Listener output).

FunctionParametersDescription
getVersionNumber
Returns current plugin version encoded as a single comparable 64-bit integer version number. Version numbers returned in earlier builds are always lower than those returned in later builds.
getVersionString
Returns current plugin version formatted as a human-readable string. It is suitable to be presented to the user.


Example code:

ChaosScatter.StaticFpInterface.getVersionString()