Notifications
Clear all

[Closed] Character Rig – Button To Switch Materials

Hey there.

I have a character rigged, but I would like to create a boolean switch in the master controller that switches between two different materials that I’ve created. My only experience with linking is wired parameters. Does anyone know how to set this up? Thanks!

P.S.: I can set up a custom attribute, of course. I just need to know how to set up a conditional with two outputs, one of which goes to whatever material is linked to the geo.

11 Replies

Thinking out aloud (which is always dangerous)…I would set up CA that had a check button that when pressed would change the material…something like

on btnMaterialSwitch changed state do
(

  if state then
  (

	obj.material = OnMaterial

  )
  else
  (

	obj.material = OffMaterial

  )

)

Now this is okay, but it will hard code the object you are trying to switch.

Now I remember from a previous question I asked that you can get a list of objects who are depended on a script plugin using “refs.dependentNodes this”, but I can’t say if this will work for CA…or if there is another way to do it…I don’t really have max available to me right now…

Should this all be completely obvious to, sorry, you can ignore it

Shane

I’m not familiar. Where would I put this script?

you would need to specify a boolean parameter value also so that the CA would store the state and get it from that.

 PEN

You can also use a material modifier, apply a multi sub material to the object with the two materials in it then wire the material modifiers material ID channel to a spinner or you could wire it to a checkButton and just do an if statement in the wire to get the state of the checkButton and pass the needed integer for the material ID. I’m also wondering if the checkButton might pass a 0 or 1 as false and true and if this is the case the wire might be as simple as theBooleanValue+1.

Make a Blend material with the two materials and make a control that is wired to the blend, just animate this.

 JHN

Render two sequences with the two materials and do a blend in post (just trying to be complete )

-Johan

Dave’s idea to use a blend material and switch between the two inputs…FTW! I’m just booleaning the mix amount. Works perfectly in function. The downside is that the second color doesn’t show in the viewport, only at render time. But it works well enough for my needs.

Some of the other solutions would probably work too, but I’m not savvy enough. Thanks to all y’all.

 PEN

Are you trying to blend from one material to the other or switch? If it is a switch then the material modifier is the easiest thing in the world to set up.

1 Reply
(@stanrickkubley)
Joined: 10 months ago

Posts: 0

If I understand you, you’re saying to use a multi-sub material. The problem with that is that the geometry with the material already has a few material ID’s that I need.

I would be cautious about the blend material. It might result in you rendering both shaders (twice as long) and then discarding based on alpha. I’m not sure how max handles 0/100% opacity and whether it’s smart about it.

1 Reply
(@stanrickkubley)
Joined: 10 months ago

Posts: 0

So far so good. I’m just alternating between 0 and 100 percent. I haven’t clocked the render speed, but it SEEMS okay. Again, the biggest drawback so far is that I don’t see an accurate preview in the viewport.