Atom - 2012-06-16

Hi All,

I just noticed this and though I would report it.
Using Pixie 2.2.5 on Windows XP64 SP2.

I have added an attribute to my RIB so I can detect that attribute inside a shader.

        Attribute "identifier" "name" [ "vampire" ]

Now, in my shader, I can access the "name" attribute..

    //Expect an attribute.
    string  name;
    if(attribute("identifier:name", name) == 1)
        // Indicates that we have detected an expected attribute.
        if(name == "vampire"){
            //Alternate processing based upon attribute value.
            Oi = 0;
        } else {
            //Default processing.
            Oi = Os;

So if I name my object "vampire" it will disappear in the render because Oi is set to 0.0.

As long as the attribute exists in the RIB file, there is no problem. But if you remove the attribute from the RIB and run rndr on the RIB file it will crash. Because, rndr references an attribute, from the shader, that does not exist. This should not cause a crash. rndr should simply default the non-existent attribute to some void/null value that the shader can deal with.

If anyone has a solution to this, that can be implemented at the shader level, I would love to see it.

Is there a way, in a shader, to detect if an attribute exists before operating upon it?