Creating a custom Shader Mixer brick?

Age of ArmourAge of Armour Posts: 426

Lately I have been finding the need for a few more bits of code than Shader Mixer provides. I've managed to make a few macros with Shader Builder or edit some in notepad++ to do what I want.

There is one very simple function I can't seem to get to work as a macro in Shader Mixer.

%1% is the string input node of the macro

float isMap = 0;
if (%1% != "") { isMap = 1; }

then have the output result isMap 0 or 1.

This is so I can turn off displacement in Shader Mixer when no displacement map is loaded. Plugging an image string brick into %1% works for other macros.

What has me confused is that if I do something similar in a .sl it works in 3delight or if I do it in Shader Builder it works. If I export the macro from Shader Builder I get no if function, only an in and an out. I guess I need to manually edit the line in the macro but nothing I put in there seems to work.

Sorry this is so remedial but I only speak a few coding languages and am an novice or VERY rusty with all of them. I'm getting a handle on RSL but getting it into DS is confusing the hell out of me hehe.

Is there an easier or better way of making Shader Mixer bricks than Shader builder Macros?

Comments

  • mjc1016mjc1016 Posts: 7,226
    edited December 1969

    Is there an easier or better way of making Shader Mixer bricks than Shader builder Macros?

    I was wondering the same thing...

  • yxk03yxk03 Posts: 12
    edited December 1969

    Hi, I don't know if it helps but I think functions are easier than macros. There's just one pane of code in the shader builder, and it usually needs to contain just one C-like function, which makes it easier for me to to see how things go together and probably also means there's less that can go wrong. There's no line, the function just returns what you tell it to.

Sign In or Register to comment.
Rocket Fuel