Sun, Nov 24, 5:35 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 21 6:06 am)



Subject: attn bagginsbill - procedural bruising?


  • 1
  • 2
tekn0m0nk ( ) posted Mon, 21 August 2006 at 4:50 AM

Quote - I just looked at your gallery. Those are really good renders. So you're working on a procedural skin shader, are you.  HEHEH

Shame on you, picking on procedurals.

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 :)


infinity10 ( ) posted Mon, 21 August 2006 at 9:47 AM
Online Now!

OMG - varicose veins....  V3's legs are going to get some treatment, methinks....

Well, bagginsbill, as always, I remain a fan of your Matmatic.

Eternal Hobbyist

 


Ghostofmacbeth ( ) posted Mon, 21 August 2006 at 9:57 AM

Dang .. Code .. Ugh. Photoshop is still MUCH easier to me :)



Dead_Reckoning ( ) posted Mon, 21 August 2006 at 11:52 AM

file_351717.jpg

> Quote - Dang .. Code .. Ugh. Photoshop is still MUCH easier to me :)

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


Dead_Reckoning ( ) posted Mon, 21 August 2006 at 1:28 PM

file_351728.jpg

> Quote - In your script, wherever you have a number, and you want to make that number be a Parmatic parameter, just wrap it in an adder and label it a special way. > > For example, up above we have this statement: > > cx = .4 > > This defines what we're using for the center x value of the bruise algorithm. We can Parmaticize it like this: > > cx = Add(.4).labelled("PM:Bruise CX") > > What I did there, was I made an Add node, with only one argument, .4. The second argument is 0, and since .4+0 is .4, it doesn't matter. Then I labelled it - that is the magic for Parmatic - the label. If the label begins with "P" "M" and a colon, then that node is important and gets a parameter. Simple isn't it? > > Get it?

OK I have this one working PM style:

Bagginsbills Vericose Veins version 8

clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")

apply to diffuse color of surface, also set soft specular

s = Surface(clr, 1, 1, .2, .5)

Move cy down a bit

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


Ghostofmacbeth ( ) posted Mon, 21 August 2006 at 2:28 PM

Sadly, what is a heartbeat is days and days for me. I hate coding stuff and that is what that stuff is. I am still fighting something I have been working on for over a year trying to deal with these stupid nodes without much luck, at times.



bagginsbill ( ) posted Mon, 21 August 2006 at 3:36 PM

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)


Faery_Light ( ) posted Mon, 21 August 2006 at 3:43 PM

Bookmark.


Let me introduce you to my multiple personalities. :)
     BluEcho...Faery_Light...Faery_Souls.


Dead_Reckoning ( ) posted Mon, 21 August 2006 at 4:19 PM

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


bagginsbill ( ) posted Mon, 21 August 2006 at 4:58 PM · edited Mon, 21 August 2006 at 5:10 PM

file_351755.jpg

**While messing around, I came up with this one. Enjoy. (The texture coordinates on my copy of James are somehow swapped! The left and right side have switched. Oh well)**

 

clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")
bump = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Bump.jpg")

poison ivy function - don't ask me how I come up with these crazy things

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

generalized effect control here - center, x and y scale, radius, strength, and displacement

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)

here I limit the effect using r from above

effectInR = Clamp(Scale(r, er, er/4)) * effect

change the color

s.Diffuse_Color = Blend(clr, effectclr, es * effectInR)

and make the welts/hives/whatever their called

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)


bagginsbill ( ) posted Mon, 21 August 2006 at 5:52 PM · edited Mon, 21 August 2006 at 5:54 PM

file_351765.jpg

**Adjustable freckles.**

clr = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Color.jpg")
bump = ImageMap(":Runtime:Textures:Poser 6 Textures:James_Face_Bump.jpg")

freckles function

effect = Spots(0, 1, .06, .25, .4)
effectclr = IColor(220, 190, 40) * clr

 

s = Surface(clr, 1, 1, .1, .5)
s.Bump = .03 * bump

generalized effect control here - center, x and y scale, radius, strength, and displacement

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)

here I limit the effect using r from above

effectInR = Clamp(Scale(r, er, er/4)) * effect

change the color

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)


