3
$\begingroup$

I'm attempting to remove the points which are in front of instanced planes of various sizes:

enter image description here

enter image description here

That way, the remaining points can be used for instances that won't overlap:

enter image description here

The task is almost solved with this setup:

enter image description here

However, I don't think I'm using the raycast node properly. I tried intuitively scaling the target geometry by 0.001 along the faces' normals, but that netted an incorrect selection. Just by happenstance, I tried the position, and that got close (the result pictured above), but if I reverse the selection for clarity it is easy to see that this setup isn't correct either as it includes points not in front of faces in the selection:

enter image description here

I've tried the following prior advice to no avail:

Raycast on Geometry generated by Geo Nodes?

Geo Nodes - Raycast from individual Mesh islands

Mask grid on rounded corners

Blender Geometry Nodes - Create individual XYZ curve/mesh lines per edge-defined cubic area

I hope this question is unique enough to be worth posting, but I'll let those with more insight than myself decide. Either way, an answer or even a hint in the right direction would be much appreciated.

$\endgroup$
0

2 Answers 2

4
$\begingroup$

Explanation

The reason why it wasn't working for you is because you are actually raycasting from the points to the faces. This is how the raycast node works. therefore, the source position, ray direction, and ray length are sampled from the points geometry, which don't have a normal.

Answer

In your case there is an easy fix. All you have to do is capture (or store) the face normal in the beginning of your tree (alternatively, you could transfer it).

enter image description here

and use that data to offset the source position and set the ray direction.

enter image description here (over here i inset the points and keep the ray direction going outward because it's less nodes)

You get a result like this.

enter image description here

If you want the file, let me know.

$\endgroup$
2
  • $\begingroup$ I think I understand- by using the prior base geometry for the ray direction data, ALL points are able to cast a ray that can then be detected as hit or missed, while with my setup using just the planes for the ray direction, not all points were able to cast rays and be assesed as hit/miss. Thank you very much for the explanation and helping my understanding. $\endgroup$ Commented May 29, 2023 at 14:33
  • 1
    $\begingroup$ @bobhasajetpack basicly when you used the normal as the direction, you actually were using vector[0,0,0] as the direction - because the attribute didn't exist . - and with the position the direction was the position, which is just facing away from the origin. $\endgroup$
    – shmuel
    Commented May 29, 2023 at 20:47
3
$\begingroup$

Don't use raycasting, just check the distance to the nearest face:

$\endgroup$
4
  • $\begingroup$ Thank you very much for showing what, in this use case, is definitely the most efficient solution. $\endgroup$ Commented May 29, 2023 at 14:40
  • $\begingroup$ @bobhasajetpack Just a stupid question: Why don't you mark this answer as "Accepted Answer" if it solves the question better? It's not about who answered first, but which answer solves the task best/efficiently. ...just as a hint. (But you are right: Regarding the title of your question, the other answer is more correct) $\endgroup$
    – quellenform
    Commented May 29, 2023 at 15:11
  • $\begingroup$ @quellenform The only reason I marked the other as correct was in the hopes that, as you mentioned, anyone searching for a similar raycast problem (where Markus von Broady's answer might not be as ideal) will have the raycast-focused answer right away. If this isn't very likely in your opinion, I can change the "accepted answer." $\endgroup$ Commented May 29, 2023 at 15:34
  • $\begingroup$ @bobhasajetpack All right, thanks for the clarification! $\endgroup$
    – quellenform
    Commented May 29, 2023 at 15:41

You must log in to answer this question.

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