3
$\begingroup$

My problem arises when I attempt to use the raycast node on geometry created in the same node setup. enter image description here

I would expect the result to be effectively a hemisphere of instances on the top of the cube, although this does not work. Am I using the raycast node wrong, or is this a limitation of the node? enter image description here

Thank you!

$\endgroup$
2
  • 1
    $\begingroup$ You're projecting the geometry onto itself, so each vertex hits itself after moving a distance of exactly 0 unit. You can try to offset either the target geometry or the base geometry along the Z axis to get the effect you desire (I think ?) $\endgroup$
    – Gorgious
    Aug 13, 2022 at 15:39
  • $\begingroup$ If your question was solved, please be so kind and mark the answer that contributed to the solution as "Accepted Answer". This will make it easier for others to see which way leads to the solution, and the question will no longer appear as unsolved. Thank you! Here you can find more information: What should I do when someone answers my question?. If you still didn't get a solution to your question, please be kind enough to address it. $\endgroup$
    – quellenform
    Aug 20, 2022 at 0:29

2 Answers 2

5
$\begingroup$

@Gorgious is right.. add a tiny epsilon to the Source Position in the direction of the ray, and the ray won't hit the point it's fired from before hitting/missing anything else:

enter image description here

$\endgroup$
4
  • $\begingroup$ It's actually absurd that a raycast in a certain direction counts the own starting position as a hit, isn't it? However +1 $\endgroup$
    – quellenform
    Aug 13, 2022 at 16:51
  • $\begingroup$ Hi @quellenform ! I'm not sure it's as absurd as it looks? If casting a ray on to self then there has to be an epsilon somewhere. I'd rather decide what it should be, than have Blender give it a hidden value I know nothing about. And I agree, using ray-cast for this job is expensive and unreliable. I was thinking of saying so, too, but assumed OP was asking 'in abstract'. $\endgroup$
    – Robin Betts
    Aug 13, 2022 at 17:03
  • $\begingroup$ But a ray on itself would mean a length of zero. With this, Raycast is actually led ad absurdum. That's what I meant, that there should be an option to define an epsilon in advance, or a switch that ignores the own position. ...or once again I imagine it to be much too simple :D $\endgroup$
    – quellenform
    Aug 13, 2022 at 17:16
  • 1
    $\begingroup$ @quellenform OK, I see .. a 'Disallow 0 length ray' switch, or better and more general than that, a 'Min' as well as a 'Max' on ray-length. That would be useful, minimal, and clean, IMO. (BTW It's the same in OSL, and .bpy.).. It wouldn't get rid of the 'Source Positition', though.. you might want to sidestep and fire in another direction. $\endgroup$
    – Robin Betts
    Aug 13, 2022 at 17:37
2
$\begingroup$

@RobinBetts' answer is definitely the correct one, so his answer should be the "accepted answer" to your question, but your concern I would rather solve as follows:

enter image description here

Why?

Because Raycast doesn't always give reliable results. Try it out. Scale the UV sphere and see for yourself what happens.

$\endgroup$

You must log in to answer this question.

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