| 
  | 
#include "colors.inc"
camera {
   location <0, -0, -30>
   direction <0, 0, 1.35>
   look_at <0, 0, 0>
} //camera
light_source {<0, 0, -20> color White * .6 shadowless}
light_source {<20, 20, -100> color White * 1.1 shadowless}
background {White}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * */
/* The following macro creates an object called "BORDER." The input
parameters are an object, the desired  */
/* border width, an accuracy setting which ranges from 90 (not very
accurate, but fast) to > 0 (more       */
/* accurate, but slower), and the desired border depth. Note that the
accuracy setting must be a factor of */
/* 360. The accuracy setting necessary for a smooth border depends mostly on
the size of the object and    */
/* the resolution you're rendering it at. For a large object rendered at
high resolution with a reflective */
/* texture, you will need to increase the accuracy setting. (Remember,
smaller values produce higher       */
/* accuracy.) However, values from 30 to 10 are usually acceptable.
*/
/*
*/
/* After using the macro, you will still need to assign a texture to the
"BORDER" object and union it with */
/* the original object.
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * */
#macro CreateBorder (Thing, Radius, DeltaTheta, Depth)
   #declare BORDER = object {
      union {
         #local Angle = 0;
         #while (Angle < 360)
            object {Thing translate <cos (radians (Angle)) * Radius, sin
(radians (Angle)) * Radius, 0>}
            #local Angle = Angle + DeltaTheta;
         #end //#while
      } //union
      translate Depth * z
   } //object
#end //macro CreateBorder
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * */
/* Example usage:
*/
/* Create on object, in this case called "Thing," call the "CreateBorder"
macro, union the original object */
/* with the new object that the macro created called "BORDER," and assign
textures to both objects.        */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * */
#local TextDepth = .4;
#local BorderWidth = .02;
#local BorderDepth = .12;
#local ThingColor = texture {pigment {color Red}}
#local BorderColor = texture {pigment {color Yellow}}
#local StepAngle = 12; //Controls how accurately borders are drawn.
                       //Use 90 for rough draft. Must be a factor of 360.
#local Thing = object {
   union {
      text {ttf "C:\Windows\Fonts\Times.ttf" "P" TextDepth - BorderDepth, 0}
      text {ttf "C:\Windows\Fonts\Times.ttf" "O" TextDepth - BorderDepth, 0
translate .59 * x}
      text {ttf "C:\Windows\Fonts\Times.ttf" "V" TextDepth - BorderDepth, 0
translate 1.2 * x}
   } //union
} //object
CreateBorder (Thing, BorderWidth, StepAngle, BorderDepth)
#local BorderedThing = object {
   union {
      object {BORDER texture {BorderColor}}
      object {Thing texture {ThingColor}}
   } //union
} //object
object {BorderedThing scale <8, 8, 1> translate <-7.3, -2, 0>}
 Post a reply to this message 
 | 
  |