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: https://corona-renderer.com/doc/
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.
Function | Parameters | Description |
---|---|---|
showVfb | <boolean>show | Displays 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>filename | Same as resumeRender , but loads the last render from a given previously dumped EXR file. |
dumpVfb | <string>filename | Saves the current VFB contents to given file so it can be resumed later using loadAndResume . |
setDisplayedChannel | <integer>channel | If 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>renderStamp | Returns 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. | |
renderElements | <boolean>useAntialiasing | [DEPRECATED] Renders only the extra render elements, without main shading (so it is much faster). Some elements depend on the shading and will not show when using this option. Has a parameter to enable/disable antialiasing. Same as clicking “Render only elements”, or “Render only elements (without AA) in the Actions tab. Removed in version 1.5 and replaced with regular render with Render only elements checkbox enabled. |
exportScene | <string>filename <bool>renderImmediately | Exports 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. |
getCoronaVersion | [DEPRECATED] Returns current Corona version formatted as a human-readable string. It is still available but will be removed in future versions in favor of getVersionString providing the same string. |
|
getStatistic | <int>statisticId | Returns 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>temperature | Returns 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>filename | Loads 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 | |
isRendering | getRenderType |
|
reparseInteractive | While in interactive rendering session, reparses the entire scene and restarts interactive rendering. Added in version 1.5 | |
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. Added in version 1.6. | |
saveAllElements | <string>filename | Saves 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. Added in version 2. | |
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. Added in version 3. | |
getVersionString | Returns current Corona version formatted as a human-readable string. It is suitable to be presented to the user. Added in version 3. | |
getVersionMajorNumber | Returns current Corona version major number. Added in version 3. | |
getVersionMinorNumber | Returns current Corona version minor number. Added in version 3. | |
getVersionBuildType | Returns current Corona version build type formatted as string. I.e. one of “StableRelease”, “ReleaseCandidate”, and “DailyBuild”. Added in version 3. | |
showListerDialog | <integer>tab | Opens 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. Added in version 3. |
bakeLightMix | Bakes the current LightMix configuration into the scene. This is the same as clicking the corresponding bake button in VFB. Added in version 7. | |
getScriptsDirectory | Returns a path to a directory where MAXScript scripts bundled with Corona (e.g. Corona Converter or Corona Proxy Exporter) are stored. Added in version 7. | |
getDefaultRoughnessMode | Returns the default mode for the Corona PhysicalMtl roughness mode, as set in the Corona System Settings. 0 = use roughness, 1 = use glossiness. Added in version 7. | |
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. Added in version 7. | |
showErrorWindow | Shows the Corona Error Window Added in version 8. |
Statistic ID | Meaning |
---|---|
0 | Number of elapsed passes |
1 | Number of primitives in the scene, not counting instances |
2 | Number of primitives in the scene with instancing |
3 | Average number of rays processed per second |
4 | Average number of rays processed for each image sample |
5 | Total render time in milliseconds |
6 | Total time spent in the rendering phase (in milliseconds). This time is used for deciding when to stop progressive rendering with a time limit set. |
7 | Estimated noise amount in the picture, in percents. Returns 0 if no estimate is available. (Corona 1.7+) |
8 | Estimated remaining rendering time (in milliseconds). Returns 0 if no estimate is available. (Corona 2.0+) |
9 | Memory currently allocated by Corona. (Corona 6.0+) |
10 | Peak memory allocated by Corona during the last rendering. (Corona 6.0+) |
11 | Virtual memory currently used by the process. (Corona 6.0+) |
12 | Peak virtual memory currently used by the process. (Corona 6.0+) |
13 | Virtual memory used by the system. (Corona 6.0+) |
14 | Scene parsing time in ms. (Corona 6.0+) |
15 | Displacement primitives (Corona 7.0+) |
Corona Proxy API
To invoke a method on proxy object [proxy]
, use CProxy.ProxyFp.[method_name] [proxy] [optional further args]
Function | Parameters | description |
---|---|---|
getOriginalObjectName | <node>proxy | Returns string containing the name of the original object from which the proxy was created. |
getOriginalMaterialName | <node>proxy | Returns string containing the name of material of the original object from which the proxy was created. |
fromScene | <node>proxy <node>source <filename>filename | Creates 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>samplesPerFrame | Same 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>proxy | Creates 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
.
Function | Parameters | description |
---|---|---|
isSupported | [DEPRECATED] Returns TRUE if the library is supported by the running 3ds Max version. Returns FALSE otherwise. Material library is supported in every 3ds Max version except for 2012. This function is available only in Corona 1.7. | |
isInstalled | Returns TRUE if the library is currently installed. Returns FALSE otherwise (user de-selected it during Corona installation). | |
showBrowserIfPossible | <boolean>show | Displays 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. It is available since Corona 3.
Function | Parameters | description |
---|---|---|
update | <interval>timeInterval <integer>referenceTime | Updates 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>index | Returns 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>time | Converts (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.
Function | Parameters | description |
---|---|---|
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. Added in version 5. | |
getVersionString | Returns current plugin version formatted as a human-readable string. It is suitable to be presented to the user. Added in version 6. |
Example scripts
CoronaRenderer.CoronaFp.showvfb true
- shows the Corona VFB
CoronaRenderer.CoronaFP.stopRender()
- stops current rendering (same as pressing the STOP button in the VFB)
renderers.current.system_vfbRegions = #([1280,720,0], [0,0,0], [1280,720,0], [10,20,0], [100,200,0], [0,0,0])
- draws a render region in the VFB (we are assuming that the output resolution is 1280×720)
renderers.current.system_vfbRegions_enabled=false
- clears all VFB regions (the VFB has to be closed first)
CoronaRenderer.CoronaFp.exportScene @"C:\Corona\myscene.scn" false
- exports the current scene from 3ds max to C:\Corona\ as myscene.scn and does not start rendering it.
CoronaRenderer.CoronaFp.dumpVfb "D:/yourfilename.cxr"
- dumps the current content of the VFB to the specified CXR file.
CProxy.ProxyFp.fromScene (CProxy()) $Teapot001 @"C:\proxy\myproxy.cgeo"
- converts Teapot001 into a proxy and saves it as C:\proxy\myproxy.cgeo
CProxy.ProxyFp.duplicateToMesh $my_proxy
- converts my_proxy back to mesh.
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"),