Community
Arnold for Maya Forum
Rendering with Arnold in Maya using the MtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add AOVs through Maxscript

9 REPLIES 9
Reply
Message 1 of 10
RGhost77
1360 Views, 9 Replies

Add AOVs through Maxscript

Hello!

It seems Arnold's maxscript commands still not documented. I figured out how to check already added AOVs using maxscript, but can't figured out how add it?

Can someone help with this?

p.s. To devs: please make maxscript documentation for MAXtoA!


Royal Ghost | veda3d.com
Tags (1)
Labels (1)
9 REPLIES 9
Message 2 of 10
Stephen.Blair
in reply to: RGhost77

As far as I know, there's no maxtoa commands. I assume you used some generic maxscript to check the AOVs?



// Stephen Blair
// Arnold Renderer Support
Message 3 of 10
RGhost77
in reply to: RGhost77

MAXtoA expose properties of AOVs, so we can check it. Something like this:

fn checkArnoldAOVs =
(
res = false
    if renderers.current.AOV_Manager != undefined then -- aovs not added
    (
        for d = 1 to renderers.current.AOV_Manager.Drivers.count do -- aovs count
        (
            if renderers.current.AOV_Manager.Drivers[d].filenameSuffix == "Altus" then
            (
                altusAOVs = #()
                for a = 1 to renderers.current.AOV_Manager.Drivers[d].aovList.count do
                (
                append altusAOVs renderers.current.AOV_Manager.Drivers[d].aovList[a].name
                --format "%\n" renderers.current.AOV_Manager.Drivers[d].aovList[a].name
                )
                for i = 1 to altusAOVs.count do
                (
                    if \
                    (findItem altusAOVs "N") >0 and \
                    (findItem altusAOVs "P") >0 and \
                    (findItem altusAOVs "diffuse_albedo") >0 and \
                    (findItem altusAOVs "shadow_matte") >0 and \
                    (findItem altusAOVs "specular") >0 \
                    then res = true
                )
            )
        )
    )
res
)

edit: the site does not give the right post a code 😞


Royal Ghost | veda3d.com
Message 4 of 10
Lucas_3D
in reply to: RGhost77

Hi @Mike Samoilov thanks! Your code shows how to check the AOVs properties, but how can we add AOVs using MAXScript?

,

Hi Mike thanks, your code shows how to check the AOVs properties, but how can we add AOVs using MAXScript?

www.lucasmilner.com


Visualisation Artist + Digital Consultant
Message 5 of 10
RGhost77
in reply to: RGhost77

I don't know. Still no official maxscript support in MAXtoA. 😞


Royal Ghost | veda3d.com
Message 6 of 10
Lucas_3D
in reply to: RGhost77

Thank you for looking into it @Mike Samoilov 😉

www.lucasmilner.com


Visualisation Artist + Digital Consultant
Message 7 of 10
RGhost77
in reply to: RGhost77

I posted Idea about maxscript support in MAXtoA, please vote :

https://forums.autodesk.com/t5/3ds-max-ideas/arnold-maxscript/idi-p/8318742


Royal Ghost | veda3d.com
Message 8 of 10
Lucas_3D
in reply to: RGhost77

Getting very close to MAXScripting the AOVs

I found that on top of querying the name of an AOV (if you currently have one) running this syntax:
--
renderers.current.AOV_Manager.drivers[1].aovList[1].name
--
If we say the AOV is a coat pass then "coat" is returned.
In fact, by assigning the correct string you are actually changing the AOV itself, so:
--
renderers.current.AOV_Manager.drivers[1].aovList[1].name = "specular"
--
You haven't just changed the name to specular, you are now using the specular AOV.
--
renderers.current.AOV_Manager.drivers[1].aovList is the array so you can append copies of the current aov (duplicating an aov) and then change their names to any pass you want!
--
Now I just need to figure how to append the first ReferenceTarget:ArnoldAOV and ReferenceTarget:ArnoldEXRDriver and we can quickly add multiple AOV's with scripts.

www.lucasmilner.com


Visualisation Artist + Digital Consultant
Message 9 of 10
Lucas_3D
in reply to: RGhost77

Here is 'some' AOV automation:
https://www.youtube.com/watch?v=rJox4jZn-gI
https://pastebin.com/5TZG3F9Q

www.lucasmilner.com


Visualisation Artist + Digital Consultant
Message 10 of 10
OlemVolle
in reply to: RGhost77

Add new AOV:  -- The name becomes the AOV type, so make sure to get it right

 

AOVmgr = renderers.current.AOV_manager
append (AOVmgr.drivers) (ArnoldEXRDriver filenameSuffix:"MyAOVs")
append (AOVmgr.drivers[1].aovList) (ArnoldAOV name:"diffuse")

 

Just a regular append function using ArnoldEXRDriver() and ArnoldAOV() to create them.

 

 

Example #2: -- This one also sets the data type and filter type

 

append (AOVmgr.drivers[1].aovList) (ArnoldAOV name:"N" data:"vector" filter:"mitnet_filter")

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report