POV-Ray : Newsgroups : povray.newusers : Simple 2D text, take 2 : Re: Simple 2D text, take 2 Server Time
28 Jul 2024 18:24:21 EDT (-0400)
  Re: Simple 2D text, take 2  
From: Tim Attwood
Date: 26 Oct 2007 06:32:15
Message: <4721c22f$1@news.povray.org>
> Hi gang, I'm working to understand 2d text mapping onto a surface. I 
> believe
> the term is UV mapping.

Text can be textured onto objects without using uv_mapping.

UV mapping refers to assigning 2d coordinates (u,v) to points on
the surface of an object.  This is done for you on many, but not
all, primitive objects in POV.  The uv_mapping texture keyword
tells a texture to follow these (u,v) coordinates if available.

> 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?

The mesh object doesn't have a default UV mapping, you need
to supply one. This is because a mesh has no set geometry, it
might be a scroll, or a car, or a twisty geometric star do-dad.

When it comes to UV mapping a complex mesh it's possible,
but not advisable to do it by hand. It's better to use a tool
built for it.

Here's an example bu hand...
try commenting out the uv_mapping,
note the difference in scale and orientation etc...
try changing scale...
note the number of checkers on the mesh...

mesh {
    triangle {
       <0,0,0>, <2,0,0>, <3,3,0>
       uv_vectors
       <0,0>,<1,0>,<1,1>
    }
    triangle {
       <0,0,0>, <1,3,0>,<3,3,0>
       uv_vectors
       <0,0>,<1,0>,<1,1>
    }
    texture {
       uv_mapping
       pigment {
          checker White Tan
          scale 1/10
       }
    }
}


Post a reply to this message

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