Using basic constants in cyles materials.

Hi folks. I just tried putting some mathematical formualae into cycles materials to draw some textures and noticed that there weren’t any basic constant values as options in the maths node. I tried using a value node and typing “e” into it to see what happened and was pleasantly suprised to find it converted it to 2.718 when I hit enter. Doing the same with “pi” gives 3.142. Is the rounding given in the value node just a display formatting thing and the actual constant is used behind the scenes, or is it actually rounding at that point?

If I scale and zoom on parts of textures that are composed from moderately large formulae that have had rounding applied at the point of a constant’s use, rather than at the end, I could end up with significant rounding errors.

Is the value shown in the value node (rounded to just 3 decimal places) purely a display thing? I’m having a bit of a tough time just getting my head around using these nodes to do maths as it is, I just want to know in advance if I’m going to spend ages building formulae, only to find it’s been mangled by lots of accumulated rounding errors.

IIRC, blender rounds to 7 decimal points (yet shows only 3 after the dot)

that’s the computer science stuff for you Floating-point arithmetic8 bit can only describe so much info
Blender does common single precision floating point calculus
for other heavier, specialized, expert tasks you need special tools as is ie. Mathematica

yup, it’s a fine line to find a balance between precision and accuracy

you might be able to increase precision after the dot if you change scale
but even with that might not improve the textures

for time being bl is limited to single precision
unless someone can come up with a double precision version!

but might work better of you use it in a python script with double precision
but when you pass it to bl API it will be converted to 7 digits only
so might not work

happy cl

Thanks guys. Just 3 decimal places seemed a bit tight but, if that’s just for display, it should be fine. I just wanted to be sure I had a good few orders of magnitude to play with before I tried figuring out how to translate formulae into epic piles of nodes. I just wanted a bit of extra prescision for making visual representations that I can scale up a few orders of mantiude before they start looking all squirrely.

Wait why don’t you try to use a mapping node to change texture scale !
it will re adjust what you see as texture too!

happy cl

Yeah, that’s what I intend to do, scale textures with the mapping node. That’s why I wanted to know if Blender just rounded the numbers off without a great deal of precision; the precision might be a close enough approximation at a 1:1 scale, but if I scale up the line of an equation, then any rounding errorr would be magnified by the same amout. That’s why I wanted to know if the precision was high enough so that I could scale by a few orders of magnitude and still be far enough from a scale where rounding errors would begin to show up in the display.

I guess that with equations it will use BL inside math which are limited to 7 digits

but I think this does not apply if you use proc texture
in case of image it becomes function of Image pixels and zoom or distance from camera

happy bl