Volumetric Cloud Shader

This is a way i went on about creating a smoke/mist/cloud volumetric shader using a cube as a container (but i guess you can use anything!)

Also i used a lot of noise fuctions and commented the density hoping to open the door to experimentation! Have fun!


Here’s an example with a ghosts Post-Processing filter and some “cell” noise type instead of “uperlin”:


shader Cloud_Vol(
    output closure color CL = holdout()
){
    vector Loc = 0;
    getattribute("object:location",Loc);
    P *= (P*1.5/(dot((noise("uperlin",P*5.4,0.01)),(noise("uperlin",P*1.5,0.001))))+Loc);
    float Fact = 0;
    sqrt(sqrt(exp(dot(P*1.4,P*1.3*noise("uperlin",sin(noise("uperlin",P[0],0.01))*cos(noise("uperlin",P[1],0.8)),0.01))))) < dot(P,P)/2 ? 
    // Density
    Fact = 3
    //
    : Fact = 0;
    CL =  henyey_greenstein(0.4)*
    Fact*color(0.4,0.5,0.6)+emission()*
    0.01*(Fact*0.2)*(color(0.8,0.8,0.9))+emission()*(Fact*0.001);
    return;
}

That’s a nice one! Hope to see more volume osl shaders, there is a lot of potential. :slight_smile: