POV-Ray : Newsgroups : povray.newusers : Text on a sphere Server Time
3 Sep 2024 08:14:56 EDT (-0400)
  Text on a sphere (Message 1 to 4 of 4)  
From: Desreux
Subject: Text on a sphere
Date: 15 Feb 2005 10:30:00
Message: <web.421214a08314de44b8e663050@news.povray.org>
Being a chemist, I often draw molecules as balls and sticks of various
colors. The files containing x,y,z coordinates and information on the
colors, size, nature of the atoms and bonds. These files  are converted in
PovRay to obtain quite nice drawings (for instance with a program called
Mol2mol but there are many others). Sometimes, I have to produce plots with
a white background and with atoms in different tones of gray. If the
molecules contain many different atoms, it's no longer easy to distinguish
them and I would like to add the appropriate chemical symbol on some of the
atoms. The letters would have to follow the curvature of spheres of
different sizes and be partly hidden by atoms that are closer to the viewer
if need be. The PovRay files I use give a list of atoms with the
characteristics of each of them. I guess I should add something there to
get what I want but being quite inexperienced in Povray, I don't know how
to proceed. Could someone help me (as I did not find what I was looking for
on the web). Thanks a lot. Jean F.


Post a reply to this message

From: Mike Raiford
Subject: Re: Text on a sphere
Date: 15 Feb 2005 11:21:50
Message: <4212219e$1@news.povray.org>
Desreux wrote:
> Being a chemist, I often draw molecules as balls and sticks of various
> colors. The files containing x,y,z coordinates and information on the
> colors, size, nature of the atoms and bonds. These files  are converted in
> PovRay to obtain quite nice drawings (for instance with a program called
> Mol2mol but there are many others). Sometimes, I have to produce plots with
> a white background and with atoms in different tones of gray. If the
> molecules contain many different atoms, it's no longer easy to distinguish
> them and I would like to add the appropriate chemical symbol on some of the
> atoms. The letters would have to follow the curvature of spheres of
> different sizes and be partly hidden by atoms that are closer to the viewer
> if need be. The PovRay files I use give a list of atoms with the
> characteristics of each of them. I guess I should add something there to
> get what I want but being quite inexperienced in Povray, I don't know how
> to proceed. Could someone help me (as I did not find what I was looking for
> on the web). Thanks a lot. Jean F.

This should get you what you want:

There is an assumption that this fits on a unit sphere centered at 0, 
so, use scaling instead of setting the sphere's radius, Also- depending 
on the font you choose, you may have to fiddle with scaling, 
translations and rotations.

sphere {
     0,1
     pigment {
         object {
            text { ttf "arial.ttf" "He",1,0 scale <.15,.25,100> 
translate <0,.40,-1> }

         red 1
         rgb 1
         }

         warp { spherical dist_exp 0}
         rotate y*117
     }
}


-- 
~Mike

Things! Billions of them!


Post a reply to this message

From: andrel
Subject: Re: Text on a sphere
Date: 15 Feb 2005 17:22:54
Message: <421275B5.9050903@hotmail.com>
Desreux wrote:
> Being a chemist, I often draw molecules as balls and sticks of various
> colors. The files containing x,y,z coordinates and information on the
> colors, size, nature of the atoms and bonds. These files  are converted in
> PovRay to obtain quite nice drawings (for instance with a program called
> Mol2mol but there are many others). Sometimes, I have to produce plots with
> a white background and with atoms in different tones of gray. If the
> molecules contain many different atoms, it's no longer easy to distinguish
> them and I would like to add the appropriate chemical symbol on some of the
> atoms. The letters would have to follow the curvature of spheres of
> different sizes and be partly hidden by atoms that are closer to the viewer
> if need be. The PovRay files I use give a list of atoms with the
> characteristics of each of them. I guess I should add something there to
> get what I want but being quite inexperienced in Povray, I don't know how
> to proceed. Could someone help me (as I did not find what I was looking for
> on the web). Thanks a lot. Jean F.
> 
> 
> 
An alternative would be to approximate a sphere by a set of bicubic
patches and use UV mapping. It depends a bit if you only want text
on it (use another e.g. Mike's approach) or if you want to have
also symbols or bands of color or ... on it.


Post a reply to this message

From: andrel
Subject: Re: Text on a sphere
Date: 15 Feb 2005 19:39:21
Message: <421295B0.60008@hotmail.com>
andrel wrote:
> Desreux wrote:
> 
>> Being a chemist, I often draw molecules as balls and sticks of various
>> colors. The files containing x,y,z coordinates and information on the
>> colors, size, nature of the atoms and bonds. These files  are 
>> converted in
>> PovRay to obtain quite nice drawings (for instance with a program called
>> Mol2mol but there are many others). Sometimes, I have to produce plots 
>> with
>> a white background and with atoms in different tones of gray. If the
>> molecules contain many different atoms, it's no longer easy to 
>> distinguish
>> them and I would like to add the appropriate chemical symbol on some 
>> of the
>> atoms. The letters would have to follow the curvature of spheres of
>> different sizes and be partly hidden by atoms that are closer to the 
>> viewer
>> if need be. The PovRay files I use give a list of atoms with the
>> characteristics of each of them. I guess I should add something there to
>> get what I want but being quite inexperienced in Povray, I don't know how
>> to proceed. Could someone help me (as I did not find what I was 
>> looking for
>> on the web). Thanks a lot. Jean F.
>>
>>
>>
> An alternative would be to approximate a sphere by a set of bicubic
> patches and use UV mapping. It depends a bit if you only want text
> on it (use another e.g. Mike's approach) or if you want to have
> also symbols or bands of color or ... on it.
Actually, no, that is too complicated. You can simply put a image_map
on a sphere.


Post a reply to this message

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