Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
maxscript [2019/09/20 07:54]
mike [Corona Scatter API]
maxscript [2022/05/24 09:09]
maru [Corona Rendering Core]
Line 7: Line 7:
 Adding new functions is very easy, so contact us if you need any. Adding new functions is very easy, so contact us if you need any.
  
-^Function ^Parameters ^description ^+^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. | | ''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. | | ''resumeRender'' | | Resumes the last rendering. Same as clicking "Resume last" button in the Actions tab. |
Line 22: Line 22:
 | ''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. | | ''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. | | ''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 |+| ''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 | | ''stopRender'' | | Stops any render that is currently going on |
 | <del>''isRendering''</del> | | <del>Returns true if Corona is currently rendering. Added in version 1.5</del> Removed in version 1.6, replaced with ''getRenderType'' | | <del>''isRendering''</del> | | <del>Returns true if Corona is currently rendering. Added in version 1.5</del> Removed in version 1.6, replaced with ''getRenderType'' |
Line 29: Line 29:
 | ''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. | | ''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. | | ''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 number. Version numbers returned in earlier builds are always lower than version numbers returned in later builds. Added in version 3. |+| ''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. | | ''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. | | ''getVersionMajorNumber'' | | Returns current Corona version major number. Added in version 3. |
Line 35: Line 35:
 | ''getVersionBuildType'' | | Returns current Corona version build type formatted as string. I.e. one of "StableRelease", "ReleaseCandidate", and "DailyBuild". 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. | | ''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 ^ ^ Statistic ID ^ Meaning ^
Line 42: Line 47:
 | 3 |Average number of rays processed per second| | 3 |Average number of rays processed per second|
 | 4 |Average number of rays processed for each image sample| | 4 |Average number of rays processed for each image sample|
-| 5 |Total render time in miliseconds+| 5 |Total render time in milliseconds
-| 6 |Total time spent in the rendering phase (in miliseconds). This time is used for deciding when to stop progressive rendering with a time limit set. |+| 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+)| | 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+)| | 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 ====== ====== Corona Proxy API ======
Line 55: Line 67:
 | ''fromScene'' | ''<node>proxy <node>source <filename>filename'' | Creates a proxy from scene object ''source'', and saves it to file specified by ''filename'' | | ''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  | | ''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. |
 +
  
  
Line 67: Line 81:
  
 ====== Corona Scatter API ====== ====== Corona Scatter API ======
 +**Valid until version 8 in which Corona Scatter has been replaced with more advanced Chaos Scatter with its own [[scatter_maxscript|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. 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 ^ ^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.** |+| ''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. | | ''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. | | ''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. If the index is outside [0, N) interval, where N is the count returned by ''getModelCount'', it returns null. The node 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. | | ''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. | | ''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 ====== ====== Example scripts ======
  
Line 92: Line 112:
 <code>CoronaRenderer.CoronaFp.dumpVfb "D:/yourfilename.cxr"</code> - dumps the current content of the VFB to the specified CXR file.\\  <code>CoronaRenderer.CoronaFp.dumpVfb "D:/yourfilename.cxr"</code> - dumps the current content of the VFB to the specified CXR file.\\ 
 \\ \\
 +<code>CProxy.ProxyFp.fromScene (CProxy()) $Teapot001 @"C:\proxy\myproxy.cgeo"</code> - converts Teapot001 into a proxy and saves it as C:\proxy\myproxy.cgeo \\ 
 +\\ 
 +<code>CProxy.ProxyFp.duplicateToMesh  $my_proxy</code> - converts my_proxy back to mesh.\\ 
 +\\

Log In