1
$\begingroup$

What I have here is a cube that I've subdivided and turned it into a sphere. I then distributed points over it to get a distance attribute that I'm sending over to a material. The problem I have is that you can see every polygon from the target mesh. enter image description here

Unless I heavily subdivide the mesh, which I'd rather not do. And even then, you still get visible polygons, just smaller. So, is there a way to smooth this out so I'd get perfect circles?

$\endgroup$
2
  • 1
    $\begingroup$ Hello ! You have to understand that Geometry Nodes is called that way because it operates on the geometry elements of your meshes, so it can only hold as much information as there are parts in your mesh. You can't add information between two vertices, because there is nowhere to store the information. Your two solutions are to heavily subidivide the mesh or use a shader-based solution and bake the effect to a texture map, which can interpolate data between the vertices thanks to UV mapping $\endgroup$
    – Gorgious
    Commented Mar 14, 2023 at 7:40
  • $\begingroup$ You can also use a heavily subdivided mesh, bake the texture map, and then use a less dense mesh with the baked texture $\endgroup$
    – Gorgious
    Commented Mar 14, 2023 at 7:47

1 Answer 1

0
$\begingroup$

Similarly to this thread:

Procedural Border Detection on a Flat Object

You could capture the distance to the nearest point, and calculate the distance to it on the shader:

The artifacts are caused by situations, where the nearest point of the center of the face is a different point than the nearest point to some point of that face:

$\bbox[#000000, 7px]{\color{#f0ff00}{\mathtt{⏺}}}$ yellow dot - the center of the face.

$\bbox[#000000, 7px]{\color{#ffa200}{\mathtt{→}}}$ orange arrow - the nearest point to the center of the face; its position is stored on a face and used in the shader.

$\bbox[#000000, 7px]{\color{#ea00ff}{\mathtt{⏺}}}$ fuchsia dot - example of an evaluated point in a shader.

$\bbox[#000000, 7px]{\color{#ff0000}{\mathtt{→}}}$ red arrow - distance between fuchsia dot and the tip of the orange arrow - that's what calculated inside the shader.

$\bbox[#000000, 7px]{\color{#2aff00}{\tiny{-->}}}$ green dashed arrow - the actual distance you want, but how do you capture this other point? In the link above my approach is to capture not one nearest point of the face, but 3 points, each nearest for one vertex of a triangle (but I still store it on a face so it's not interpolated between points by the shader). You could of course store more more, but at some point you have to consider if subdividing instead isn't cheaper on the resources.

$\endgroup$
2
  • $\begingroup$ There's also a Voronoi alternative, but that will generate some points away from the sphere's surface, and cause stretching and seams in 2D mode using UV map. $\endgroup$ Commented Mar 14, 2023 at 11:51
  • 1
    $\begingroup$ I've actually used the Voronoi method for a different project in the past. And I remember having to mix and mask a bunch of Voronoi textures, in order avoid stretching on different parts of the mesh. Which is why I wanted to try a different approach. And your answer is exactly what I was looking for! Thank you very much! $\endgroup$
    – RepliMark
    Commented Mar 14, 2023 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .