#version 3.8; global_settings {assumed_gamma 1.0} #declare CameraLocation = <-50, 10, -40>; #declare CameraLookAt = <0, 0, 0>; camera { location CameraLocation right x*image_width/image_height up y look_at CameraLookAt } light_source {<50, 50, -100> rgb 1} sky_sphere {pigment {rgb <0.3, 0.3, 0.75>}} #macro Axes (Extent, Linewidth, BothSigns) sphere {0, Linewidth*2 texture {pigment {rgb 1} finish {emission 1}}} #local Cardinal = array [3] {x, y, z} #for (A, 0, 2) cylinder {-Cardinal[A]*Extent*BothSigns, Cardinal[A]*Extent Linewidth texture {pigment {rgb Cardinal[A]} finish {emission 1}} } #end #end // end macro Axes Axes (100, 0.125, no) #macro FaceCamera (Object, CL) #local Min = min_extent (Object); #local Max = max_extent (Object); #local OL = Min + (Max-Min)/2; #declare CamL = CameraLocation; // wherever you're putting it //#declare CamD = vnormalize(CameraLookAt-CamL); // direction of camera view #declare CamD = vnormalize(OL-CamL); // direction of camera view #declare CamR = vnormalize(vcross(y,CamD)); // to the right #declare CamU = vnormalize(vcross(CamD,CamR)); // camera up #declare Object_Transform = transform { matrix < CamR.x, CamR.y, CamR.z, CamU.x, CamU.y, CamU.z, CamD.x, CamD.y, CamD.z, 0, 0, 0 > } object { Object transform {Object_Transform} } #end // end macro FaceCamera #declare MyObject = text { ttf "arial.ttf", "Text always faces the camera.", 0.05, 0.0 texture {pigment {rgb z}} scale 1 translate y*5 translate x*3 translate <0, 0, -20> } FaceCamera (MyObject, CameraLocation)