Packing inputs value into MF and unpack it in output

Hi,

I hope the subject is correct related to my problem.
Let me explain what I’ve got right now.
I’ve got a Material function and I need used it 4 times in my scene. Let’s say I’ve got one input parameter call “Speed” which is different for each. I don’t want duplicate MF 4 times and setup speed for each by using float. What I want to do is:

  • Setup a 4Vector parameter with all speed value what I want.
  • Add this node to my MF as an input
  • Receive different speed at output in separate channels (RGBA)

I hope I explain this in right way. Thank you for any help.

What is the internal logic of the material function?
Just use a vec4 as the input of the material function in that case, then spit it into it’s components.
Do the calculations on the parts and make a float4 output.

Then you can use it like this


or pass in a make float 4 param to the input.

Thank you for your answer.
This is what I try at first but the problem is inside my material function I’m using custom code. The speed material looks like this

Input * time - this is connected to custom node as a “speed”
Bunch of code
Output

I’ve got few inputs and the code which calculate all of them and send one output.
My problem is how can I take values from all the input just from R channel but output result in 4 channels (RGBA), next I would like to take just a G channel and output different values to RGBA, etc…

Just add more output nodes in the material function

And the implementation with breaks:

Sorry for delay respond.

I’m marking this as a solution because this should worked in most of the problems like that. In my case I have add one more step: changed a some part of code to read parameters from separate channels, before code was reading just from scalar value and do it once.
Thanks for helping me!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.