PDA

View Full Version : Drive material editor values via a viewport control?


Rick Stirling
09-22-2009, 11:34 PM
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?

denisT
09-23-2009, 01:11 AM
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?

Rick Stirling
09-23-2009, 08:15 AM
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.

Rick Stirling
09-23-2009, 04:37 PM
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.

magicm
09-23-2009, 06:32 PM
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

stefan
09-23-2009, 06:42 PM
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.

Rick Stirling
09-23-2009, 06:48 PM
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.

CGTalk Moderation
09-23-2009, 06:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.