Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2025 Feb 15 11:01 am)
Wow, how long did that take you to render? Matmatic creates the file just fine for me.
But my machine chokes at everything but the very first Basic Coil when I try to render
it. And I have a 2.8 GHz Pentium with 1 GByte of memory, so that should be
powerful enough.
What are your render settings, can you post a screen shot of them?
It's pretty cool, what you did, so I'd like to get it to render and see if
I can duplicate your problem.
Holy S**T that's clever. You've exceeded me on the math.
Yeah it clobbered my PC too. I got it to work be using a much smaller cylinder and reducing the Magn (magnitude) to 1.
But if you can render with those huge magnitudes, super. My PC/Poser combo can never deal with displacements greater than about 36 inches. You are using more than 70 inches!!!!
However, the problem is the minimum displacement bounds. You need to raise it a little above the value you are actually using. Poser is stupid, it looks at the actual number that is in the Displacement input to the surface, and assumes that is the max. It isn't, because the nodes you plugged in can produce a value greater than 1, so sometimes it is wrong.
If you look closely at your render, you can see the square patches (buckets) that are missing - and you can see through them to the inside of the cylinder. The funny thing is it rendered the other side (through the missing patch) pretty well huh?
I covered this in the manual. Since you are doing really advanced stuff, you should read the "Displacements - Issues and techniques regarding complex displacements" section. The file is WritingScriptsDisplacements.html.
Here's the relevant exceprt.
If you are using displacements larger than 1 inch, Poser needs to be told. In the render settings, set the Min displacement bounds to the largest displacement value in your scene. Alternatively, you can set the Displacement Bounds on individual objects. The latter is preferable, as universally increasing the min displacement bounds slows the renderer down unnecessarily, as it assumes large displacements for all objects, even those that have no displacement.
Here's what it looks like when you forget to do this - you get holes in the prop.
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)
Hmmm - what I said was stupid. Before you multiply by 70, the value is way less than 1.
I think it's in the area of .05, so 70 * that is 3.5. Still you need to tell poser 4 inches is your greatest displacement. Or something like 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 can simplify the math a little.
Letting d be the desired diameter, m be the slope of the stripes, and I introduce k for the modulus subexpression:
r = d / 2
k = (V + m * U) % d
s = k - r
You use Sqrt(r * r - s * s)
but:
r * r - s * s
is
r * r - (k - r) * (k - r)
which is
r * r - (k * k - 2 * r * k + r * r)
which is
r * r - r * r + 2 * r * k - k * k
which is
k * (2 * r - k)
which is
k * (d - k)
So we don't ever need r and the solution is:
k = (V + m * U) % d
Sqrt(k * (d - k))
I made a function out of that - it's going into matmatic extras!
Been playing with the functions - renders real fast on a square. But on the cylinder it sucks.
I think its because the geometry of the sides of the cylinder - long thin rectangles must cause some issue.
I don't have time to try it now, but you might want to make a cylinder in some other tool that has no end caps and uses a lot of small polygons. Maybe triangles would be better than quads, too.
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)
That's strange!
My machine is anything but top class (1.5GHz Athlon / 768M RAM), the settings (posted) aren't special at all and this renders in 30 seconds.
The "cables" are actually the size of bagginsbill's columns (300% scale, 800% y scale) so I guess the displacements are rather large.
I had thought that maybe it was because I had been working in Centimeters and not Poser units - but that didn't change anything.
When I increase the Displacement Bounds in the Render up to 10, still takes less than a minute.
Another question.....
The displacements bounds of all the individual objects were at 200.
I tried using other values - but no matter what value I used, after rendering the value wer all back at 200.
Is this normal?
Rô
My favourite question is "Why?", my second favourite is "Why not?"
That's a neat simplification! Great.
Quote - I don't have time to try it now, but you might want to make a cylinder in some other tool that has no end caps and uses a lot of small polygons. Maybe triangles would be better than quads, too.
Tried that, didn't change anything. Made a few cylinders in Carrara with tons of quands and / or triangles - still got the punch through.
However, I just realized that the answer may be right in front of me.
The preview image for the surface is already showing some strange things - see the arrows onthe attached image..
I'll try and discover if this is a problem in the algorithm or if Matmatic hit some sort of boundary in one of the components.
Rô
My favourite question is "Why?", my second favourite is "Why not?"
Quote - > Quote - Wow, how long did that take you to render? Matmatic creates the file just fine for me.
But my machine chokes at everything but the very first Basic Coil when I try to render
it. And I have a 2.8 GHz Pentium with 1 GByte of memory, so that should be
powerful enough.
What are your render settings, can you post a screen shot of them?That's strange!
My machine is anything but top class (1.5GHz Athlon / 768M RAM), the settings (posted) aren't special at all and this renders in 30 seconds.
The "cables" are actually the size of bagginsbill's columns (300% scale, 800% y scale) so I guess the displacements are rather large.
I had thought that maybe it was because I had been working in Centimeters and not Poser units - but that didn't change anything.
When I increase the Displacement Bounds in the Render up to 10, still takes less than a minute.
I noticed you have Min Displacement Bounds at 0.000. I always thought it had to be
given a number to get displacement? I had mine set at 1.000, but I'll try it at 0.000.
Also I noticed you have Smooth Polygons off, so that might have been another one
of my problems. But you do have Cast Shaows on. I had that one turned off to
try to speed up the render. I guess it didn't take as much resources as I thought.
Seems that Poser isn't in to imaginary numbers. :sneaky:
Some of the Square root nodes get inputs that "mathematically" are zero, but in practice there must be some rounding errors and it goes just a tad negative - enough to throw off a whole block of the surface.
So the fix is to check this (Clamp probably) before the square root.
Thanks for the help guys - I was really worried that there was some sort of limitation to using displacement, now I'm happy again.
Later, I'll post a new script including the fix and the simplification.
Rô
My favourite question is "Why?", my second favourite is "Why not?"
def MakeThread(Turns, Threads):
Throw = 1.0 / Turns
Diam = Abs(Throw / Threads)
k = (V + Throw * U) % Diam
k = Max(k, 0) # avoid negative numbers ;-)
DispThread = Sqrt(k * (Diam - k))
return DispThread
s = Surface(IColor(210,210,150),1,ORANGE, 5, 0.05)
Disp = 0
Disp += MakeThread (6,2)
Disp += MakeThread (-4,10)
Disp += MakeThread (2,100)
s.Displacement = 10 * Disp
With a wee bit of work getting the seams and UV's lined up this could be quite useful.
Rô
My favourite question is "Why?", my second favourite is "Why not?"
That's a really neat pattern.
So Max(k,0) fixed it? I would have thought that Diam - k could be negative as well - I would have put the Max inside the Sqrt - just to be sure.
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)
How about something different - squaring a cylinder maybe?
#############
s = Surface(GRAY7,1,GRAY9, 0.3, 0.01)
Radius = 0.16 #For standard cylinder prop
Angle = 2 * pi * U #Turn U into an angle
Trig = Max ( Abs(Cos(Angle)), Abs(Sin(Angle))) #Switch between sin / cos as we go around
Disp = Radius * (1 /Trig - 1) #Displace out to make the flat surface
Disp = Disp * Interpolate(V, ['d', 0.1,1,1,0,'d', 0.5, 0,'d', 0.1,0,1]) #just the ends
s.Displacement = 30 * Disp * (Abs(N(0,1,0)) <= .01) # no caps, scalefactor adjusted by eye
This is fun (but, then again, I have a wierd idea of "fun")
Rô
My favourite question is "Why?", my second favourite is "Why not?"
Squaring the circle - I like it a lot. I think this is fun too, I spend hours making cool shapes for no reason at all.
You've taken the cylinder work in a new direction that I did. I was always thinking about lathing it. I like this a lot.
Couple challenges:
Can you make the square part fade gently into roundness, instead of abruptly? Meaning as you taper back to the original cylinder, also become round a little early.
Can you make it an eight-sided cylinder? Eight sided pillars are used a lot in architecture. This truely pointless, since you can just model an 8-sided cylinder very directly, but whatever.
In a church I saw pillars that are square at the ends, convert to a round torus with a swoop, then become 8-sided for the long middle part.
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)
Not too sure about the "swoop" bit, but here what I got.
##########
s = Surface(Marble1(GRAY8, Blend(.5*ORANGE, GRAY8, .5), 2.2, gc=1),1,WHITE, 0.6, 0.02)
Radius = 0.16 # For standard cylinder prop
TwoPi = 2.0 * pi # Need this a lot
Angle = TwoPi * U # Turn U into an angle
Disp = 0
def Torus(Start, End):
Diam = End - Start
k = (V - Start) % Diam
k = Max(k * (Diam - k), 0) # avoid negative numbers ;-)
DispTorus = Sqrt(k)
return DispTorus
Trig4 = Max ( Abs(Cos(Angle)), Abs(Sin(Angle)) )
Size4 = 1.1 # Relative to the radius
Disp4 = Radius * (Size4/Trig4 - 1) # 4-sided surface
Eighth = TwoPi / 8.0
Trig8 = Max (Abs(Cos((Angle+Eighth)%TwoPi)), Abs(Sin((Angle+Eighth)%TwoPi)))
Trig8 = Max (Trig4, Trig8) # includes the 45 degree angles
Size8 = 0.8 # Relative to the radius
Disp8 = Radius * (Size8/Trig8 - 1) # 8-sided surface
Disp = Blender (Disp4, Disp8, InRange(V, 0.15, 0.85))
T_Start = 0.15
T_End = 0.22
T_Disp = Torus (T_Start, T_End)
Disp = Blender ( Disp, T_Disp, InRange(V, T_Start, T_End))
T_Start = 0.78
T_End = 0.85
T_Disp = Torus (T_Start, T_End)
Disp = Blender ( Disp, T_Disp, InRange(V, T_Start, T_End))
s.Displacement = 30 * Disp * (Abs(N(0,1,0)) <= .01) # no caps
As for the smooth blending between the square and circular parts, it's probably just a matter of putting in the right bias (still learning)
Rô
My favourite question is "Why?", my second favourite is "Why not?"
Oh wow you did it. Fantastic - this is going into the manual ok?
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)
Now I'll point out a trick. You seem pretty clever, so maybe you know it already. But you didn't use it, so here we go.
Suppose you make a function that uses V - i.e. it evolves in the vertical dimension, as you have done many times now. Suppose this we know this function confines it's most interesting work where 0 <= V <= .5, i.e. it does nothing interesting when .5 < V.
Now let's define a variable like this (the name is a clue):
symV = Min(V, 1-V)
And you replace all occurences of V in your function with symV.
What do you get?
This is one of my favorite tricks. How much of your church pillar goes away? How many nodes disappear?
For this really advanced stuff, reducing node count can be the most fun part of the effort.
I hope you don't mind the challenges. I'm enjoying the fact that I seem to have a kindred spirit.
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)
symV = Min(V, 1-V)
Yep, another nice trick - that should make things easier.
Quote - I hope you don't mind the challenges. I'm enjoying the fact that I seem to have a kindred spirit.
Mind? Nah, this is fun. To me procedural material is the way to go.
Don't know if you've seen FilterForge (2D procedural textures - in beta test), this is what got me into this stuff. (There I go by the name of "byRo" - pity somebody already had that name here)
Now that you have made it possible to create 3D textures with just a few lines of "code", I do find it rather strange that more folks haven't chipped in.
I'm sure we have barely sratched the surface (ugh, a pun?) of what can be done.
Rô
(PS I just can't resist a challenge)
My favourite question is "Why?", my second favourite is "Why not?"
Congrats to both of you.
Bagginsbill for offering such a fantastic Python Feature and Ropeypopey for the new scripts for matmatic.
Between the two of you genious types, it like ready a thriller novel. Cannot even begin to imagine what you will dream up next.
Could these have Parmatic added to make variances in the columns???
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Could you possibly show these with the corrections?
Many Thanks
Quote -
Using the "column" example I made something a bit more complex - something like a coil, rope or cabling.
Here is the "code"s = Surface(GRAY7,1,GRAY9, 0.3, 0.01)
BASIC COIL
Dia_1 = 0.05
Rad_1 = Dia_1 / 2
Saw_1 = (V + 0.2 * U) % Dia_1 - Rad_1
Disp = Sqrt ( Rad_1 * Rad_1 - Saw_1 * Saw_1)COIL on COIL
Veins = 4
Dia_2 = Dia_1 / Veins
Rad_2 = Dia_2 / 2
Saw_2 = (V - 0.1 * U) % Dia_2 - Rad_2
Disp += Sqrt ( Rad_2 * Rad_2 - Saw_2 * Saw_2)COIL on COIL again
SubVeins = 2
Dia_3 = Dia_2 / SubVeins
Rad_3 = Dia_3 / 2
Saw_3 = (V + U) % Dia_3 - Rad_3
Disp += Sqrt ( Rad_3 * Rad_3 - Saw_3 * Saw_3)Magn = 70
Disp = Magn * (Disp - (Rad_1 / 2))
s.Displacement = DispRô
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - Could you possibly show these with the corrections?
The code about 10 posts up (with the golden primitive props) is the almost correct version.
It looks different because, instead of coding three separate coils, I made a "coil" function and then just called it three times with different parameters.
As bagginsbill pointed out there is still a correction to be made there however:
The lines:
k = Max(k, 0) # avoid negative numbers ;-)
DispThread = Sqrt(k * (Diam - k))
Should read:
k = Max(k * (Diam - k, 0) # avoid negative numbers ;-)
DispThread = Sqrt(k)
It worked without the correction, but best to be sure.
Rô
My favourite question is "Why?", my second favourite is "Why not?"
Quote - > Quote - Congrats to both of you.....
Thanks for the kind words, mariner.
Here's another one (W.I.P.) - the one in the front is (more or less) what I was aiming for, the one's in the background were just happy little accidents.
Rô
You are most welcome.
I use math mainly for navigating the 7 Seas(TanC = Dlo/m - SecC *l = D). You two are wizards at using it to create various shape and texture modifications.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
As written, this doesn't seen to work for me:
k = Max(k * (Diam - k, 0) # avoid negative numbers ;-)
I finally figured out you are missing an inner closing brace:
k = Max(k * (Diam - k), 0) # avoid negative numbers ;-)
____________^
(I assume just a typo in your post, because I guess the script worked on your computer)
Quote - As written, this doesn't seen to work for me:
k = Max(k * (Diam - k, 0) # avoid negative numbers ;-)
I finally figured out you are missing an inner closing brace:
k = Max(k * (Diam - k), 0) # avoid negative numbers ;-)
____________^(I assume just a typo in your post, because I guess the script worked on your computer)
Thanks Fazzel
Got another question:
Shouldn't there be more here to create the 3 or 4 different mt5 files based on the different disp values???????
Disp = 0
Disp += MakeThread (6,2)
Disp += MakeThread (-4,10)
Disp += MakeThread (2,100)
s.Displacement = 10 * Disp
Many Thanks
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - Fazzel: I assume just a typo in your post, because I guess the script worked on your computer
Many thanks, Fazzel. I must remember to double check the listings. :rolleyes:
(Glad to see you cracked it )
Quote - Mariner: Shouldn't there be more here to create the 3 or 4 different mt5 files based on the different disp values???????
Mariner, If we were making 3 different materials to be used as alternatives then this would be the case.
Here, however, we are "layering" three displacements on top of each other in one material, so there is only one displacemento map.
The "Disp += ........" is just a shorthand way of saying "Disp = Disp + ..........", so what we are doing is adding one "thread" on top of the rest.
Rô
My favourite question is "Why?", my second favourite is "Why not?"
Many thanks Ro
As I mentioned above, sometimes I can be a thick as a fence post when it comes to understanding these.
I am much more at home operating these bad boys:
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - > Quote - I am much more at home operating these bad boys:
I think the second ladder onthe left ismissing a screw - you can use mine (W.I.P.)
Rô
As long as it's Stainless, I will take all you have for fasteners.
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Quote - > Quote - I am much more at home operating these bad boys:
I think the second ladder onthe left ismissing a screw - you can use mine (W.I.P.)
Rô
Is this yet another Matmatic script that you have written?
Also, "How" did you get the "Rope" on the far right in your first post?
Cheers
DR
"That government is
best which governs the least, because its people discipline
themselves."
Thomas Jefferson
Sorry about the delay....
Quote - Is this yet another Matmatic script that you have written?
Yep, though it gave me a lot more work than I thought it would.
Even so, the "base" of the screw is a left-over end of the cylinder - looked cute so I left it there.
Quote - Also, "How" did you get the "Rope" on the far right in your first post?
It's the same three-layered displacment, but used on a longer cylinder.
Cheers,
Rô
My favourite question is "Why?", my second favourite is "Why not?"
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.
![file_352807.jpg](https://live.cdn.renderosity.com/forum/threads/2663295/file_352807.jpg)
First, many many thanks to bagginsbill for taking the drudge out of procedural material. Now it is possible to concentrate on the algorithm without getting tied up in knots trying to wire it all together.Using the "column" example I made something a bit more complex - something like a coil, rope or cabling.
Here is the "code"
s = Surface(GRAY7,1,GRAY9, 0.3, 0.01)
BASIC COIL
Dia_1 = 0.05
Rad_1 = Dia_1 / 2
Saw_1 = (V + 0.2 * U) % Dia_1 - Rad_1
Disp = Sqrt ( Rad_1 * Rad_1 - Saw_1 * Saw_1)
COIL on COIL
Veins = 4
Dia_2 = Dia_1 / Veins
Rad_2 = Dia_2 / 2
Saw_2 = (V - 0.1 * U) % Dia_2 - Rad_2
Disp += Sqrt ( Rad_2 * Rad_2 - Saw_2 * Saw_2)
COIL on COIL again
SubVeins = 2
Dia_3 = Dia_2 / SubVeins
Rad_3 = Dia_3 / 2
Saw_3 = (V + U) % Dia_3 - Rad_3
Disp += Sqrt ( Rad_3 * Rad_3 - Saw_3 * Saw_3)
Magn = 70
Disp = Magn * (Disp - (Rad_1 / 2))
s.Displacement = Disp
All very nice but the render shows some strange interference. I've tried messing around with Poser's settings but nothing solved it.
Can anyone identify what's happening?
Is this some limit to what can be done with displacement mapping?
Thanks!
Rô
My favourite question is "Why?", my second favourite is "Why not?"