Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 21 6:06 am)
Bagginsbill's method works for me. I enjoy learning things like this.
One text file, such as the one he posted here, can create multiple mc6 file in a heartbeat.
With Parmatic you can tweak away with the Dials that are created in the Properties on the Pose Page.
You can always Paint Away afterwards.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
OK I have this one working PM style:
clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")
s = Surface(clr, 1, 1, .2, .5)
cx = Add(.4).labelled("PM:Bruise CX")
cy = Add(.525).labelled("PM:Bruise CY")
x = Add((U - cx) / 3).labelled("PM:Circular X")
y = Add((V - cy) / 12).labelled("PM:Circular Y")
.
r = sqrt(x * x + y * y)
br = Add(.07).labelled("PM:Bruise BR")
bruiseclr = ColorRamp(
IColor(90, 44, 112),
IColor(90, 56, 113),
IColor(90,70, 153),
IColor(90, 41, 154),
Scale(r, 0, br)
)
maxblend = .5
bruiseblender = maxblend * Scale(r, br, br / 2)
bruiseblender = bruiseblender * Marble3(.5, 1, scale=.5)
s.Diffuse_Color = Blend(s.Diffuse_Color, bruiseclr, bruiseblender)
How would I do "s", "r" and "bruiseblender"? I tried adding and extra set of brackets around the vale alond with "add" and "lanebeled etc" with No Joy.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
DR:
How would I do "s", "r" and "bruiseblender"?
You can't do "s" because "s" is the whole surface and you can't make a single parameter out of a whole surface.
You don't want to do "r" because r is not a set parameter, it s a per-pixel calculated value. It represents how far you are from the cx,cy coordinate. We use that as input to the Scale function inside the ColorRamp.
I assume you wanted to control "bruiseblender", or in other words, the maximum strength of the effect. But that is the variable "maxblend" which we use as one of the factors in calculating bruiseblender. So just make the ".5" be the parameter:
maxblend = Add(.5).labelled("PM:Bruise Max Blend")
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)
Quote - I assume you wanted to control "bruiseblender", or in other words, the maximum strength of the effect. But that is the variable "maxblend" which we use as one of the factors in calculating bruiseblender. So just make the ".5" be the parameter:
maxblend = Add(.5).labelled("PM:Bruise Max Blend")
Thanks, Yes that is what I wanted to do.
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")
bump = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Bump.jpg")
effect = Bias(Scale(inv(Abs(2.5 * FBM(1, 4, 3, 3, .2, .2, .2, 0, .5, .3) - .5)), .2, 1), .8)
effectclr = RED * clr
effectdisp = effect
s = Surface(clr, 1, 1, .1, .5)
s.Bump = .03 * bump
cx = Add(.4).labelled("PM:Effect CX")
cy = Add(.525).labelled("PM:Effect CY")
x = (U - cx) / Add(1).labelled("PM:Effect X Scale")
y = (V - cy) / Add(1).labelled("PM:Effect Y Scale")
er = Add(.07).labelled("PM:Effect Radius")
es = Add(.25).labelled("PM:Effect Strength")
ed = Add(.03).labelled("PM:Effect Displacement")
r = sqrt(x * x + y * y)
effectInR = Clamp(Scale(r, er, er/4)) * effect
s.Diffuse_Color = Blend(clr, effectclr, es * effectInR)
s.Displacement = ed * effectdisp * effectInR
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)
clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")
bump = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Bump.jpg")
effect = Spots(0, 1, .06, .25, .4)
effectclr = IColor(220, 190, 40) * clr
s = Surface(clr, 1, 1, .1, .5)
s.Bump = .03 * bump
cx = Add(.5).labelled("PM:Effect CX")
cy = Add(.54).labelled("PM:Effect CY")
x = (U - cx) / Add(4).labelled("PM:Effect X Scale")
y = (V - cy) / Add(1).labelled("PM:Effect Y Scale")
er = Add(.07).labelled("PM:Effect Radius")
es = Add(.35).labelled("PM:Effect Strength")
r = sqrt(x * x + y * y)
effectInR = Clamp(Scale(r, er, er/4)) * effect
s.Diffuse_Color = Blend(clr, effectclr, es * effectInR)
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)
Bagginsbill:
This is the only one, for some reason unknown to me, that I cannot duplicate.
I am using the JamesDemo.mm1.txt that you posted and the settings posted below. No Errors and it renders fine, just no black eye.
If your coordinates are reversed from mine, shouldn't I still have the Right eye with the bruise?
I've tried this several times with no sucess.
Thanks
DR
Quote - Parmatic dial settings:
Bruise U: .57
Bruise V: .6
Bruise R: .07
Bruise Blend: .5
Skin Hue: 1
Skin Value: .7
SSS: 1
Specular_Value: .1
Freckles:Blending: .8
SKin:Saturation: 1.1
Blinn:Reflectivity: .5
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
DR:
In the JamesDemo file, I made the default value of Bruise Blend to 0 because I didn't think you'd normally want a bruise as soon as you load one of the materials. Perhaps you did stuff out of order?
I downloaded the file again, so I made sure I have what you have. Then I did:
Works every time, but my bruise is on his left cheek.
Go into the Material room, select his head, and look at the preview - does it show a bruise? Go find the PM:Bruise Blend node, make sure it is not 0. When you change it, you should be able to see the bruise in the preview.
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)
DR:
It just occured to me that you might be using SR3? If so, there is a problem with the original Parmatic. SR3 changed some Poser's python callback events. They actually fixed a bug, a bug that I had worked around by looking for a different event than I should be using. If you're using SR3, do the following.
Now run that.
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)
You are a "Mind Reader" as well as a Wizard Bagginsbill.
yes, I do have P6 SR3 installed. I corrected as you mentioned and it runs correctly now. It finds and loads as well as updates when I cahnage a value dial.
Sorry, still No Bruise visible though. In all of the other cases that work really great, I can see the Bruise pn the Face Map in the Material Room. In this one I do not see the Bruise anywhere on the Face Map in the Material Room. Maybe it's alignment???
Also I tried playing with the texture that looks like vericose veins on james's Body. I did good moving it in a clockwise direction, until I got to the center of his back and then it stopped. I guess that must be where the seam is? pretty sure I can go counterclockwise as well with same stopping point. Is there a way to Bridge the Seam Joint?
What I was attempting was to seriously bruise both of his Butt Cheeks, like he had received 40 whacks with a Frat paddle.
Slowly it is permeating that layer of concrete around my skull.
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - Go into the Material room, select his head, and look at the preview - does it show a bruise? Go find the PM:Bruise Blend node, make sure it is not 0. When you change it, you should be able to see the bruise in the preview.
BB, please ignor my post further on down this page. I did as you suggested and changed the zero value to 0.5 in the Material Room and it worked fine. For some reaso using the PM Dial doesn'tseem to be working on him. Thanks for setting it to Zero for normal renders. Always thinking.
Interesting, I set the value to 0.5 in the material Room and it appeared and worked fine. In the Pose Room I set the Value to Zero, PM updated, but the bruise did not go away.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
I am now able to run it with my Granite Bruise in the script.
I added:
myNoiseNode = Noise()
myGraniteNode = Granite(myNoiseNode)
and change this: Diffuse(bruiseclr) to this: Diffuse(bruiseclr * myGraniteNode)
When I attempted to add Add(.05).labelled("PM:Granite"), it wouldn't let me. It said I was allowed only five(5) Arguments.
Thanks
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
I'm not sure what's going on with Parmatic not copying the dial setting to your shader. Is it just this one parameter or are others not updating? All of them?
When I attempted to add Add(.05).labelled("PM:Granite"), it wouldn't let me. It said I was allowed only five(5) Arguments.
Attempted to add it where? Which parameter are you trying to feed PM:Granite into?
Earlier you asked about the seam. The problem is that the test for nearness to cx, cy fails when one of those coordinates gets to the edge of the unwrapped figure. The other edge, which is physically right next to it in 3d space, is far away in UV space. There is a pretty simlple formula for doing the "wraparound" test when in UV space the figure brings U=0 next to U=1, but the body coloring doesn't span the whole UV space. Look at the texture map. You'll see that the same is not at the edge of the image and it's curved. That would be a lot of math, probably more trouble than it's worth.
Much easier would be to do two bruises, one for the left side of the map and one for the right. Merge them together the same way one bruise is merged with the original color. Just repeat.
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)
Quote - I'm not sure what's going on with Parmatic not copying the dial setting to your shader. Is it just this one parameter or are others not updating? All of them?
When I attempted to add Add(.05).labelled("PM:Granite"), it wouldn't let me. It said I was allowed only five(5) Arguments.
Attempted to add it where? Which parameter are you trying to feed PM:Granite into?
Earlier you asked about the seam. The problem is that the test for nearness to cx, cy fails when one of those coordinates gets to the edge of the unwrapped figure. The other edge, which is physically right next to it in 3d space, is far away in UV space. There is a pretty simlple formula for doing the "wraparound" test when in UV space the figure brings U=0 next to U=1, but the body coloring doesn't span the whole UV space. Look at the texture map. You'll see that the same is not at the edge of the image and it's curved. That would be a lot of math, probably more trouble than it's worth.
Much easier would be to do two bruises, one for the left side of the map and one for the right. Merge them together the same way one bruise is merged with the original color. Just repeat.
A. It seems to be just the Bruise Dial
B. I added it in the string with the other PM Dial assignments. What I wanted to do is control the strength of the Granite.
Thanks for the Information on the seam. I undrerstand it. im my world 0 deg North & 180 deg East would be next to 0 Deg North & 180 deg West,
Now the question: do I basically do another statement or two or four with a different name and co-ordinates in the same script?
Many Thanks
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Ah now I understand.
You tried to add it to this:
ApplyBruise(c.Head, Add(.4).labelled("PM:Bruise U"), Add(.525).labelled("PM:Bruise V"),
Add(.07).labelled("PM:Bruise R"), Add(0).labelled("PM:Bruise Blend"),
)
This is the invocation of the "ApplyBruise" function that I made for that script. You are trying to pass an extra argument, but there is no parameter in the function declaration to receive it. Have I overwhelmed you with computer jargon? I tried to covere this in the manual where I "gently" introduce you to Python.
We can do one of two things:
Add a parameter to the ApplyBruise function, so you can pass the argument.
Just forget about the parameter - build it into the function automatically.
The latter is quicker, but less flexible. It all depends on how you want to use the function and the resulting shader.
To add a parameter to the function we could do this:
def ApplyBruise(s, cx, cy, br, maxblend, graniteamount):
Then inside we have to figure out how to use the graniteamount value.
To my mind a very simple way is to just use it to blend between two alternatives. We just need to change one line - the place where you create the granite:
myGraniteNode = Blend(WHITE, Granite(myNoiseNode), graniteamount)
Blend takes two values and blends them using the third. It will generate a Blender node, most of the time. However, if Matmatic sees that graniteamount is always 0, it will skip the blend and just use WHITE. And later when you multiply bruiseclr * WHITE, it will reduce that to bruiseclr. In other words, when you turn things off, Matmatic will optimize away crap you don't use in the shader. Cool huh?
If you pass an Add node for the argument to graniteamount, then Matmatic can see that it is not constant - it can change. So it will produce the Blender node and wire it in.
Now you can add the additional PM value to the invocation with all the others.
Now for the coolest part. Because we wrote the ApplyBruise function in such a way that it just adds some more stuff to the Alternate_Diffuse shader tree, you can call it MORE THAN ONCE!
For example, if you want a matched pair of bruises separated by some distance, you could make yet another function:
def ApplyBruisePair(s, cx, cy, br, separation, maxblend, graniteamount):
ApplyBruise(s, cx - separation/2, cy, br, maxblend, graniteamount)
ApplyBruise(s, cx + separation/2, cy, br, maxblend, graniteamount)
Then change your call at the bottom from ApplyBruise to ApplyBruisePair and add another argument for the separation parameter, which you probably want to be a PM value.
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)
I added These:
myGraniteNode = Blend(WHITE, Granite(myNoiseNode), graniteamount)
I got and Error - graniteamount undefined.
def ApplyBruisePair(s, cx, cy, br, separation, maxblend, graniteamount):
ApplyBruise(s, cx - separation/2, cy, br, maxblend, graniteamount)
ApplyBruise(s, cx + separation/2, cy, br, maxblend, graniteamount)
I got and Error -
MATMATIC Script Error: invalid syntax (line 190)
Traceback (most recent call last):
File "C:Program FilesCurious LabsPoser 5RuntimePythonmatmaticcompiler.py", line 232, in processScript
File "", line 190
x = U - cx
^
SyntaxError: invalid syntax
!! Matmatic stopping because of error !!
------ MATMATIC COMPILER DONE ----
, Add(0.5).labelled("PM:BruiseL Blend"), Add(0.5).labelled("PM:BruiseR Blend")
I can understand the graniteamount undefined. Could I go like this?
graniteamount = (22/7)
No clue why I got and error for x = U - cx unless I need to have a cx1 and cx2
Thanks for all of your time and help.
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Did you define it first? I quote myself:
To add a parameter to the function we could do this:
def ApplyBruise(s, cx, cy, br, maxblend, graniteamount):
Then inside we have to figure out how to use the graniteamount value
I'm beginning to wonder if you have rearranged things and didn't realize the significance of what you did. I'm still puzzled by the fact that your bruise won't show up.
Post your latest script, and I'll review it in the morning.
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)
Good Morning Bagginsbill
The attached 1BruisetestA.mm1.txt.doc runs with No Errors in Matmatic. If I do not assing a value to Bruise Blend, the dial doesn't seem to work. Parmatic show no activity when i cahnge Dial Values. It works fine as long as I give it a value in the script.
I get an error if I do not assign a value to graniteamount.
If I Add this:def ApplyBruisePair(s, cx, cy, br, separation, maxblend, graniteamount):
ApplyBruise(s, cx - separation/2, cy, br, maxblend, graniteamount)
ApplyBruise(s, cx + separation/2, cy, br, maxblend, graniteamount)
I get an error.
I tried using your example: Clouds(RED, GRAY3) and was told that "Red" was not defined. I suspect it would also tel me that "Gray3" was not defined if it had continued on running.
I can follow this:
myNoiseNode = Noise()
myGraniteNode = Granite(myNoiseNode)
I guess I could do this:
myCloudsNode = Clouds(Red,Gray3)
myTurbulenceNode = Turbulence(myCloudsNode)
except I cannot get Matmatic to recognize the colors as defined.
myGraniteNode = Blend(Turbulence(myCloudsNode), Granite(myNoiseNode)
If I could get the Clouds Colors to work for me, how would I add that in the staement above?
I tried an extra set of brackets with no luck.
Thanks
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Just got back in this - I haven't sorted through all of this yet, but one comment jumped out at me.
I tried using your example: Clouds(RED, GRAY3) and was told that "Red" was not definedChuckle chuckle. Look at what you said. You claimed that you used "RED" in the code, but it told you "Red" was not defined. "Red" is not the same as "RED". If Python complained that "Red" is not defined, then you must have said "Red", not "RED" the way I did. And, yes, "Gray3" isn't right either. It's "GRAY3".
Here are all the predefined colors:
BLACK = Color(0, 0, 0)
WHITE = Color(1.0, 1.0, 1.0)
RED = Color(1, 0, 0)
GREEN = Color(0, 1, 0)
BLUE = Color(0, 0, 1)
YELLOW = Color(1, 1, 0)
CYAN = Color(0, 1, 1)
MAGENTA = Color(1, 0, 1)
GRAY1 = Color(.1)
GRAY2 = Color(.2)
GRAY3 = Color(.3)
GRAY4 = Color(.4)
GRAY5 = Color(.5)
GRAY6 = Color(.6)
GRAY7 = Color(.7)
GRAY8 = Color(.8)
GRAY9 = Color(.9)
ORANGE = Color(1, .5, 0)
SKY = Color(0, .5, 1)
SKIN = IColor(223, 175, 160)
Case matters.
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)
Quote - Here are all the predefined colors:
BLACK = Color(0, 0, 0)
WHITE = Color(1.0, 1.0, 1.0)
RED = Color(1, 0, 0)
GREEN = Color(0, 1, 0)
BLUE = Color(0, 0, 1)
YELLOW = Color(1, 1, 0)
CYAN = Color(0, 1, 1)
MAGENTA = Color(1, 0, 1)
GRAY1 = Color(.1)
GRAY2 = Color(.2)
GRAY3 = Color(.3)
GRAY4 = Color(.4)
GRAY5 = Color(.5)
GRAY6 = Color(.6)
GRAY7 = Color(.7)
GRAY8 = Color(.8)
GRAY9 = Color(.9)
ORANGE = Color(1, .5, 0)
SKY = Color(0, .5, 1)
SKIN = IColor(223, 175, 160)Case matters.
Ahhhhh, Lesson learned - Thanks
DR
Curious how I would combine three or four nodes together. Particularly with things such as Clouds with colors defined, Turbulence with colors defined etc. Apllying nodes to both sockets in the Blend Node etc.
I am attempting to practise using the Agatedemo.mm1.txt as my starting point.
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Bagginsbills
Could you post some very basic Matmatic PM Scripts.
I have been through your tutorials several times now until my eyes spin.
I am looking for basics like:
A cloud Node and maybe a granite node combined and then used as a "Bump" and as a "Displacement" - Tks
I find it much easier to comprehend what you have done when i can look at the script and the resulting P6 Material Room Results.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
The render above is using the twelve materials from the script below.
It has no indentation, so cut-and-paste will work too.
########### Let's start with simple color arithmetic.
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
clr = n1 + n2 + n3
outputs += ["A", Surface(clr)]
clr = (n1 + n2 + n3) / 3
outputs += ["B", Surface(clr)]
clr = n1 * n2 * n3
outputs += ["C", Surface(clr)]
clr = n1 - n2
outputs += ["D", Surface(clr)]
clr = abs(n1 - n2)
outputs += ["E", Surface(clr)]
clr = (abs(n1 - n2) + abs(n1 - n3)) / 2
outputs += ["F", Surface(clr)]
clr = Blend(n2, n3, .3) # this is really just .7 * n2 + .3 * n3
outputs += ["G", Surface(clr)]
########## Important Technique - MODULATION
clr = Blend(n2, n3, n1) # n1 is my modulator (the Cellular)
outputs += ["H", Surface(clr)]
n4 = Brick(WHITE, BLACK, Mortar_Width = .3)
clr = Blend(n2, n3, n4) # n4 is my modulator (the Brick)
outputs += ["I", Surface(clr)]
clr = Spots(IColor(133, 70, 185), IColor(223, 202, 151), Brick(.1, 1, Mortar_Width = .5))
outputs += ["J", Surface(clr)]
clr = Spots(IColor(133, 70, 185), IColor(223, 202, 151), Scale(n3, 1.5, 4))
outputs += ["K", Surface(clr)]
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)
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)
Thank you very much Bagginsbill.
This will give me plenty to mull over. Right off the bat, I didn't know I could do this:
clr = (abs(n1 - n2) + abs(n1 - n3)) / 2
outputs += ["F", Surface(clr)]
Many Thanks
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
The attached Script Works Fine.
When I change this:
def ApplyBruise(s, cx, cy, br, maxblend):
To this:
def ApplyBruisePair(s, cx, cy, br, maxblend):
ApplyBruise(s, cx, cy, br, maxblend)
ApplyBruise(s, cx, cy, br, maxblend)
or this:
def ApplyBruisePair(s, cx, cy, br, separation, maxblend):
ApplyBruise(s, cx - separation/2, cy, br, maxblend)
ApplyBruise(s, cx + separation/2, cy, br, maxblend)
or this:
def ApplyBruisePair(s, cx, cy, br, separation, maxblend, graniteamount):
ApplyBruise(s, cx - separation/2, cy, br, maxblend, graniteamount)
ApplyBruise(s, cx + separation/2, cy, br, maxblend, graniteamount)
I get the following Error Message
----- MATMATIC COMPILER -----
verbose 1
Warning: config scan dir not found: Runtime:Libraries:pose:MatmaticDemos
Processing script C:Program FilesCurious LabsPoser 6RuntimeLibrariesmaterialsMatmaticDemosRDNABruisesJames2Bruise.mm1.txt -> material
MATMATIC Script Error: invalid syntax (line 190)
Traceback (most recent call last):
File "C:Program FilesCurious LabsPoser 5RuntimePythonmatmaticcompiler.py", line 232, in processScript
File "", line 190
x = U - cx
^
!! Matmatic stopping because of error !!
------ MATMATIC COMPILER DONE ----
Cheers
DR
Quote - Ah now I understand.
You tried to add it to this:
ApplyBruise(c.Head, Add(.4).labelled("PM:Bruise U"), Add(.525).labelled("PM:Bruise V"),
Add(.07).labelled("PM:Bruise R"), Add(0).labelled("PM:Bruise Blend"),
)This is the invocation of the "ApplyBruise" function that I made for that script. You are trying to pass an extra argument, but there is no parameter in the function declaration to receive it. Have I overwhelmed you with computer jargon? I tried to covere this in the manual where I "gently" introduce you to Python.
We can do one of two things:
Add a parameter to the ApplyBruise function, so you can pass the argument.
Just forget about the parameter - build it into the function automatically.
The latter is quicker, but less flexible. It all depends on how you want to use the function and the resulting shader.
To add a parameter to the function we could do this:
def ApplyBruise(s, cx, cy, br, maxblend, graniteamount):
Then inside we have to figure out how to use the graniteamount value.
To my mind a very simple way is to just use it to blend between two alternatives. We just need to change one line - the place where you create the granite:
myGraniteNode = Blend(WHITE, Granite(myNoiseNode), graniteamount)
Blend takes two values and blends them using the third. It will generate a Blender node, most of the time. However, if Matmatic sees that graniteamount is always 0, it will skip the blend and just use WHITE. And later when you multiply bruiseclr * WHITE, it will reduce that to bruiseclr. In other words, when you turn things off, Matmatic will optimize away crap you don't use in the shader. Cool huh?
If you pass an Add node for the argument to graniteamount, then Matmatic can see that it is not constant - it can change. So it will produce the Blender node and wire it in.
Now you can add the additional PM value to the invocation with all the others.
Now for the coolest part. Because we wrote the ApplyBruise function in such a way that it just adds some more stuff to the Alternate_Diffuse shader tree, you can call it MORE THAN ONCE!
For example, if you want a matched pair of bruises separated by some distance, you could make yet another function:
def ApplyBruisePair(s, cx, cy, br, separation, maxblend, graniteamount):
ApplyBruise(s, cx - separation/2, cy, br, maxblend, graniteamount)
ApplyBruise(s, cx + separation/2, cy, br, maxblend, graniteamount)Then change your call at the bottom from ApplyBruise to ApplyBruisePair and add another argument for the separation parameter, which you probably want to be a PM value.
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
So you get the short version instead.
What I said to do:
Change the ApplyBruise function definition to include your granite/noise nodes and a parameter to control them. Add a new function to make a symmetrical pair of bruises. Change your ApplyBruise call.
What you did:
Changed the definition of ApplyBruise to be the definition of ApplyBruisePair. Combined the code fot two in a way that isn't even legal python, let alone what you wanted it to do.
So I've attached a new version of the script where I made the changes correctly. Look for "###" triple sharp comments - those are the changes. Unless you change the numeric values, it makes a pair of bruises, one on each cheek of the head.
I really think this script is a bit too complicated to be used as a learning tool for you. You're trying to be a master chef, when you should be at the salad bar :-)
You need to be 100% clear on the meaning and use of function definition, function call, parameter, and argument. Go over the "Writing Scripts - Basics" document again, with a fine tooth comb. If you want to do more than just change my numbers and colors here and there, you need to understand every word of that.
Create small tasks for yourself, then find a way to write a python function to do it. Then call the functions you make in various ways and orders, until you start thinking naturally in terms of breaking a problem down into function definitions and parameters, and a set of calls to those functions with different arguments. On top of that, you have to figure out how to accomplish your desired effects with shader nodes. That too will come with lots of practice, but if the python stuff is getting in your way, you need to fix that first.
Once you do that, you'll become super fast at working through shader tree variations.
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)
Quote - Sigh, I just got done typing an excrutiatingly detailed reply for 45 minutes, then when I posted it Renderosity said "Error - No Global Variables" and my post was GONE.
So you get the short version instead.
I really think this script is a bit too complicated to be used as a learning tool for you. You're trying to be a master chef, when you should be at the salad bar :-)
You need to be 100% clear on the meaning and use of function definition, function call, parameter, and argument. Go over the "Writing Scripts - Basics" document again, with a fine tooth comb. If you want to do more than just change my numbers and colors here and there, you need to understand every word of that.
Create small tasks for yourself, then find a way to write a python function to do it. Then call the functions you make in various ways and orders, until you start thinking naturally in terms of breaking a problem down into function definitions and parameters, and a set of calls to those functions with different arguments. On top of that, you have to figure out how to accomplish your desired effects with shader nodes. That too will come with lots of practice, but if the python stuff is getting in your way, you need to fix that first.
Once you do that, you'll become super fast at working through shader tree variations.
Thanks very much BB.
I now have more than enough to start making Salads.
That really bites when you spend all that time on something, only to have a Froum dump it on you.
I started doing some longer replys in NotePad and then Cut & Paste, just for that reason.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - Do you guys think this is long enough for Beta on Matmatic? Most people seem to think its working right, but I haven't seen anybody else post an original Matmatic material. So as far as I know, everybody is just using my demos. Which concerns me because I tend not to use certain nodes, and they could be buggy. Opinions?
I've read this thread a few times now - am finally using Parmatic... how cool is THIS!! - and I don't think anyone has answered your question on the Beta for Matmatic. I use it every day and besides the missing Texture Quality parameter, the thing works a treat: so, if you want to start marketing, I'll be first in the queue. I'll be the first to admit that I'm not a power-user, but consistency counts for something, doesn't it? I really am using it daily and thanks to your clear instructions can now even call .py files from within the scripts. This is a totally amazing tool: talk about extending the power of Python! Personally, I don't see a need for a GUI for it, but hey, if that's what they're clamoring for... whatever. I find it quicker and easier to debug without a GUI to insulate (hide) the source.
Okay: question. I hope you haven't already answered this somewhere else... is there some way to designate which PM: items show up in which order on the parameter dials window? Or, is that going to be in version .3?
Oh, and why am I not posting my code? Because it is the most unclever, unimaginative, uninspired Python code ever written. You've seen my stuff. Boring! I've finally gotten away from the naming-every-node-so-I-can-place-it lunacy... I name and place those nodes I want the user to see and manipulate (stuff they can't affect with parameter dials, like colours) and all the rest is just kinda strung out like your stuff is. So, the code is more readable, but heck, it's still boring.
It'll be a while before I start to synthesize in Python.
Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2
Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand]
BB - personally I'd love even a simple "front end" on Matmatic - and please please please do the same for VSS. Both these tools have redefined the way I see, use and understand 3D materials - they should be built in to Poser (though only with a hefty cut for your good self) or sold for a good solid price as a standalone.
Anyone who has used your work will jump on a commercial version - I'm a BB evangelist!
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Heh ! Well i just like using the right tool for the job so using an algorithmic approach to something like a bruise seemed a bit overcomplex to me is all. But i admit that everyone likes working differently and what i consider 'best' may not be something another person would like in their workflow.
So it was just a thought, no hard feelings or anything i hope :)