Disable Layers of LayerRGBA Shader for Specific Objects in Scene

Disable Layers of LayerRGBA Shader for Specific Objects in Scene

brianswarthout
Contributor Contributor
505 Views
2 Replies
Message 1 of 3

Disable Layers of LayerRGBA Shader for Specific Objects in Scene

brianswarthout
Contributor
Contributor

Hello,

I'm working with a simple material of a dark rubber for buttons on a TV remote controller. Some of the buttons have colorful graphics on them while others do not. For the buttons with graphics, I've built a simple Standard Surface material whose base color is driven by a Layer RBGA shader.

The Layer RGBA shader has several layers, each with their own input color that comprise the various graphics on the buttons. These colorful layers are masked using B/W images of the appropriate graphics and feed into the Mix on each layer. This set up gives me the freedom to fine-tune the color of the various graphics as opposed to combing all the graphics into one texture, in which case I'd have tweak the colors in Photoshop or BodyPaint. I have all the buttons properly UV unwrapped and everything is working as intended.

The remote also has rubber buttons that do not have any graphics. These buttons with no graphics are a separate object in the scene and are not accounted for on the UV map of the buttons that have graphics. For these, I'd like to use the same rubber material but simply disable all of the Layers in the Layer RGBA shader except Layer 1.

Is this possible, or must I create 2 separate materials? One with a Layer RGBA shadger driving the base color and another without the Layer RGBA shader driving the base color?

Thanks,

- Brian

0 Likes
Accepted solutions (1)
506 Views
2 Replies
Replies (2)
Message 2 of 3

peter_horvath
Autodesk
Autodesk
Accepted solution

You can define an integer User Data on the objects which controls whether the layers are visible or not (called 'show_layers' in the example below). Then you can read it via a user_data_int shader connected to a switch_rgba shader. The switch selects the layers when the user data is set to 1, otherwise selects the shader connected to the first layer.

peter_horvath_0-1684253787609.png

 


// Peter Horvath
// C4DtoA developer
0 Likes
Message 3 of 3

brianswarthout
Contributor
Contributor

This worked perfectly! Can't thank you enough Peter!

0 Likes