Set default BSDF model and diffuse BRDF model

3D Studio Max Plugin (Export Script Plugins developed by [gk] and KilaD; Integrated Plugin developed by Karba)
Forum rules
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
Post Reply
tombyrom
Licensed Customer
Posts: 65
Joined: Fri Dec 15, 2023 9:26 am

Hello,
I have checked all the settings but I am unable to set the default BSDF and less importantly the diffuse BRDF model.

I always have to change this on any material created or imported from Octane to GGX (energy preserving). I sometimes forget and wonder why a material looks off.

Being able to set defaults via the 3DSmax plugin would be preferred.

I have also tried to tweak the Quixel Bridge import script to try and set it upon importing textures. I have modified the script to do other stuff but have been unsuccessful in setting the BSDF model on the created Universal Material. I have tried the below (assumptions based on the standalone API and reverse engineering other parts of the script) but I always get errors. Any help would be appreciated. Thanks

Code: Select all

// Works
        MAT_NODE_NAME = universal_material()
        MAT_NODE_NAME.name = "MS_MATNAME"
// Variations tried but dont work
        MAT_NODE_NAME.bsdfSpecularModel = 6
        MAT_NODE_NAME.bsdfModel = 6
        MAT_NODE_NAME.bsdfUniversalModel = 6

// Rest of working script... 

        if doesFileExist albedoBitmap.fileName do
        (
            MAT_NODE_NAME.albedo_tex = RGB_image ()
            MAT_NODE_NAME.albedo_tex.gamma = 2.2
            MAT_NODE_NAME.albedo_tex.name = ("Albedo")
            MAT_NODE_NAME.albedo_input_type = 2
            MAT_NODE_NAME.albedo_tex.filename = albedoBitmap.fileName
            if useTransformNode do (
                MAT_NODE_NAME.albedo_tex.transform = TransformNode
            )
        )

        if doesFileExist metallicBitmap.fileName do
        (
       .....

neonZorglub
OctaneRender Team
Posts: 1017
Joined: Sun Jul 31, 2016 10:08 pm

Hi tombyrom,

As a short answer, the syntax you need is MAT_NODE_NAME.brdf = 6

This is how to find this kind of information:
To get the maxscript syntax to set any parameter (property) of a material:
Open the Script Listener,
and in the MacroRecorder menu, select 'Enabled'

Then, in the material editor (Compact mode), change a setting of the material, and the corresponding MaxScript command will be displayed in the top pane.

For example, with a Metallic material or a Specular material, setting the BRDF model to 'GXX (energy preserving)', we see something like:
meditMaterials[3].brdf = 6

For a Diffuse material, Glossy Material, or Standard surface Mtl, there is only a 'Diffuse BRDF model', with different options, and setting the model to 'Oren-Nayar', we see something like:
meditMaterials[7].diffuseBrdf = 2

Universal material has both a 'Diffuse BRDF model' (.diffuseBrdf) and a specular 'BRDF model' (.brdf)

To see more detail about the parameters of a material, you can type for example

m = meditMaterials[1]
showproperties m

If you have a Diffuse material in the slot 1, you should see the list of all parameters, and you'll find the line
.diffuseBrdf : integer
That indicates that this parameter is an integer.
The values are specific to Octane engine:
0 for Octane
1 for Lamberian
2 for Oren-Nayar

For a Metallic material, Specular material and Universal material: we see
.brdf : integer
with the values :
0 for Octane
1 for Beckmann
2 for GGX
6 for GXX (energy preserving)
7 for STD
3 for Ward

(To get those values, you can manually set option of the BRDF parameter, and observe the MacroRecorder display, or read the value by typing m.brdf every time you change the option).

See also the topic "MaxScript usage with Octane 3dsMax"
viewtopic.php?f=27&t=62173

For your purpose of setting the default BRDF model when creating a new material, this should work, assuming you have a script to be run.
As you mentioned, it would be more simple if this can be done by the Octane plugin directly. I'll see how to add such settings in a next release.

Thanks,
tombyrom
Licensed Customer
Posts: 65
Joined: Fri Dec 15, 2023 9:26 am

Awesome! Thanks for the detailed explanation neonZorglub. That all helps a lot - I did wonder how people work out what are the correct parameters are so your guide is really useful. Thanks
Post Reply

Return to “Autodesk 3Ds Max”