Author Topic: Corona 10 maxscript  (Read 316 times)

2024-07-06, 18:35:39

ruil86

  • Users
  • *
  • Posts: 2
    • View Profile
Hi, how to change value in simple exposure in tone mappiing corona camera using maxscript?

2024-07-08, 09:05:24
Reply #1

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 694
    • View Profile
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.
Aram Avetisyan | chaos-corona.com
Chaos Corona QA Specialist | contact us

2024-07-08, 09:31:23
Reply #2

Frood

  • Active Users
  • **
  • Posts: 1953
    • View Profile
    • Rakete GmbH
... 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



Never underestimate the power of a well placed level one spell.

2024-07-08, 14:11:09
Reply #3

ruil86

  • Users
  • *
  • Posts: 2
    • View Profile
Thanks for the detailed answer.