Forum: Poser - OFFICIAL


Subject: attn bagginsbill - procedural bruising?

PapaBlueMarlin opened this issue on Aug 18, 2006 · 87 posts


bagginsbill posted Fri, 25 August 2006 at 12:01 PM

**Sorry I took so long to answer - been busy at work.**

The render above is using the twelve materials from the script below.

It has no indentation, so cut-and-paste will work too.

Here are some demonstrations of combining nodes together.

This script will generate a bunch of simple material files.

I suggest you make a new directory for it, so the plethora of materials

it makes doesn't get all mixed up with your others.

Here we go.

There are many options you can use - which to use depends on the desired result.

########### Let's start with simple color arithmetic.

First I'll make some interesting patterns

n1 = Cellular(BLACK, 1, WHITE, 1, .1, .1, .1, cellMode = 3)
n2 = Spots(IColor(133, 70, 185), IColor(223, 202, 151), 1, .1)
n3 = IColor(150, 255, 50) * FBM() # the FBM node has no color argument, but you can just multiply it with one

So one utterly simple thing to do is add them up. This will be too bright, though.

clr = n1 + n2 + n3
outputs += ["A", Surface(clr)]

I can take the average instead of the sum - just divide by 3!

clr = (n1 + n2 + n3) / 3
outputs += ["B", Surface(clr)]

I can multiply them together

clr = n1 * n2 * n3
outputs += ["C", Surface(clr)]

I can subtract

clr = n1 - n2
outputs += ["D", Surface(clr)]

Or if I take the absolute value of the subtraction, I get the magnitude of the difference

clr = abs(n1 - n2)
outputs += ["E", Surface(clr)]

And I can combine all these into truly bizarre combinations

clr = (abs(n1 - n2) + abs(n1 - n3)) / 2
outputs += ["F", Surface(clr)]

I can do a weighted sum using the Blend function (which makes a Blender node most of the time)

clr = Blend(n2, n3, .3)  # this is really just .7 * n2 + .3 * n3
outputs += ["G", Surface(clr)]

 

########## Important Technique - MODULATION

Modulation involves taking the output of one node and feeding it as a parameter input to another node.

Up to now, all my numeric parameters have been constants. But by modulating a parameter, it will

vary and cause interesting effects. Some forms of modulation are very common, others are not.

Basically anywhere you type in a number or a color, you can stick a node instead and modulate.

Technically, we have been modulating all along, but it wasn't so obvious. For example, the Add node

takes two numbers Value_1, and Value2. We can say Add(1, 2) and get 3. But that's totally uninteresting.

However Add(n1, n2) is modulating the Add node and produces various answers. And, because this is the

whole point of Matmatic, when you say n1 + n2, you really mean modulate an Add node with n1 and n2.

We were also modulating the Blender node when we said Blend(n1, n2, .3). If I say Blend(RED, BLUE, .3),

then I'm not modulating anything because the inputs to the Blender node are constants.

It often helps to keep things organized by putting the modulator into a variable, like above

 n1 = ...

and then use the word variable instead of the whole function call. But there's nothing stopping you

from just nesting one function call in another directly. I do it when I'm lazy.

The most common modulation that people are pretty well used to is modulating a Blender.

clr = Blend(n2, n3, n1) # n1 is my modulator (the Cellular)
outputs += ["H", Surface(clr)]

If the modulating node has sharp boundaries, then so will the result.

n4 = Brick(WHITE, BLACK, Mortar_Width = .3)
clr = Blend(n2, n3, n4) # n4 is my modulator (the Brick)
outputs += ["I", Surface(clr)]

Now let's get wierd - how about modulating the scale of some spots with the some brick?

clr = Spots(IColor(133, 70, 185), IColor(223, 202, 151), Brick(.1, 1, Mortar_Width = .5))
outputs += ["J", Surface(clr)]

Or modulating with the FBM node from above - but I'm going to scale it first so it goes from .5 to 1.5

clr = Spots(IColor(133, 70, 185), IColor(223, 202, 151), Scale(n3, 1.5, 4))
outputs += ["K", Surface(clr)]

Too much bizarre modulation just produces junk. But carefully chosen modulation can do

really interesting things. It takes a lot of practice before you can think ahead to what

a given modulation will produce. When you can do that, you can invent some very neat

patterns using very few nodes. You also need to be comfortable with converting the modulating

node value into the right range and shape for the parameter you're modulating. Scale, Bias, Gain,

these are your friends!

For example, here's one where the spots get smaller where the specular highlight is!

clr = Spots(IColor(133, 70, 185), IColor(223, 202, 151), Scale(Bias(Specular(WHITE, 1, 1), .3), 1.2, .02))
outputs += ["L", Surface(clr)]

 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)