Redshift Material: Compare UserDataString input

   200   2   0
User Avatar
Member
52 posts
Joined: Feb. 2016
Online
Hello,

Im trying to make a Redshift material which checks string user data against a string parameter and outputs R/G/B based on that.

The idea is that i have various geometry in my scene with point name attributes on everything, id like to set up some AOVs for specifically named points / lines / surfaces in different sop nodes.

Based on research ive found, the only way to process string attributes is with an OSL shader? I havent programmed an osl shader before, i tried to build this based on some examples, it compiles, but then it crashes houdini when I hit render.

shader stringCheck
[[ string help = "attrib string compare to RGB",
   string category = "string" ]]
(
    string  inStringA = ""
        [[  string label="AttribA" ]],
    string  inStringACompare = ""
        [[  string label="AttribACompare" ]],          

    string  inStringB = ""
        [[  string label="AttribB" ]],
    string  inStringBCompare = ""
        [[  string label="AttribBCompare" ]], 

    string  inStringC = ""
        [[  string label="AttribB" ]],
    string  inStringCCompare = ""
        [[  string label="AttribCCompare" ]],           


    output color outColor = 1
            [[  string label = "Out Color"]]
)

{
    float R = inStringA==inStringACompare;
    float G = inStringB==inStringBCompare;
    float B = inStringC==inStringCCompare;
    outColor = color(R,G,B);
}
User Avatar
Staff
1471 posts
Joined: July 2005
Offline
MaterialX does not allow run-time processing of strings. VEX does, so it should work for Karma. But Karma and Houdini Vulcan don't support OSL, so if you try rendering with them, it may not work. Though it should not crash.

But since you are using Redshift, you can try posting that question there (Redshift forum) as well. It maybe Redshift that carashes.
User Avatar
Member
52 posts
Joined: Feb. 2016
Online
rafal
MaterialX does not allow run-time processing of strings. VEX does, so it should work for Karma. But Karma and Houdini Vulcan don't support OSL, so if you try rendering with them, it may not work. Though it should not crash.

But since you are using Redshift, you can try posting that question there (Redshift forum) as well. It maybe Redshift that carashes.

Thanks, Im not using karma or materialX, its just redshift material and a redshift rop in a ropnet, i should point also im using old versions everything at this studio, houdini 19.5.403
I will check on redshift forum, thank you
  • Quick Links