PDA

View Full Version : Gradient question, stepped gradient question



medicalart
02-15-2014, 04:00 PM
I'd like to assign color to boxes based on their height. "Y-distance to pivot point" almost works, but it assigns all of the colors to the sides. Is there a way to color the entire box based on box's top-surface color? I've attached an image which shows the tallest box having a red top, the next tallest, yellow. Is there a way to get the red-topped box to be entirely red, and the yellow-topped box entirely yellow, etc., instead of having a gradient on the side surface?

Related: When a gradient is controlled by spline, the colors are smooth. When it's changed to stepped, there are only a few steps. Is there a way to numerically add steps? (eg 50?)

Sensei
02-15-2014, 06:51 PM
Make weight map with 100% on top four points, and 0% on bottom four points (or reverse). Then use weight map instead of Y axis as input to gradient.

- - - Updated - - -



Related: When a gradient is controlled by spline, the colors are smooth. When it's changed to stepped, there are only a few steps. Is there a way to numerically add steps? (eg 50?)

You would need to quantize input prior plugging it to Gradient node.

medicalart
02-16-2014, 09:08 AM
[QUOTE=Sensei;1367972]Make weight map with 100% on top four points, and 0% on bottom four points (or reverse). Then use weight map instead of Y axis as input to gradient.

- - - Updated - - -

The weight map for gradient does not appear to solve the problem. I don't want the gradient on the box. I am trying to capture a solid color, based on the height of the box, in relation to the gradient. In other words, the tallest box would be colored red (the highest value on the gradient); and the shortest box would be colored green (the lowest value on the gradient). In between sizes would be various colors, depending upon their position on the gradient.
Am I doing something wrong? Any ideas? thanks.

The gray photo shows my result. The white photo is the original photo. Arrows indicate an example of the solid color derived from the gradient.

Danner
02-16-2014, 09:39 AM
Yes, you are applying the weightmap to each box individually instead of the trio. Another approach would be to use Y distance to object, as your gradient imput, now make sure your object sits at 0. The advantage of using this instead of weightmaps is that you can set it to world coords and animate the bars with a morph and the gradient stays in place as the bar grows.

medicalart
02-16-2014, 10:48 AM
I tried the weight map as a trio, and individually and got the same result. Also tried your suggestion of Y distance to object and that didn't work, either.
The top of the boxes are then correct, but the sides show a gradient instead of a solid color. Is there a way to get a solid color onto the sides of the bars? I had used the "Y distance to pivot" to generate the image with the arrows.

medicalart
02-16-2014, 10:51 AM
You would need to quantize input prior plugging it to Gradient node.

I don't see a quantize node. Is there a quantize node that can be used to add a number of keys to a gradient? None of the numeric ones work. Thanks.

XswampyX
02-16-2014, 03:50 PM
It's a very strange request, why can't you just give each box it's own surface?

Anyway....

http://i465.photobucket.com/albums/rr16/xXswampyXx/Col_By_Height_Sml_zps01f9fe3d.jpg (http://s465.photobucket.com/user/xXswampyXx/media/Col_By_Height_Sml_zps01f9fe3d.jpg.html)

120207

medicalart
02-16-2014, 06:39 PM
Thanks for the node instruction XswampyX. I would like to give each box it's own surface, but there are too many (2,000 boxes and 200 surface textures required).
I've used a UV map, but I think your gradient node set-up will be better.

Sensei
02-16-2014, 07:05 PM
I don't see a quantize node. Is there a quantize node that can be used to add a number of keys to a gradient? None of the numeric ones work. Thanks.

You need to Multiply, then Floor then Divide by the same value as in multiply.
f.e. 16.
I will make video tutorial later.

Sensei
02-16-2014, 07:10 PM
Thanks for the node instruction XswampyX. I would like to give each box it's own surface, but there are too many (2,000 boxes and 200 surface textures required).

Mine tool WeightPolygonGroups (http://modelingpack.trueart.eu)would solve your issue immediately.
You would have different weight map value on each box.
Then just retrieve it using Vertex Maps > Weight Map, and plug to Gradient node, then to Color.

medicalart
02-17-2014, 08:11 AM
Thank you for your suggestions.

medicalart
02-17-2014, 05:20 PM
Where does one find the node "Set Max Height"? (in XswampyX screen capture). I've looked through the node list several times and don't see it anywhere... Thanks.

XswampyX
02-17-2014, 05:34 PM
Where does one find the node "Set Max Height"? (in XswampyX screen capture). I've looked through the node list several times and don't see it anywhere... Thanks.

It's just a constant -> scalar set to '5' I think. I use them just to remind me what values I could change later on when I come back to the scene.

Here's the scene... You might want to take the model over into layout and see the extra geometry that's needed to get the sides to render clean.
And it's animated, just scrub the time line and you will see that it's all automatic.

Cheers!

medicalart
02-17-2014, 05:40 PM
Wonderful. Thank you.