Jump to content

Why does a boolean intersection of a grid with metaballs give slices with color striations?


ianwww

Recommended Posts

I've scattered randomly sized and colored metaballs onto a grid (some of which merge), converted them to polygons and then boolean intersected them with the grid, to get colored slices as attached.  The slices have color striations (attached).

Does anyone know what's causing the striations and how to avoid or get rid of them so that I have flat colors?

Metaball_intersected_with_grid.PNG

Link to comment
Share on other sites

This looks like the boolean has tried to make the flat plane a watertight mesh, meaning it has a polygon on each side of the plane, but since the plane is infinitely thin these two sides are directly on top of each other and are z-fighting with each other. I think you can fix this by telling the boolean to treat your plane like a flat geometry instead of a solid geometry in the boolean node.

Link to comment
Share on other sites

Thanks for the suggestion but I don't think that's the cause.  I had already specified my grid as a surface (and the polygon as a solid).

I've attached a simpler version of the same issue - this time intersecting a single polysphere with a grid.  It seems that the striations come from the varying point density around the slice (first image).  If I make the point distribution uniform (with an edge equalize SOP), the striations become more uniform (second image) but they're still there.  So, the color of the slice is set by the color of the points (Cd point attribute) around its edge and I think Houdini interpolates color between points as a gradient.

I may be missing something really obvious but I can't work out how to overcome this.

Polysphere_intersected_with_grid.PNG

Polysphere_intersected_with_grid_then_points_uniformed.PNG

Link to comment
Share on other sites

If it's not the case that the polygon has become two-sided then the issue is most likely just that it is an n-gon. Only having points with normals along the edges means that their value will have to be used for the entire polygon surface, hence why when you equalize the points the lines become less sporadic/random and more ordered.
The only way to fix this I think is to give the mesh propper topology somehow, maybe via subdividing or triangulating the mesh in some way. Maybe forcing the normal direction to be the same could help some but in general, I'd recommend trying to fix the underlying problem of the n-gon.

Link to comment
Share on other sites

I've found a solution. 

My two part fix required 1) increasing the number of rows and columns in the intersecting grid, and 2) transferring the color attribute from the polygon to the intersecting grid.

Initially, my intersecting grid was only 2 rows by 2 columns (ie. 4 corner points).  In the polysphere example, this gave me the problem pattern (attachment 1).

By making the grid, say, 5 rows by 5 columns and then also doing an attribute transfer of the sphere's Cd to the intersecting grid I get the even color that I wanted (attachment 2).

(Just doing the attribute transfer onto the 2 x 2 grid wasn't enough.  The grid needed to be at least 3 x 3 for the fix to have effect.)

Thanks for your interest and advice!

Slice_for2x2_grid_no_Cd_transfer.PNG

Slice_for5x5_grid_with_Cd_transfer.PNG

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

The metaball not only interpolates the location of the centers of the points where you instantiate the metaball, but also the color of those points.
The documentation doesn't seem seem to mention it, but any attributes on points are also interpolated on the surface of the metaball. Documentation seems to be a bit dated though

Here are a few pictures to explain it better, and why it's not a bug, but a feature:

The spheres are just spheres copied to points with a Cd attribute

The metaballs are metaballs created from the same points. Notice how a single connected metaball captures several points of different color

Then you can see the cross section of said ( converted to polygon ) metaballs which now explains why there are several colors for each polygon. Each circle is in fact a n-gon with colors set a its points. At some point, the display driver (OpenGl) has to triangulate it because it  can only display triangles (citation needed...) Note than the triangulation is not exposed to you, in case you actually like the streak effect 

If you like the multicolored version but you want to have some control on it, you have to somehow do the triangulation yourself. For example, scatter some points in it, merge them with the n-gon, triangulate / Edges=* / Flood from CHB / then attribute Blur Cd is what I did.

EDIT (

There is another layer of color..

Boolean also somehow use the color information from BOTH inputs in the output.

I don't really understand how he's using the information on the surface (in the case solid INTER surface) to compute the color attribute on the output, but you can use this feature at your advantage by setting a color beforehand, otherwise it will set it to White for you inside the Boolean SOP. I think this tells the whole story.

Not sure what the use case would be for setting a color on inputs in Boolean, as it will be a mess anyway

 

 

cutter.png.3a7399e29c06c3970f401786da91b435.png

metaball.thumb.png.df2c6d1b65fd20b8f57fc472cc889dd6.png

 

Edited by AntoineSfx
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...