Author Topic: C8 - VFB tonemapping parameters have been hidden from Maxscripting?  (Read 5053 times)

2022-06-28, 07:32:56
Reply #15

DPS

  • Active Users
  • **
  • Posts: 118
    • View Profile
Anyone?
Specs: AMD 1950X, Aorus Gaming 7 x399, 64GB RAM, 1080ti. Win10, Max 2017, Corona 1.7.3

2022-06-28, 12:57:06
Reply #16

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12711
  • Marcin
    • View Profile

Quote
The tone mapping stack cannot be created from scratch using maxscript, or controlled using maxscript, unless you perform some manual intervention from the user interface first (e.g. create some new operators, change their values by hand). For example, if you create a fresh new scene and it already has some existing tone mapping stack, you will not be able to adjust its values using maxscript unless you change some of the values manually first. There are some technical reasons for this, and we did not predict that it could cause some issues to our users.

Could you explain in what circumstances my maxscript code won't work? So I know when I can just punch out all of my passes without having doubt? I just tried this on my base max template that has a tone mapping stack in it - and it worked.


This part only applies to Corona 8 non-hotfix version. This was improved in Corona 8 Hotfix 1 so you don't have to worry about it any more.

As to the other questions - I will do my best to get some help for you, but please allow us some extra time as this is an additional task and not the whole team is currently available.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2022-06-30, 11:38:29
Reply #17

bohus.brecka

  • Corona Team
  • Users
  • ****
  • Posts: 4
    • View Profile
Quote
And regarding ease of editing the code - if I want to add in an operator half way, is there an easy way to do this without repeatedly changing the Op, ID, and Property numbers for the whole script?

Hi, I created some sample code that should be easier to modify - all the new operators are in separate functions so the operator variable does not have to be numbered, when adding a new operator, a new function can be created by taking the old one and just rewriting the operator-specific settings (e.g. rich shadows, opacity, ...). Also the ID is generated by a function so it does not have to be numbered manually.  It could be improved further by deduplicating the common parts, but this is just for an illustration. The code does not add all the operators from the original code and they are added in reverse order (the ones added later are at the bottom, which is I think more clean). The function calls can be easily reshuffled to get a different order, or new calls can be added.

Hope this helps.

Code: [Select]
global id = 0

fn generateId =
(
id = id + 1
return id
)

fn addLutOperatorPlugin =
(
op = LutOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id

setProperty op "colorMappingOperator.enabled" false
setProperty op "colorMappingOperator.path" "L:\_Max_stuff\_Corona_LUTs_Tonemapping Only\DS_4_Values.CUBE"
setProperty op "colorMappingOperator.opacity" 1

lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)

fn addFilmicOperatorPlugin =
(
op = FilmicOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id

setProperty op "colorMappingOperator.enabled" true
setProperty op "colorMappingOperator.highlightCompression" 1
setProperty op "colorMappingOperator.Richshadows" 1

lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)

fn addReinhardOperatorPlugin =
(
op = ReinhardOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id

setProperty op "colorMappingOperator.enabled" true
setProperty op "colorMappingOperator.highlightCompression" 0.6

lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)

setProperty renderers.current "colorMap.pipeline" null
addLutOperatorPlugin()
addFilmicOperatorPlugin()
addReinhardOperatorPlugin()

Bohus

2022-07-06, 05:42:33
Reply #18

DPS

  • Active Users
  • **
  • Posts: 118
    • View Profile
Thanks Bohus
Specs: AMD 1950X, Aorus Gaming 7 x399, 64GB RAM, 1080ti. Win10, Max 2017, Corona 1.7.3

2022-07-10, 11:55:21
Reply #19

Mohammadreza Mohseni

  • Active Users
  • **
  • Posts: 152
    • View Profile
    • Instagram

2022-09-20, 16:35:56
Reply #20

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Hi Bohus,

this is the correct way

Your example reveals that the defaults for maxscript OperatorPlugins should be matched to the VFB ones.

Code: [Select]
newOp = ContrastOperatorPlugin()
This, for example, creates a ContrastOperator which is a) disabled and b) has value 0. Many default values differ from those you get when adding an operator in VFB by pressing "+" (the VFB default values are all ok).

In detail (max object defaults vs. VFB defaults):

ContrastOperatorPlugin: value is 0, should be 1
LutOperatorPlugin: opacity is 0, should be 1
ReinhardOperatorPlugin: compression is 0, gets 0.01 after adding to VFB via script and enabling it, should be 1
TintOperatorPlugin: colour is 0 0 0, should be 255 255 255
WhiteBalanceOperatorPlugin: value is 0, gets 2000 after adding to VFB via script and enabling it, should be 6500
AdvancedFilmicOperatorPlugin: toe lengh and shoulder length is 0, should be 0.5 both

And basically all operators should be enabled by default (colorMappingOperator_enabled=1).


Good Luck

Edit: Fixed in v9 RC2, thanks!

« Last Edit: 2022-10-06, 14:21:01 by Frood »
Never underestimate the power of a well placed level one spell.

2022-09-20, 17:25:26
Reply #21

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
I hope somebody finds it useful.

Yes, me :) Thanks for this and I agree to this part of your readme there particularly:

Quote
In my humble opinion, Corona new tone mapper could output easily as nice array of operators and it make things a whole lot easier and way more flexible for coders to use this awesome feature.

.. which has been my suggestion in the first place and it can still be done imho.

Anyway, I'd love to see an option to manipulate a Corona camera operator pipeline with your struct, not only the global one. Maybe just adding a public struct property to crnToneMapping where we can reference a camera and use the existing functions would be a way to go. Basically, you then could operate on this.CamNode for example instead of renderers.current if it is defined.


Good Luck



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