POV-Ray : Newsgroups : povray.newusers : Simple 2D text, take 2 : Simple 2D text, take 2 Server Time
28 Jul 2024 18:16:05 EDT (-0400)
  Simple 2D text, take 2  
From: Leef me
Date: 26 Oct 2007 03:15:01
Message: <web.4721939cca8d169b892adb1d0@news.povray.org>
Hi gang, I'm working to understand 2d text mapping onto a surface. I believe
the term is UV mapping.

Anyway, In a different thread in P.n-u called "Simple 2D text on a
cylinder's surface "
 I asked about mapping, and Samuel B gave a nice example that I have been
playing with.
When I have a problem understanding how to apply the text, I go back to a
flat object.

Well, I'm stumped, so below is my code. Both the mesh and the disc have the
same exact material.
The non-text part of the pattern -background- shows up the same on both
objects.
And they have (I think) the same location.

But, the disc gets the 2d text map, the mesh doesn't.

WHy?


I included a rotation of the camera and use +kff20 so I can see the scene
revolve.

I'm not brain-dead, but I am height-challenged; as in, this is over my head.


Thanks in advance for the help, code below.

Leef_me

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



// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

camera {
orthographic

  location  <0.0, 0, -5.0>
  look_at   <0.0, 0.0,  0.0>
  rotate y*-15
  rotate -x*180*clock             // look at both sides of the disc

}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

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


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


#declare my_text=
text{
  ttf"arialbd.ttf"      "This is a test"    1,0
  translate -z/2
// suggested by fellow pover Samuel Benge  Date: 21 Oct 2007 20:39:07
}



#declare q1 = material {

     texture {                     // one side has background and text
      pigment{
        pigment_pattern{
          object{my_text 0,1}
          }
        pigment_map{
            [0 color Pink]
            [1 color MediumBlue]
        }
      }
    }
    interior_texture {             // the other side has another background

  pigment { color Yellow }
   }
}



#if(1)

mesh {
    triangle { <2,0,0>, <0,3,0>, <0,0,0> }
    uv_mapping
    material {q1}
}

#end


#if(1)

disc {
  <0, 0, 0>  // center position
  z*-1,         // normal vector
  2,       // outer radius
    uv_mapping
    material {q1}
}

#end




cylinder {
  -4*x,  4*x,  .05
  pigment { color Red }
}

cylinder {
  -4*y,  4*y,  .05
  pigment { color Green }
}

cylinder {
  -4*z,  4*z,  .05
  pigment { color Yellow }
}


Post a reply to this message

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