POV-Ray : Newsgroups : povray.newusers : text on a cylinder : Re: text on a cylinder Server Time
31 Jul 2024 12:22:30 EDT (-0400)
  Re: text on a cylinder  
From: Tom Melly
Date: 4 Nov 2002 11:12:27
Message: <3dc69c6b$1@news.povray.org>
"J Tellings" <j_t### [at] hotmailcom> wrote in message
news:3dc68eea$1@news.povray.org...
>
> I can get flat text on a cylinder with object pattern, but I can't do it
> with 3D-text. I am a beginner, and this is my first image, so can anyone
> give more info please.
> THanks!

You could try something like:

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <0.0, 0.5, -4.0>
  look_at   <0.0, 0.0,  0.0>
}


light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------
#macro RotText(Letter, RotY)
  text {
    ttf
    "arial.ttf",
    Letter,
    2,
    0
    pigment{Yellow}
    scale 0.25
    translate z*-1.1
    rotate y*RotY
  }
#end

cylinder { <0, -1, 0>, <0, 1, 0>, 1 pigment{Red}}

intersection{
  union{
    RotText("A",40)
    RotText("B",30)
    RotText("C",20)
    RotText("D",10)
    RotText("E",0)
    RotText("F",-10)
    RotText("G",-20)
    RotText("H",-30)
    RotText("I",-40)
  }
  cylinder{<0,-1,0>,<0,1,0>,1.05}
  pigment{Yellow}
}

The intersection is to give the front of the letters a curve to match the
cylinder. The main drawback of this approach is that the letters themselves
aren't curved. You would only really notice this problem if you were using
relatively large letters.

BTW - keep checking back, I'm sure this method is pretty crappy, but there's
nothing like someone posting a crap way of doing something to provoke some
decent suggestions ;)

Apart from anything else, the macro could be better, in that it should allow you
to input a whole string, rather than having to call it one time for each letter,
but at least this version is easily comprehensible (I hope).


Post a reply to this message

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