I'm doing some materials work right now using Open Shading Language (OSL), and it has a convenient function, isinf()
, which will determine whether a floating-point is infinite or not...
However, I can't find anything in the documentation about actually setting a variable to infinite. I'm instead going to be setting it to "irrationally large", which will certainly work well enough for my purposes (effectively cell noise generation), but I'm curious whether there's a built-in way to express infinity in OSL?
CodePudding user response:
The problem is that OSL tries very very hard not to let you generate non-finite numbers, and there is no call to intentionally give you an infinity value. You could use what would in C be FLT_MAX: 3.402823466 38