For this experiment, I created a Open Shading Language shader with adjustable variables. In the video above are 3 different variations of my custom OSL shader applied to a basic 3D sphere. The look for this shader was inspired by the visual of an oily asphalt surface.
There are controls for specular roughness, color and saturation, displacement intensity, 4 different noise map controls, and animation speed controls.
Using these controls, you can achieve some pretty crazy and psychedelic looks! This shader will definitely come into use for some of my future projects.
The paint color underneath the noise map is a modified shader pulled from https://github.com/redshift3d/RedshiftOSLShaders/blob/main/PaintColors.osl
Here is the code for my OSL shader:
shader ball(
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,
//noise--------------------------
float noise_amp = 0.5 [[float min = 0, float max = 3]],
float noise_amp2 = 0.5 [[float min = 0, float max = 3]],
float noise_freq = 0.5 [[float min = 0, float max = 50]],
float noise_freq2 = 0.5 [[float min = 0, float max = 50]],
float roughValue = 0.5 [[float min = 0, float max = 5]],
float saturation = 0.5 [[float min = 0, float max = 5]],
float disp_amp = 0.5 [[float min = 0, float max = 5]],
int animSwitch = 0 [[string label="Anim OFF/ON",int min = 0, int max = 1]],
float speed = 0.5 [[string label="Anim Speed",float min = -1, float max = 1]],
output color diffColor = 0.5,
output color disp = 0.5,
output color rough = 0.5,
output color mixer = 0.5,
)
{
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*(time*(speed/10)*animSwitch);
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);
//noise--------------------
color noice1 = mix(1.0, noise("noise",(transform("object",P) * noise_freq)+(time*speed*animSwitch)), noise_amp);
color noice2 = mix(1.0, noise("snoise",(P * noise_freq2)+(time*speed*animSwitch)), noise_amp2);
diffColor = noice1[1]*noice2[0];
disp = (noice1[1]*noice2[0])*disp_amp;
rough = (roughValue-(noice1[1]*noice2[0]));
mixer = (mix(c,c,c)*diffColor*saturation);
}
The HDRI used for my render is pulled from PolyHaven:
https://polyhaven.com/a/studio_small_06
Comments