Friday, April 29, 2011

Node navigation and resizing secrets

Today I will talk about some unspoken secrets about navigating and resizing nodes in mental mill 1.1. The nodes in mental mill can be navigated and resized in a much more sophisticated way than most users might think, so I will share those secrets with you today!

Hiding input and output parameters
Hold down the shift-key and resize the top or the bottom of your node. This will conceal the input or ouput parameter section of a node.

Scrolling within a node that is partly concealed
When a node has been changed so that either parts of the input- or output parameter section are not visible, a light gray scroll bar appears on the side. For input parameters, the scroll bar will appear on the right side, output parameters can be scrolled on the right side.

Collapsing a node
You can collapse a node all the way: Hold the shift key and drag the top or bottom border of the node so that it is entirely collapsed . This is very useful when you have nodes on your workspace that don't play an important role and that you don't want to clutter up your view. If you have got any other nodes connected, you can see that the connection wires are made semi-transparent.

Scrolling a party collapsed node / Restoring a node
  1. Double-click the Top or Bottom bar of a node to restore its default view.
  2. You can use the scroll bars to scroll within an input or output parameter section that is partly concealed
  3. When the node is in a semi-collapsed state, you can left-click and drag the splitter bar in the middle to hide and reveal the input parameter section.

Resizing preview windows
  • The preview windows of the output parameters of a node can be resized individually: Click and drag one of the corners of the preview window.
  • Preview windows can be opened and closed by left-clicking the name of the output parameter.

Friday, April 1, 2011

Procedural patterns using mental mill 1d Curve Shaders

Motivation
In the previous post I explained how you can create a ray pattern effect using basis mental mill nodes. This involved some math operations and it took a couple of nodes to make the effect work. We want to achieve the 
same result in a simpler way, so next I show you how to use the curve nodes that come with mental mill curve shader pack.
This pack includes nodes that generate one dimensional curves which can be used to drive shader parameters, remap values and colors and generate textures and patterns.

When you use those curve nodes for the first time you might get the feeling that this whole concept is a bit abstract, so I would like to give you an idea of how versatile these shaders really are and I will show one use case.

Curve Shapes

Curve shaders are able to generate curves of all kinds of shapes. Basically they implement a mathematical functions of the style y=f(x) which means that for a given input value X an output value Y is computed. The curve shader nodes were designed that you are able to see the curves graphically by opening the "graph_out" parameter of a curve node. 




Curves can be used to generate patterns using the "gradient_linear" and "gradient_radial" nodes.
Here you can see which kinds of curves you can generate

Angular and radial gradient - the boolean
switch allows to change the generation behavior
Let's try that: Just attach a curve shader to the 'curve' input of the gradient_radial node. You can change the way that the pattern is generated by enabling the boolean parameter 'Circular' which will generate a circular pattern.

Try different curves and you see how the generated texture changes. If you want to create a fancy ray pattern, use the noise_1d curve which gives you a 
large number of animatable parameters to generate random looking rays.

Adding variation

Now you know how to generate basic patterns. It gets more interesting when you start sidechaining other gradient nodes which I will show in the next steps:

The gradient_radial node has an input parameter 'offset'. Create another gradient_radial node, convert it to a float value and attach it to the 'offset' parameter of the first gradient_radial node: You see that it generates a spiral now.


I guess now you know where we will be going with this example: The offset is now driven by another gradient node. So what happens if we attach another curve generator to the second gradient node? Let's try that:





You see that the offset is too strong and that it's only offsetting in one direction because we feed only positive values to the offset. So let's change the range using a Math_float_lerp node. (Remember: A lerp nodes interpolates incoming values that ramge from 0 to 1 to range from 'start' to 'end' so that 0 is mapped to 'start' and 1 is mapped to 'end'. Values outside that range are extrapolated. )


Now the offset gives some really interesting result which we can further elaborate on by animating it. So lets add some animation on top:

Create a state_animation_time and send it to a math_float_multiply so that you can adjust the speed of the animation. Connect the result to the offset parameter of the second generator node.

Start the animation now and see, how the ray pattern is animated now.

From there you get the idea how you can create arbitrarily complex patterns by combining several gradients that drive other gradients.

Conclusion:
In case you need to create fancy ray patterns for some retro-70ies effect, you now know what you need. Though I'd expect you won't need to create this kind of procedural patterns too often, you get an idea of how you can use curve nodes to create different kinds of gradients. Driving one gradient with the result of another gradient node and adding animation on top allows you to create sophisticated effects.

Curve nodes allow you to create much more interesting effects and there are more use cases - I intend to show more in another post.

Have fun creating your own fancy patterns and playing around with them!