Dead_Reckoning ( ) posted Mon, 21 August 2006 at 6:04 PM

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


bagginsbill ( ) posted Tue, 22 August 2006 at 7:07 AM

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:

  1. Load James
  2. Apply one of the skins, for example the "Improved" one.
  3. Select James/Body on the parameter window.
  4. Run Parmatic.
  5. Set the PM:Bruise Blend value to .5 (or whatever)

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)


bagginsbill ( ) posted Tue, 22 August 2006 at 7:27 AM

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.

  1. Open Parmatic.py in a text editor.
  2. Find the line that looks like this:
  3. if( (iEventType & poser.kEventCodeKEYSCHANGED) != 0):
  4. Replace the word kEventCodeKEYSCHANGED with kEventCodePARMCHANGED
  5. Save Parmatic.py

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)


Dead_Reckoning ( ) posted Tue, 22 August 2006 at 12:08 PM

file_351850.jpg

> Quote - 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. > > 1) Open Parmatic.py in a text editor. > 2) Find the line that looks like this: > 3) if( (iEventType & poser.kEventCodeKEYSCHANGED) != 0): > 4) Replace the word kEventCodeKEYSCHANGED with kEventCodePARMCHANGED > 5) Save Parmatic.py > > Now run that. > >   > >  

 

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


Dead_Reckoning ( ) posted Tue, 22 August 2006 at 12:54 PM · edited Tue, 22 August 2006 at 12:58 PM

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


Dead_Reckoning ( ) posted Tue, 22 August 2006 at 3:05 PM · edited Tue, 22 August 2006 at 3:08 PM

file_351896.jpg

> 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.

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


bagginsbill ( ) posted Tue, 22 August 2006 at 4:34 PM

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)


Dead_Reckoning ( ) posted Tue, 22 August 2006 at 6:05 PM · edited Tue, 22 August 2006 at 6:10 PM

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


bagginsbill ( ) posted Tue, 22 August 2006 at 8:01 PM

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:

  1. Add a parameter to the ApplyBruise function, so you can pass the argument.

  2. 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)


Dead_Reckoning ( ) posted Tue, 22 August 2006 at 9:02 PM

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


bagginsbill ( ) posted Tue, 22 August 2006 at 9:50 PM

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)


Dead_Reckoning ( ) posted Wed, 23 August 2006 at 5:31 AM · edited Wed, 23 August 2006 at 5:39 AM

file_351936.doc

> Quote - 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. > >  

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


bagginsbill ( ) posted Wed, 23 August 2006 at 9:05 AM · edited Wed, 23 August 2006 at 9:06 AM

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)


Dead_Reckoning ( ) posted Wed, 23 August 2006 at 9:23 AM

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


Dead_Reckoning ( ) posted Fri, 25 August 2006 at 10:57 AM

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


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

file_352144.jpg

**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)


bagginsbill ( ) posted Fri, 25 August 2006 at 12:05 PM

file_352146.doc

Just in case cut-and-paste doesn't work, here's the script attached.


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 ( ) posted Fri, 25 August 2006 at 1:02 PM

file_352149.doc

Here's twelve simple but interesting materials.


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 ( ) posted Fri, 25 August 2006 at 1:10 PM

file_352153.jpg

And the render


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)


Dead_Reckoning ( ) posted Fri, 25 August 2006 at 1:11 PM

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:

And I can combine all these into truly bizarre combinations

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


Dead_Reckoning ( ) posted Sat, 26 August 2006 at 6:37 AM

file_352238.doc

Good Morning Bagginsbill

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:

  1. Add a parameter to the ApplyBruise function, so you can pass the argument.

  2. 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


bagginsbill ( ) posted Sun, 27 August 2006 at 11:36 AM · edited Sun, 27 August 2006 at 11:37 AM

file_352371.doc

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.

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)


Dead_Reckoning ( ) posted Sun, 27 August 2006 at 11:47 AM

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


RobynsVeil ( ) posted Thu, 29 October 2009 at 7:06 AM

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] 

Metaphor of Chooks


ajsavill ( ) posted Sat, 31 October 2009 at 3:02 PM

 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!


  • 1
  • 2

Privacy Notice

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.