POV-Ray : Newsgroups : povray.text.scene-files : Rounded Font Edges Server Time
22 May 2024 23:02:37 EDT (-0400)
  Rounded Font Edges (Message 1 to 1 of 1)  
From: Dave Blandston
Subject: Rounded Font Edges
Date: 12 Apr 2010 20:25:00
Message: <web.4bc3b8be104cc192cba3fb0f0@news.povray.org>
#local UseRadiosity = 0;

global_settings {
   charset utf8
   assumed_gamma 2.2
   max_trace_level 20
   #if (UseRadiosity)
      radiosity {
         count 300
         error_bound .02
         pretrace_start .08
         pretrace_end .004
         recursion_limit 1
         normal on
      } //radiosity
   #end //#if
} //global_settings

#include "colors.inc"

camera {
   location <0, 0, -1>
   direction <0, 0, 4/3>
   rotate -60 * x
   look_at <0, 0, 0>
} //camera

#if (UseRadiosity)
   #local Dome = object {
      difference {
         sphere {0, 20001}
         sphere {0, 20000}
      } //difference
      texture {
         pigment {
            gradient z
            color_map {
               [0, 1 color White * 2.1 color White * .8]
            } //color_map
         } //pigment
         finish {ambient 1 diffuse 0}
         scale <1, 1, 20000>
      } //texture
      no_reflection
   } //object
   object {Dome}
#else
   light_source {<15, -80, -200> color White * 1.6}
#end //#if

#local FontColor = texture {pigment {color rgb <.95, 1, .95> * .8}};

#macro Border (ObjectToBorder, Radius, DeltaTheta)

   #declare BorderedObject = object {
      union {
         #local Theta = 0;
         #while (Theta < 360)
            object {ObjectToBorder translate <cos (radians (Theta)) * Radius,
sin (radians (Theta)) * Radius, 0>}
            #local Theta = Theta + DeltaTheta;
         #end //#while
      } //union
   } //object

#end //macro Border

#macro RoundEdges (ObjectToRound, BevelRadius, DeltaTheta, NLayers)

   #declare RoundedObject = object {
      union {
         #local I = 1;
         #while (I < NLayers)
            #local PercentDone = I / (NLayers - 1);
            #local CurrentAngle = PercentDone * 90;
            #local CurrentBorderWidth = BevelRadius * cos (radians (90 +
CurrentAngle));
            #local CurrentBorderDepth = BevelRadius * cos (radians (180 -
CurrentAngle));
            Border (ObjectToRound, CurrentBorderWidth, DeltaTheta)
            object {BorderedObject translate CurrentBorderDepth * z}
            #local I = I + 1;
         #end //#while
      } //union
   } //object

   #declare RoundedObject = object {
      union {
         object {SquareFont translate -BevelRadius * z}
         object {RoundedObject}
      } //union
      translate BevelRadius * z
   } //object

#end //macro RoundEdges

#local TextDepth = .1;
#local BevelRadius = .03;
#local DeltaTheta = 5;
#local NLayers = 6;

#debug concat ("\nTotal objects: ", str (360 / DeltaTheta * (NLayers - 1) + 1,
0, 0), "\n\n")

#local SquareFont = object {text {ttf "Times.ttf" "X" TextDepth - BevelRadius,
0}}

RoundEdges (SquareFont, BevelRadius, DeltaTheta, NLayers)

object {RoundedObject translate -.35 * x texture {FontColor}}

plane {z, TextDepth + .05 inverse texture {pigment {color White}}}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.