Color on a Surface

Wondering if anyone can help me understand why the surface I have here is showing GREEN at the beginning of the list [X,0] and RED at the end of the list [X,10] when the list is telling me otherwise.

Capture

Color on Surface.dyn (20.4 KB)

It looks like your colors are based on (121) points but you’re applying them to a single surface.

EDIT: Were you expecting something more like this?


I’ve never tried applying a color gradient directly to a surface so I’m not sure if it’s possible. You might try FaceAnalysisDisplay.ByViewFacePointsAndValues.

Thanks for the reply Nick… Most of what I have is what I was looking for, trying to color the surface and not the points. I am using the Display.BySurfaceColors node. I just have the points up there to see where the color is being applied to along the surface. This is where I’m thinking that there might be something I don’t understand correctly.

Even when I apply just a gradient color range across the surface I still get this weird thing happening with the color in the beginning and end of the list.

This isn’t for Revit so the FaceAnalysisDisplay node won’t be much help… I’m uploading this to the web for use with Fractal.

Right, the only reason I showed the gradient with points is because (as far as I’m aware) it’s not possible to apply a color gradient to a surface.

Yes you have a color range but that’s only for determining colors at the specific parameters. If you look at the output from Color Range it’s likely a list of 121 individual colors and you can’t apply multiple colors to a single surface. Your best bet is to either divide your surface into multiple smaller surfaces and apply colors to those OR use a lot more points to visually render a surface.

Using a 100x100 array of points instead of 10x10.

I thought the Display.BySurfaceColors node does just that… Colors a surface by individual colors at specific UV parameters based upon the list structure… No?

Very possible. I’ve only ever used points to represent a gradient surface because it lets me run checks at a lower fidelity.

Can you explain more why you use points to do a gradient?

Honestly it’s partly because I’ve never had any luck getting surface gradients to work. But it looks like that’s definitely possible.
Also because I can grade a large area quickly if I use a smaller fidelity (spacing of my points). But I don’t know if that’s any quicker than properly using a surface gradient.

Still wondering if anyone has any possible explanations for this?.. Thanks!

@Jason.Wheeler can you upload your .dyn file?

Hi Amy… the .dyn file is attached in the original post above :slightly_smiling_face:

@Jason.Wheeler Ok I just had a look at it, the bool output of the “Geometry.DoesIntersect” was maintaining the list structure of the lines, which was formed by the z values of their start points, and the geometry intersects at x and y values so that’s why the list outputs all begin with red and ended with green.

I tried grouping the lines’ start points by their y values, which fixed the list mixing, but still showed the strange gradients and color at the beginning and the end and also transposed the color mapping. The only way I can get a clean distinction of the two colors on the surface is by using “count true” and “count false” then list of repeated item (as shown below) but this also transposed the color mapping.

There’s probably something I don’t know about how the Display.BySurfaceColors node maps the color onto the surface but this has me curious :sweat_smile: In any case, the reason your lists were showing red in the beginning and green at the end was because of the z value grouping.

Is this the result you seek?


Otherwise, could you explain what you mean with “weird thing happening with the color in the beginning and end of the list”?

@Yna_Db with what you are showing, my question is… at either end of the gradient along the surface there is the opposite color and I’m wondering why that is. Most likely it has to do with the way colors are applied to a surface… From all my tests, no matter how the colors are applied this will happen, with the exception being that only one color is used instead of more than one.

@awilliams thanks for looking at the problem… I’m sorry if I wasn’t clear. There are no problems with the list structure, the issue I’m having is why the Display.BySurfaceColors node and how the colors are shown on the surface.

If you look again at the first image I posted. I was trying to explain that the point list and color list are the same structure and you can see that all the colors are in the correct locations along the surface. Below I highlighted where the transition from Red to Green is on both lists and that it compares to what is being shown in the geometry preview… So the list is correct… But what is shown in the geometry display has some kind of defect where the beginning and end are showing slight opposite colors, denoted in the red and blue circles.

I fixed up my graph to look like the one you have shown here, and even though you have changed the list and the color distribution from that list I don’t completely understand, if you zoom in close to the top and bottom edges of that surface you will get the same problem with their being slight gradients.

The unwanted gradient border effect tends to disappear when increasing the density of UVs but it takes also longer to compute:

1 Like

@Jason.Wheeler ohh I had thought you were wondering about both the list structure showing mixed colors within the sublist, and the odd gradient effect. I hadn’t zoomed in so much so the graph I set up had appeared to me to be a clean color distribution. My guess is that @Yna_Db’s suggestion makes the most sense, and that the slight gradients are due to a less dense UV distribution.

It looks like the color gradient is trying to wrap. This makes sense if you had a continuous surface but I’m not sure how you go about “fixing” it besides higher UV density, like @Yna_Db said.

1 Like

Maybe @Racel can shed some light on why the Display.BySurfaceColors node is acting this way, with the colors trying to wrap?

You can see with the default coloring that the color coordinates are “centered” unlike the UV coordinates that (most likely) go from parameter = 0 to parameter = 1 and hit the edges of the surface. So there is always a “border” area around the color coordinate that wraps or transitions to the adjacent color.
image