Shader Mixer: controlling multiple parameters with a single parameter
sriesch
Posts: 4,241
My Shader Mixer network includes a Marble brick, which has the parameters X, Y, and Z that control scale. I want to allow these three parameters to be individually adjustable in the final shader, but also create a new parameter called Scale that adjusts all three at once.
If I create a Value brick and plug it into the F input in front of the Marble brick's Scale parameter, this allows me to create a single parameter to control the X,Y, and Z parameters together, but it also hides those parameters from the user. Is there a way to do this (or a different way to do this)?
Comments
You need four Value bricks, and three Math Binary bricks. Link three of the Value bricks to the input 1 of each of the Math brick; set the Math bricks to Multiply. Link the fourth Value brick to input 2 of the Math bricks.
It won't let me connect more than one Binary Operation brick's output to the Marble brick's P Scale input; if I try to connect the second one, it disconnects the first.
I cannot locate the Binary Operation brick in the documentation's Math Bricks section... what exactly is it's purpose (either in this example, or in general)? I'm new at the Shader Mixer thing, so nothing's obvious to me yet.
If not answered indirectly by the answers to the questions above: The three separate values will be combined into a single input (once I figure out how); how does the mixer know which corresponds to which of the three parameters (or, do I determine which of the three values correspond to the X, Y, and Z parameters of the Marble brick, just trial-and-error, or is there some pattern to it)?
Sean, which version of DS are you using? Math1 and math 2 change names to Binary and Unary. Sorry I can't remember which is which. Just woken up...but I think it's the Binary one that you want.
ReDave, what would the network look like? Would you use a mixer brick with three separate inputs?
Binary Operation = Math2, an operation with two inputs. Unary Operation = Math 1 as was, an operation with one input.
If you feed the outputs from the three Binary Operations to a Point brick you then can feed that to the Marble brick.
Oh, right. I forgot the Point brick (Geometric/Point), sorry. In my example Value 7 drives X, Value 6, Y, and Value 8 drives Z. Additionally Value 9 Global Scale drives all three.
You can change the title of a brick by clicking on its Option button and selecting "Change Tiitle...", that's what I did with the Value (9) brick.
However that will still lump all of the Value bricks together in the Surfaces tab. You can click on a surface triangle (e.g. next to 2_SkinTorso, if you applied the shader to it) to make them show up individually.
The way to unlump them is to change the Property named "Label" and make it unique on each brick. You do that by selecting Properties (the button next to Brickyard on the left edge of the Shader Mixer) then by going to the cog wheel of the four Value bricks and selecting "Parameter Settings..." and then changing the Label.
Binary Operation is just like Pendraia said, it used to be Math2 in DS3 and possibly some versions of DS4.0. It contains most of the operations that use two variables. Math1 is now called Unary Operation because it contains most of the functions usually defined with a single variable.
See the screenshot below, Pendraia.
No a Mix brick would interpolate between Base and Layer which is not what we want to do. ;-)
Edit: Yar, ninjaed.
Thanks Dave! And Richard...I really shouldn't answer before I've drank coffee. That explains why when I played last night I couldn't get it to work. That is the clearest explanation of the difference between Math1 and Math2 bricks I've seen. Thanks!
I really need to make a list of the new threads for shadermixer and see if I can get them added to the lists in my signature...there have been some great tips happening lately but they would be hard for someone to find. This is the second time in the last week I've seen a query on Math1 and Math2 bricks.
Thanks everybody! I have the shader network working now. The Multiply makes sense to me, multiplying the overall scale value with each of the three individual scale values.
So the Point brick, according to the documentation, supposedly represents a point in space. However that doesn't really seem to apply in this instance where the 3 values are representing scale; is the Point brick simply an object with three variables (X,Y,Z) that I can use anytime I need one, and doesn't need to have anything to do with spacial coordinates?
I'm still having issues with some of the parameters not retaining their brick names, I'm looking into that. However that doesn't appear to affect the ability of the shader to function, just makes it a little harder to sort out in the brickyard.
A bit of both. The marble brick input says it expects a P (for Point) so that's what I used. You can usually use any of the variable types for any of the others (colour, normal, point I think are the three available in Shader Mixer) but you'll get a warning in the log that you passed the wrong type, so for commercial work it's preferable to keep the right kind of variable type. If it's for your own use, there's really not much wrong with passing whatever is most convenient.
@Pendraia: you're most welcome!
After a bit of a delay I'm finally trying to pick up where I left off here and remember what I was doing. noob warning.
So, the Marble brick creates a greyscale pattern. Is there an option somewhere to specify the color(s) used when generating the marble pattern?
you can use a Mix Brick, use the output from the marble as the alpha channel (input) make sure the Mix brick is set to mix color, then you can set the Base and Layer colors
Thanks!
Thanks!I did a tutorial on using the mix brick the link to it is in the list in my signature. If you get stuck have a look and it may help.
Is there a way to control the order in which the parameters appear in the Surfaces(color) pane? For example in this pair of screenshots (Surfaces(color) pane in blue) the Scale parameter is stuck in the middle of the X scale, Y scale, and Z scale parameters. Not a big deal, but it might make it marginally easier for others to use if the X Y and Z scale parameters were grouped next to each other where they can be more easily found.
It doesn't appear to match the order seen in the Shader Mixer pane (in red), nor does it appear to be in alphabetical order (changing the name "Scale" to All scale" didn't move it).
Ok, I partially figured it out. I clicked on the gear icon by each parameter to get to the Parameter Settings window, and changed the Path field to be the same for all three of the X, Y, and Z parameters, and that grouped them next to each other instead of mixing them with other parameters. I don't know if there is still a way to order this group with other groups or not, but this was the only part that was bothering me.