Is it possible to move and scale a simple shape shader (along x/z) via functions? If so, can someone please outline this for me? I have been unsuccessful in my attempts. I am trying to use simple shape shader extensively for masking - it works great for regular patterns, and it would be so helpful if I did not have to duplicate so many nodes.
Thanks!
My first thought is to use the simple shape shader as a childlayer of a distribution-shader.
Then in-between that connection put a translate shader node.
Now using the translate shader you can change the position and scale of the simple shape shader.
Because you used this shader as a child of a distribution shader you won't affect other displacements with the translate shader node.
TU, do you mean the Transform shader? I just tried it again and the Simple Shape Shader is not affected by any of the params in the Transform shader.
Quote from: otakar on August 24, 2010, 12:04:50 PM
TU, do you mean the Transform shader? I just tried it again and the Simple Shape Shader is not affected by any of the params in the Transform shader.
I'm back home, so now I can actually really try to figure it out for you instead of thinking out loud :)
Ok, now I see. I must admit I barely touched that shader.
You already have parameters for position and scale, but you want to control these using functions (shader)?
That's not possible I think.
Or do you really only want to move the simple shape shader to somewhere else and/or make it a bit bigger/smaller?
Quote from: Tangled-Universe on August 24, 2010, 12:28:19 PM
Or do you really only want to move the simple shape shader to somewhere else and/or make it a bit bigger/smaller?
Yes, that is what I am after. Say I have a circle shape mask that is a result of a simple shape shader. What I need is a ring, so I can either create another simple shape shader and merge the two to come up with my ring or I can 'transform' that initial simple shape shader, or at least I thought I could. When you get to more complex masks this would really be nice and flexible if it worked.
And yes, I can always use an image based mask of course with its drawbacks...
Edit: Before anyone suggests using the Edge Color (good idea, though), I do need that param for smooth edges (and besides it would only work in the ring-type scenario above, not when the actual mask needs to be moved to different coordinates).
You can move the simple shape shader using the "position" parameters.
The size can be controlled with the "size" parameters. The shape size will be bound to the size of the white boundary box.
For a circle, the diameter equals the size of the boundary box.
So what you are after is this?
Right, now try to eliminate Simple Shape Shader 01_1 and 'derive' the ring from Simple Shape Shader 01 alone (by using functions I presume and some constant value fed in for the width of the ring). My envisioned use for the simple shape shader is not on heightfields but just as blending inputs for surface shaders, but that does not matter much in this discussion.
Like this? (a scalar->colour also works instead of vector->colour)
Quote from: Tangled-Universe on August 24, 2010, 02:09:50 PM
Like this? (a scalar->colour also works instead of vector->colour)
Yes, that's where I am at (though I just plug the SSS directly into the blending input, works fine).
Ok :)
So back to the problem now, what is it? :)
Moving scaling outside of the two sss-nodes does not work, since their output is linked to their boundaries.
So a translate-shader won't work.
Only option is to move and scale with the sss-nodes parameters themselves I'm afraid.
Quote from: Tangled-Universe on August 24, 2010, 02:19:42 PM
Only option is to move and scale with the sss-nodes parameters themselves I'm afraid.
So what you are saying is there is no way to eliminate that second SSS node in the example? THAT is the question. And if I want another ring of the same size, I need yet another two nodes, and so forth... At some point you get quite an army of SSS nodes :)
Quote from: otakar on August 24, 2010, 02:26:04 PM
Quote from: Tangled-Universe on August 24, 2010, 02:19:42 PM
Only option is to move and scale with the sss-nodes parameters themselves I'm afraid.
So what you are saying is there is no way to eliminate that second SSS node in the example? THAT is the question. And if I want another ring of the same size, I need yet another two nodes, and so forth... At some point you get quite an army of SSS nodes :)
Why that second sss-node specifically? I don't get you. You also need the first to get the thick circle. So why don't you move/scale them both with the same value?
Yes, for another ring you'd need two sss-nodes, again.
However, you can also use a shader array to get the circles on a grid.
Just connect the output of the merge shader into the shader-input of the shader array node.
Again this has a drawback, that it only works for displacement :(
It's probably because of the same reason that you can't derive a mask from a crater-shader.
Shader array is good, thanks for pointing that out! At least that would save you from duplicating masks that are aligned in a grid. Scaling is still an issue, though.
So let's just say I have a number of rings of different sizes (as masks) that are dispersed along the horizontal plane in some non-grid order. My idea was that I could construct the initial ring and then multiply it and scale it and place it wherever I want dynamically using the math functions (not by simply duplicating the nodes and changing their params). If all the rings are supposed to have the same width I could make it an input param (constant), so that I would have to change it only once in the project instead of changing the size in each SSS node. Makes sense?
More and more it seems to me that an image-based mask may just be necessary in this situation if I want to avoid SSS hell ;)
TU, thanks for entertaining me, though my idea did not go anywhere. I think I'll stick with the Simple Shape Shader, it's quickly becoming my favorite. I just need to keep my network organized or I'll go crazy :)
It'd be nice if the shader array node were be a bit expanded to allow for more than just grid-type arrangements. Maybe a feature request?
Using pure function instead of simple shader, it is possible to create any type of multiple masks:
This is very interesting, and I think for most people here very difficult to achieve. Maths isn't everybody's favorite (not mine at least, so I mainly stick to painted masks - I seldom use random masks, anyway). But I think it would be greatly appreciated by many if you (and other mathematical wizards) could once in while (sticky, perhaps) post some interesting 'find' in this sense. As a small catalog of tgc's to use or study whenever it's effect is usable.
---Dune
I could handle the functions better if the math formulas were there as part of the explanation. Algebra and trig are easy. I never ran across these functions in school; but I had to teach myself most of the math I know. They never went much farther than the quadratic equations in school. (I had some very good teachers, but the math teachers were mostly intellectual morons)
@mogn - I am quite fascinated by your setup ... though I have difficulties to understand the distribution itself ...
I agree with dune about that sticky post for useful functions.
Quote from: mogn on August 28, 2010, 11:55:47 AM
Using pure function instead of simple shader, it is possible to create any type of multiple masks:
Yep, I guess it's all possible. But unless you understand all the math functions, it's going to remain a dark area. That's why the Simple Shape Shader is so elegant. All of the math is contained within. Just needs more flexibility.
Thanks for the example! Works well as is.