Hi Everyone,
Not 100% sure if this is the right category, but I wanted to share something I put together a little while ago for graphing math functions in Blender because sometimes it can be handy to actually visualise the transfer function of a shader node instead of its material output
This is so cool! And so badly needed, honestly. I frequently end up checking my shader math visually in wolfram alpha, I am delighted that you’ve made a solution directly in Blender
Thanks, it originally started as a way to try and debug my attempt at making a more procedural version of the colour ramp (which is now a part of this shader so…).
There’s a lot of neat stuff that can be done with shaders, but it often needs complex math and trying to debug it sometimes is… well, hard.
I did briefly think about how to do 3D graphs, but quickly realised that’d have broken my brain trying to work out how to draw the axis grid lines (which are like 95% of the node setup)
While viewing equations is probably out, a numeric output is probably doable, you’d really just need a texture of the digits 0-9 where adding a rounded/truncated 0-9 offsets which part of the UV shows up on a face, then just repeat the tile with 1/10, 1/100, 1/1000 etc. multipliers.
Comma/period placement there would actually be pretty simple. With a few greater than nodes, you could pretty easily figure out the order of magnitude. You’d be bound to a upper limit and lower limit, although when each step of a limit is an order or magnitude, you have a lot of room. You could get from .0001 to 1000 with 9? Greater than nodes, etc
it’d be using the compare node like “if input between 1x and 10x put comma/decimal point here” and have one of those groups for each power of 10. Catch is, while this shouldn’t be too complex with a fixed decimal point, to get a floating decimal point could become quite complicated.
Could probably have a fixed number of digits, fixed decimal point and an adjustable exponent though, e.g. “0.985x10^7” (use x/10^round(log(x)) to normalise x to between 0 and 1), I mean, does anyone really need 28 significant digits on a shader?. If I remember, I’ll try and have a play after work today
Yes,maybe its better to first find the decimal point,and then if you have the position the calculation its mabye easyer vs the opposite order.Not sure tbh.
Maybe not,as said it would be very handy to have a number viewer to check the values of a equation of a shader,or a quick look what the output of a color channel or vector ect is.Even more if you know you have a equation with a expected output,and you could read out the output would be very helpfull.
here i found this video today,it shows how to make procedural digital numbers.unfortunately it shows only one char at the time without decimal point logic,however the clever use of the coloramp is worth to watch.
edit,i wonder if maybe geometry nodes can help with new options?
Displays 5 significant figured in fixed-point scientific notation. Numbers between 0.0000000000001 and 999990000.0 are supported. Supports a “spinning ticker wheel” style display option as well (although gets a bit jumpy when rolling over from 9 to 0). each digit is modular and so more significant digits can be added after the decimal place or to the exponent if needed.
Math Graph V2.blend (157.7 KB)
(note if the last digit seems off by 1 count, I think it’s to do with floating point rounding errors inside Blender, numbers with power of 2 fractions don’t get rounded)
Wow you did it!
Thanks man.Looks great ,works great.
would it be possible to shift the decimal point,based on the exponent?ofc then you dont have to show the 10xexp.
I guess it would be more complicated the smaller/greater the number gets if more 0s should be displayed
And maybe the plane should be scale down to the top and down height of the numbers,now its 2 m .
edit,i scaled it down to this.Makes only sence if you use the numbers only.for the graph you need ofc the larger plane.you could duplicate the material to have both a small plane number material,and the original graph plane.
This is some extremely usefull thing.
I also if i remember well, put this nodes on blenderkit. Something like math plotter… i don’t really remember.
yours is great @ajmorgan !
I bookmark it !
(the follow rgb colors seems correct to,given the explanation at the end,in short
Those weights are typically represented as 0.2126R + 0.7152G + 0.0722*B )
rgb blue 0,0,1 only
green 0,1,0
red 1,0,0
interesting that your meter reads the internal linear light strength not the sRGB view,but since this is shader based it makes sence.
~I know the calc gets the average strength~,but why is the red that different?
rendered with 3.2.0 alpha
with 3.3.0 i get only violet objects with Eevee. Cycles works though.
edit i connected the rgb to bw direct to the shader output,they a different weighted.