Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
maxscript [2021/07/20 09:41] – [Corona Rendering Core] michalmaxscript [2022/06/23 11:24] (current) – [Corona 8 New Tone Mapping Pipeline Examples] maru
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 39: Line 39:
 | ''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. | | ''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. | | ''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 47: 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+)|
Line 81: 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. |
Line 114: Line 116:
 <code>CProxy.ProxyFp.duplicateToMesh  $my_proxy</code> - converts my_proxy back to mesh.\\ <code>CProxy.ProxyFp.duplicateToMesh  $my_proxy</code> - converts my_proxy back to mesh.\\
 \\ \\
 +\\
 +===== Corona 8 New Tone Mapping Pipeline Examples =====
 +
 +Getting last operator:\\
 +<code>getProperty renderers.current "colorMap.pipeline"</code> 
 +\\
 +Each operator holds the next operator (in the UI it's the one above):
 +<code>getProperty (getProperty renderers.current "colorMap.pipeline") "colorMappingOperator.nextOperator"</code>
 +\\
 +The particular parameter values can be obtained as:
 +<code>getProperty (getProperty renderers.current "colorMap.pipeline") "colorMappingOperator.opacity"</code>
 +\\
 +Looking for specific operator using name & setting of property:
 +\\
 +<code>
 +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
 +</code>
 +\\
 +- 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:
 +<code>
 +op = ContrastOperatorPlugin()
 +setProperty op "colorMappingOperator.id" 1
 +setProperty op "colorMappingOperator.enabled" true
 +setProperty op "colorMappingOperator.contrast" 0.4
 +setProperty renderers.current "colorMap.pipeline" op
 +</code>
 +\\
 +Building own pipeline with multiple operators:
 +<code>
 +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
 +</code>
 +\\
 +All operators:
 +<code>
 +ContrastOperatorPlugin
 +CurvesOperatorPlugin
 +SimpleExposureOperatorPlugin
 +PhotographicExposureOperatorPlugin
 +FilmicOperatorPlugin
 +AdvancedFilmicOperatorPlugin
 +GreenMagentaTintOperatorPlugin
 +LutOperatorPlugin
 +ReinhardOperatorPlugin
 +SaturationOperatorPlugin
 +TintOperatorPlugin
 +ToneCurveOperatorPlugin
 +VignetteOperatorPlugin
 +WhiteBalanceOperatorPlugin
 +AcesOtOperatorPlugin
 +</code>
 +\\
 +(The following are for internal purposes, no need to add them manually or change their values)
 +<code>
 +LinearToSrgbOperatorPlugin
 +SrgbToLinearOperatorPlugin
 +IdentityOperatorPlugin (assigned when user deletes all items from UI)
 +</code>
 +\\
 +\\
 +All parameters:
 +<code>
 +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"),
 +</code>

Log In