Pyramid Volumetric Shader

Hi all!

Ok, so i’m starting a bit on rendering geometric forms using the OSL volume shader, all pyramids in the picture are actually contained within cubes that act as sort of a domain. I also posted the code below. Have fun!


shader Pyr(
float Transp = 1,
color CLI = color(1,0,0),
output closure color CL = holdout()
){
vector Loc = vector(0,0,0);
getattribute(“object:location”,Loc);
float Pyramid = sqrt(surfacearea()0.01
/(((Loc[2]-P[2])
(30/surfacearea()))
-distance(Loc[1],P[1])
-distance(Loc[0],P[0])))+sin(0.5)0.001;
Pyramid = sqrt(pow(Pyramid,2));
color Final = pow(0.3
pow(0.5
atan(Pyramid/0.1)CLI2,3),10)Transp;
Final += sqrt(sin(Pyramid
2-(CLI0.01)));
CL = emission()
(Final);
return;
}