[Closed] Drive material editor values via a viewport control?
I’m not sure where to start – I’ve set up sliders that are driven from 0-1 based on the animations running on my rig, but I’d also like to pump those slider values into spinners in the material editor.
Are callbacks the way to go?
do you want to change some material parameters with your spinners?
could you explain what you want to do a little clear?
I want to change material editor spinner strengths with the sliders that I constructed in the viewport. My primary use for this is to control normal map blending for animated normals.
The sliders are simply circle shapes inside a rectangle that move between 0 to 1 in parent space.
I’ve had some success with this – I have it working, but it’s not pretty.
I was using registerRedrawViewsCallback to run a function that updated the specular value in a shader in the material editor, but a redrawview callback seems very ugly.
One of our tools programmers had a look and he tried using a transform change handler. This works, but doesn’t take the mouse movement into account – I can rotate the bone but only the first part of the rotation is passed through.
One other thing that I noticed is that viewport effect of the shader changing (when I was using the screenredraw callback) only happened when the material editor was open – this may or may not be down to our custom shaders, or perhaps it’s a max optimisation.
Maybe I’m misunderstanding the question, but couldn’t you just link the slider to the parameter by wiring it, or using a script controller?
Martijn
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:55.7491 width:69.946 height:50.2088 mapcoords:on pos:[1.04837,8.18418,0] isSelected:on material:meditMaterials[1]
sliderManipulator maxVal:1 xPos:0.0363636 yPos:0.0831601 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]) isSelected:on
paramWire.connect $.baseObject[#value] meditMaterials[1][#Shader_Basic_Parameters][#Specular_Level] "value"
I dont want to send max file so this maxscript should do:
1.line create box assign material from material editor slot 1
2.line create slider
3.line wire slider value to material propertie -specular level (wire it to your blending strenght)
If I have done it right then object material and material in material editor are reacting to slider.
MagicM, Stefan – thanks so much! I’d not checked the Wireparameters, and indeed you can link up to the shader values. That’s probably the answer.
Unfortunately at the minute our custom shader has no wireparameter material editor hook for the specular inputs, only offsets, but I’ll see if they can add that.
Thanks again, hopefully this is what we were after.