Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: ruil86 on 2024-07-06, 18:35:39

Title: Corona 10 maxscript
Post by: ruil86 on 2024-07-06, 18:35:39
Hi, how to change value in simple exposure in tone mappiing corona camera using maxscript?
Title: Re: Corona 10 maxscript
Post by: Aram Avetisyan on 2024-07-08, 09:05:24
Hi,

You can have a look at the maxscript documentation page:
https://docs.chaos.com/display/CRMAX/MaxScript

under Corona 8 New Tone Mapping Pipeline examples.

Specifically, if you want to set a operator to have concrete values, and given it is the only one from that type, you first search for it in the tone mapping, then set the property for it:
Code: [Select]
pipeline = getProperty renderers.current "colorMap.pipeline"
while pipeline != undefined do
(
    operatorClass = classOf pipeline
    if operatorClass == SimpleExposureOperatorPlugin then exit
    pipeline = getProperty pipeline "colorMappingOperator.nextOperator"
)
if pipeline != undefined then setProperty pipeline "colorMappingOperator.simpleExposure" 1.0

Simple exposure is usually the first in the stack (by default) and the only one, so the code above should work for you and set Simple Exposure to 1.0 - change the value according to your needs.
Title: Re: Corona 10 maxscript
Post by: Frood on 2024-07-08, 09:31:23
... and if you don't like that getProperty and setProperty stuff (like me), you can to it as well this way:

Code: [Select]
-- returns undefined if no such operator in stack
fn setSimpleExposure exposurevalue enabled:true = (
pipeline = renderers.current.colorMap_pipeline
while pipeline != undefined do (
if classof pipeline == SimpleExposureOperatorPlugin then exit
pipeline = pipeline.colorMappingOperator_nextOperator
)
if pipeline != undefined then (
pipeline.colorMappingOperator_simpleExposure = exposurevalue
  pipeline.colorMappingOperator_enabled = enabled
)
)

-- example calls:
setSimpleExposure 6

setSimpleExposure 2 enabled:false

if (setSimpleExposure 0.12345 enabled:true)==undefined do (
format "No simple exposure operator in stack.\n"
)


Good Luck



Title: Re: Corona 10 maxscript
Post by: ruil86 on 2024-07-08, 14:11:09
Thanks for the detailed answer.