surface ho_tx3d( string tx3d = ""; string tx3d_temp = ""; float Kd = 0.8, Ko = 1,tempMult = 0.1; color red = color(1,0.5,0), dark = color(0.2,0.2,0.2), surfColor = color(1,1,1) ){ normal n = normalize(N); normal nf = faceforward(n, I); color diffusecolor = Kd * diffuse(nf); normal n0 = normal(0,0,0); float density = 1; float success = texture3d(tx3d,P,n0,"smoke",density); density = clamp(density,0,1); float temp = 1; success = texture3d(tx3d_temp,P,n0,"temp",temp); color fire = mix(dark,red,temp*tempMult*0.001); Oi = density * Ko; Ci = Oi * diffusecolor*surfColor*fire; }