5
$\begingroup$

For some reasons Blender doesn't provide the Greater Equal operation in the math node even though it is in the soure code, but whatever.

I need a very computationally cheap and compact implementation of the Greater Equal operation using math node.

Any ideas?

$\endgroup$
2
  • $\begingroup$ Look at the dropdown on the Compare node! $\endgroup$
    – John Eason
    Jul 2, 2022 at 23:32
  • $\begingroup$ I don't know if that could work for you (still an beginner), but you could use the compare node to get a boolean output of if its greater and equal ... . $\endgroup$
    – Flint
    Mar 18 at 22:35

1 Answer 1

8
$\begingroup$

On the whole, in floating-point world, 'equals' makes sense only for what you know to be representations of integer values with good clearance. In that case, you can subtract a margin from the threshold.

(>= 4 == >3).

With that reservation, you could use 'not less than':

enter image description here

But beware of the concept of 'equals' in floating-point math. Your 3 is probably 2.9999998.

Thanks to @KRyan for a link to a fuller discussion of floating-point comparison, (less flippant than mine) :) .

$\endgroup$
2
  • $\begingroup$ While I full-well know what you mean, being a programmer, this answer could probably use at least a little bit of explanation about what the issue is with “floating-point”—a term many non-programmers are unlikely to have heard. (I don’t know Blender and don’t know how much its users are necessarily likely to have been exposed to it.) It’s also worth pointing out that an ε of 1.000 is rather large in most cases and that this is mostly for illustrative purposes. This Stack Overflow answer seems like a decent thing to link to. $\endgroup$
    – KRyan
    Jul 3, 2022 at 17:08
  • $\begingroup$ Hi @KRyan ! Fair comment. I was thinking of the customary use of 'equals' in procedural shaders.. i.e between integers. I couldn't think of other examples where ε was not used explicitly, as a range. But there must be some. Thanks for the link! I'll cut it in. $\endgroup$
    – Robin Betts
    Jul 3, 2022 at 17:18

You must log in to answer this question.

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