POV-Ray : Newsgroups : povray.binaries.images : 3D Text with Sphere_sweeps : 3D Text with Sphere_sweeps Server Time
20 Apr 2024 03:51:14 EDT (-0400)
  3D Text with Sphere_sweeps  
From: Dave Blandston
Date: 18 Jun 2022 05:05:00
Message: <web.62ad94fdac40b3a1cf03b124607c1b34@news.povray.org>
In case anyone is interested, here's an easy way to make 3D text using
sphere_sweeps. To get the data points, I made a bit-map image of the letter "L"
and drew several dots along the path of the character. It was a little tedious
to type the <x, y> coordinates of the dots. I suppose it's bad form to use the
third vector component for something unrelated to the first two but it's very
convenient.

In the example picture, the pink "L" in the upper left corner is the original.
The TrueType font is called "Pinyon Script." The blue "L" in the middle is the
sphere_sweep character. Using the orthographic camera causes spots to appear.
The sphere_sweep character is overlaid with the original in the upper right
corner. The bottom shows the sphere_sweep character with a normal camera.

This was a first attempt and I didn't put much effort into placing the dots
along the original letter but it turned out pretty well anyway. Adjusting the
diameter multipliers was pretty easy.

Have a great day everyone!

Kind regards,
Dave Blandston


The code is so short I'll just include it here:
-----------------------------------------------

#local NPoints = 32;

#local Coordinate = array [NPoints] { //<x, y, diameter multiplier>
   <516, 451, 1>,
   <513, 457, 1>,
   <475, 485, 1>,
   <422, 497, 1.8>,
   <360, 495, 1.8>,
   <264, 475, 1>,
   <175, 451, 2>,
   <93,  454, 2>,
   <75,  473, 1>,
   <94,  489, 1>,
   <194, 490, 1>,
   <277, 452, 2>,
   <390, 328, 4>,
   <532, 135, 1.5>,
   <579, 93,  1.5>,
   <631, 65,  1>,
   <678, 56,  1>,
   <719, 69,  2>,
   <728, 104, 2>,
   <683, 179, 2>,
   <596, 255, 1>,
   <500, 307, 1>,
   <415, 334, 1>,
   <329, 336, 1>,
   <260, 313, 2>,
   <228, 272, 2>,
   <223, 236, 3>,
   <234, 201, 2>,
   <261, 167, 1>,
   <300, 144, 1>,
   <339, 137, 1>,
   <349, 138, 1>
} //array

#local MinX = 9999;
#local MaxX = 0;
#local MinY = 9999;
#local MaxY = 0;

#for (I, 0, NPoints - 1)
   #if (Coordinate [I].x < MinX) #local MinX = Coordinate [I].x; #end
   #if (Coordinate [I].x > MaxX) #local MaxX = Coordinate [I].x; #end
   #if (Coordinate [I].y < MinY) #local MinY = Coordinate [I].y; #end
   #if (Coordinate [I].y > MaxY) #local MaxY = Coordinate [I].y; #end
#end //#for

#local MaxY = MaxY - MinY;

#local S = 1 / MaxY;

#for (I, 0, NPoints - 1)
   #local Coordinate [I] = Coordinate [I] - <MinX, MinY, 0>;
   #local Coordinate [I] = <Coordinate [I].x, MaxY - Coordinate [I].y,
Coordinate [I].z> * <S, S, 1>;
#end //#for

#local BaseRadius = .011;

#local ThreeDText = object {
   sphere_sweep {
      b_spline
      NPoints
      #for (I, 0, NPoints - 1)
         <Coordinate [I].x, Coordinate [I].y, 0>, BaseRadius * Coordinate [I].z
      #end //#for
   } //sphere_sweep
} //object


Post a reply to this message


Attachments:
Download 'test.jpg' (48 KB)

Preview of image 'test.jpg'
test.jpg


 

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