5
$\begingroup$

For some reasons Blender doens'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$
1
  • $\begingroup$ Look at the dropdown on the Compare node! $\endgroup$
    – John Eason
    Jul 2 at 23:32

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 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$ Jul 3 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.