Using maxscript to turn material Backface culling property on/off

Hi, I have a 3dsmax file with a lot of materials that currently all have the backface culling checkbox from the Babylon attributes checked. However i would like to turn it off for all of them and wanted to use a quick max-script but i can’t seem to find a solution online.

Schermafbeelding 2021-10-12 150908

Is it possible to acces this property from maxscript or is there another way? Or will i have to do them all manually?

thanks in advance!

1 Like

This is a pretty good question and I have no idea tbh :slight_smile:

Let me add our exporter GURU @Guillaume_Pelletier to the thread so that he could enlighten us.

1 Like

Hey Guy’s,
Sorry for late reply.
Yes, you can change the value using the MaxScript.
The Babylon Attributes is a standard 3DSMax Custom Attribute.
here a small example

-- get the material selected into the view : you may change this to select all the material from the scene
n = SME.GetMtlinParamEditor()
-- access the babylon attributes
att = n.custAttributes["Babylon Attributes"]
-- optional show all the availables properties
showProperties att
-- change the value to desired one
att.babylonBackfaceCulling = true

A more complex one, which select all the material should be

/* script work only when Slate Material Editor is open */
if sme.IsOpen() == false then (
/* select all nodes */
viewNode = sme.GetView (sme.activeView)
n = viewNode.GetSelectedNodes()
l = n.count
/* foreach node, test if a babylon custom attribute is present. */
for i = 1 to l do ( 
   att = n[i].reference.custAttributes["Babylon Attributes"]; 
   if att != undefined then( 
       att.babylonBackfaceCulling = true
1 Like

Thanks, This will save me a lot of work!