Controlling OSL shader colors
Posted: Wed Nov 05, 2025 1:30 pm
Hello ! I'm trying to find a way to control the colors of the "PaintColors" OSL shader, but so far everything i tried didnt work out.
What i'm trying to do is to remove some of the colors, only to keep blue/pink hues; is that possible or do i have to find a workaround in post ?
So far I tried to remove the colors I dont want by driving the OSL shader into an octane gradient, but it doesnt give any good result as it usually make the gradient less "smooth"
Thanks in advance !
What i'm trying to do is to remove some of the colors, only to keep blue/pink hues; is that possible or do i have to find a workaround in post ?
So far I tried to remove the colors I dont want by driving the OSL shader into an octane gradient, but it doesnt give any good result as it usually make the gradient less "smooth"
Thanks in advance !
Code: Select all
//reference: http://glslsandbox.com/e#43216.0
shader paintColors(
float tm=0[[float min=0, float max=100]],
float offX=0.175[[float min=0, float max=0.5]],
float offY=0.275[[float min=0, float max=0.5]],
float offZ=0.25[[float min=0, float max=0.5]],
output color c = 0)
{
int complexity = 47; // More points of color.
float fluid_speed = 108.0; // Drives speed, higher number will make it slower.
float clrInt = 0.8;
vector p=vector(u,v,0);
p=P;
for(int i=1;i<complexity;i++)
{
vector newp = p + tm*0.001;
float s=i;
newp[0]+=0.6/s*sin(s*p[2]+tm/fluid_speed+0.3*s) + offX; // + mouse[1]/mouse_factor+mouse_offset;
newp[1]+=0.6/s*sin(s*p[0]+tm/fluid_speed+0.3*(i+10)) - offY; // - mouse[0]/mouse_factor+mouse_offset;
newp[2]+=0.6/s*sin(s*p[1]+tm/fluid_speed+0.3*s) + offZ;
p=newp;
}
c=vector(clrInt*sin(3.0*p[0])+clrInt, clrInt*sin(3.0*p[1])+clrInt, clrInt*sin(p[0]+p[2])+clrInt);
}