Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Custom material parameters for complex material setup (scripting/wireparameters/etc.)?
show user profile  Nanne
I'm working on a very complex material tree in Slate Material Editor. It's a complex mix of procedural maps as masks and composite maps with different opacity values for each layer. By animating a lot of different parameters I can get a cool aging effect of the material. I thing you get the point.

But I don't want to animate it, I would like to have a simple interface with perhaps just a "Age" slider, and when you adjust the slider it changes the values in multiple maps in order to quickly achieve different variations of this complex shader. It is simply to many parameters that are dependent on each other and need to change to get it to look good. So I want to tie up all those connection with script or wire parameters or expression to make it easier for other artist to reuse the material on different projects.

Any ideas on how to do this in Max? :)

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 341 times
5/18/2016 4:12:26 PM (last edit: 5/18/2016 4:12:26 PM)
show user profile  Garp
For a more integrated solution, you could write a Scripted Material plugin.

The plugin extends the Standard material.
In the 'rollout' block, you define your UI control (say, a simple slider) and in its 'on create' handler, you set up all your maps. In the slider's handler, you do whatever computation you need to set the various map and material parameters according to the slider's value.
You also need a 'parameters' block to make the slider's value animatable.

At least, that's the theory. I haven't done this kind of things in ages.




read 337 times
5/18/2016 5:07:17 PM (last edit: 5/18/2016 5:07:17 PM)
show user profile  Nanne
Does that work with Vray or mental ray materials?

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 329 times
5/18/2016 5:24:28 PM (last edit: 5/18/2016 5:24:28 PM)
show user profile  Garp
I don't see why not, as long as their materials and maps are exposed to mxs.

As I recall, some of the standard texture maps were not creatable by mxs. Or something along those lines. Though there might be workarounds.




read 326 times
5/18/2016 5:53:16 PM (last edit: 5/18/2016 5:53:42 PM)
show user profile  9krausec
It's been a long time since I've opened up 3ds, but couldn't you wire those parameters to a slider and have some math nodes to output the correct integer or float on a 0.0-1.0 scale (or 0-100.. whatever)?

I don't know how many utility nodes 3ds max integrated in with the slate editor.




- Portfolio-




read 318 times
5/18/2016 6:42:34 PM (last edit: 5/18/2016 6:42:34 PM)
show user profile  Garp
A simple example, just so you're not daunted by writing a little plugin.


In max, go to MAXScript > New Script, copy-paste this guy and evaluate. Then create a plane, fire the material editor and set the material to 'Test Custom'. Assign to the plane, make the map visible in the viewport and play with the slider.
The underlying material is a standard material with a composite map in the diffuse, itself with a checker and a cellular with both blend modes set to additive (and the rest to default). The slider controls the opacity values of both maps.
If you want a break down of the code, let me know :)



read 315 times
5/18/2016 6:48:57 PM (last edit: 5/18/2016 6:53:12 PM)
show user profile  Nanne
Wow! Awesome Garp! Thanks! :D
I'll try this out at the office tomorrow. I'm new to maxscript so thanks for this great starting point! :)

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 291 times
5/18/2016 10:17:11 PM (last edit: 5/18/2016 10:17:11 PM)
show user profile  Nanne
Hey Garp!

Could you explain this line:
classID:#(0x28277eb2, 0x140c0e72)

Where does these ID numbers come from, what do they mean? Is the classID referring to the class I'm just creating with this plugin, or is it classes in 3ds Max?

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 269 times
5/19/2016 10:37:12 AM (last edit: 5/19/2016 10:37:23 AM)
show user profile  Garp
The class id is an identifier unique to each plugin.
To get a new one, type genClassID() in the listener and copy-paste the result in your code.




read 245 times
5/19/2016 2:40:21 PM (last edit: 5/19/2016 2:40:21 PM)
show user profile  Nanne
Haha! Okey, I've been fiddling with this during the day and now I broke Max :(

I can't open the Material/Map Browser without Max hanging. I've tried restarting Max, even restarting the computer but it doesn't help.

Is there some way to flush out the scripted material plugin I've created so Max start working properly again?

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 237 times
5/19/2016 4:41:36 PM (last edit: 5/19/2016 4:41:36 PM)
show user profile  Garp
I don't know what you did but if you've saved your code to one of the startup folders, removing the file should fix it (?).




read 218 times
5/20/2016 2:56:56 PM (last edit: 5/20/2016 2:56:56 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org