Node-Material creating a Switch for different Outputs

Hello Guys,

This is my first post on this great forum, which I have used several times in the past. You guys are awesome and I really hope my beginner questions don’t bother you too much.

I took my first steps with the Node material and I’m surprised at how intuitive everything has been so far. I am also more than satisfied with the output and am now failing to create a switch in the node output that is supposed to regulate whether PBRMetallicRoughness 1, 2 or 3 should lead to the FragmentOutput.

So I have 3 different outputs that I want to control with one switch.

Can you give me helpful tips? I despair of my attempts with the step node or the logic nodes

I am grateful for all suggestions.

This Segment looks like this - Right now i am switching the Output manually by dragging&drop the lighting RGB Output into the Fragment Output from this different Output-Options:

Hi and welcome.

You could utilize lerp block for conditional statements

Note how if isBlue is true (float block that acts as boolean), the color is blue. If not, check if isGreen, if not, it is red.

Thank you Nogalo for your quick response.
I just tried it and with Color, it works great and i will keep it in mind.

However, the rest of my Texture is pretty complex and it does not give me the results as expected. (It is only changing the Colors RGB)

Here is what i did with your approach. What am i doing wrong?

Thank you!

Does anyone have a suggestion as to how a switch like this could be created?

Thank you!

You can’t use several PBRMetallicRoughness blocks in the same material (I don’t know how you ended up with multiple blocks, as when you try to add a new one, you get an error message if a block already exists?).

You should instead switch the inputs of the block to achieve different outputs, or create different materials.

You can use the blocks from the “Logical” section to implement a switch based on some comparison:



Hi, Thank you for making that clear!

I had no problems copying the PBRMetallicRoughness Blocks without getting an error tho. I can´t use them all at once, but that has never been the purpose and i was able to achieve what i wanted to by manually connecting them depending on the desired output. I’m just looking for a more elegant way to connect the blocks one after the other rather than having to link them manually over and over again.

With my limited knowledge, I initially didn’t have a better approach; there are certainly many ways to solve the problem better.

The reason you have no error is because you are connecting only one PBRMetallicRoughness Block at the time to the Fragment Output.

Thing is, through the system of switches you want to implement, you would eventually need to connect all of these into some logic and at that point you would encounter the error referenced here (I tried to test out your approach and this is exactly the issue I’ve encountered :D)

As Evgeni_Popov mentioned, you need to move this switch logic before the PBRMetallicRoughness block, and end goal is to construct only ONE PBRMetallicRoughness material.

1 Like

Understood. Got it. I will then organize it differently using one PBRMetallicRoughness Block. Thank you guys! Helped me a lot! :saluting_face: