getattribute blender vs redshift

It seems like Redshift does not support OSL's getattribute() yet...and Blender's alembic importer is either not able to bring in my custom attributes, or is just ignoring them (you have to use the setattribtypeinfo function to force it to read attribs as colours still).

As a result it is best practice to provide inputs to your OSL shaders to receive color or other attribs baked into your points.


eg

shader attributeFetch(color custom=color(0),output color col=0)

{

col=custom;

}


I had previously planned on using getattribute within the actual shader to access point attributes, but quickly encountered the "not supported" error message with Redshift :)

On an interesting note Blender seems to make the getattribute function work! Could be a GPU vs CPU thing (Blender's OSL support is limited to Cycles -CPU)

so this code should work -  

shader attributeFetch(string name="floater",color custom=color(0),output color col=0)

{

color temp;

if(getattribute(name,temp)){

col=temp;

}

else{

col=custom;

}

}

Comments

Popular posts from this blog

kodelife/glsl drawing a circle (sdf)

OSL - simple UV things and frac fract alternative

step and smoothstep functions, drawing a line