Material compiling differently if put into a material function

I’ve run into an issue that I’m perplexed by - I’m trying to create a simple “range” material function, which works correctly when I use the math directly within my shader, but yeilds different and incorrect results when I extract it into a materialFunction node.

I’m not sure if I’m missing a setting somewhere, or if I’m making a really dumb mistake. (Or maybe this is just a bug). Either way, I’d greatly appreciate any assistance. :slight_smile:

In the three examples below - the first image, with the math in the material directly, is correct: the colors should very quickly clamp out at 1. The second, using the material function with the exact same math (3rd) is incorrect.

Thanks!

Hi Keith -

So I did double check this just to make sure and it is working correctly. Your Material Function from the picture above does not have your Multiply connected into your output. It looks like the Add goes to both the A slot of your Multiply and the Output node.

Let me know if that doesn’t correct the issue though and I will keep investigating.

Thank You

Eric Ketchum

Oh man, that was a total newb mistake… I guess it was a long night. Thanks so much for taking the time to answer!

By the way, since i can’t delete this thread from the archives, in case anyone runs across this, the above range function is totally wrong, so don’t try to use it.

Accept someones answer and it will no longer be in “unanswered questions” and keeps things clean.