POV-Ray : Newsgroups : povray.general : Problem: Text around/on a sphere, help me! Server Time
28 Nov 2024 06:00:57 EST (-0500)
  Problem: Text around/on a sphere, help me! (Message 1 to 6 of 6)  
From: - -==TheCa5e==- -
Subject: Problem: Text around/on a sphere, help me!
Date: 6 Jul 2007 15:35:01
Message: <web.468e988ba97195aba5ca18bf0@news.povray.org>
Hi, this might be easy for most of you, but after reading some tutorials I
still wasn't able to do it. So, I would be very pleased and grateful if
somebody could help me out.

I have generated a scene of a molecule consisting of atoms (spheres) and
bonds (cylinders) in POV-Ray.

Now I want certain spheres look like metal balls with non reflecting text on
top of it, like it is printed. More specifically, I want to put the atom
identification on top of the sphere. I have tried something with
object_pattern but probably did something wrong??

Any comments and suggestions are very welcome,

thanx in advance,

Kees


Post a reply to this message

From: - -==TheCa5e==- -
Subject: Re: Problem: Text around/on a sphere, help me!
Date: 6 Jul 2007 16:10:01
Message: <web.468ea0cec66f4ceba5ca18bf0@news.povray.org>
Part of what I have so far,


#include "shapes.inc"
#include "metals.inc"
#include "colors.inc"
global_settings {assumed_gamma 2.0}
camera { location < 0, 0, +15> up < 0, 1, 0> right <  1.3333, 0, 0> look_at
< 0, -0.25, 0> angle 15 }
light_source  { < -1, 2, +2 > color White }
light_source  { < 0, 1, +8 > color White }
#declare color_bond = White     ;
#declare finish_all = finish { phong 0.8 }
#declare color_H = rgb <0.95,0.95,0.95>    ;
#declare color_C = rgb < 0.1, 0.1, 0.1 > ;
background { color White      }
#declare color_O  = Red     ;
#declare color_N  = Blue    ;
#declare color_Pd = Green   ;
#declare color_S  = Yellow  ;

//-------------------------------------------------------------------spheres
union {
// Pd1
       sphere {
               <    3.0070,  -0.2782,  -1.5342 >, 0.45
               texture { pigment { color   color_Pd}
               finish { finish_all } } }
// O1
       sphere {
               <    0.8712,  -0.6197,  -1.3006 >, 0.20
               texture { pigment { color   color_O }
               finish { finish_all } } }
//--------------------------------------------------------------------bonds
// bond Pd1     O1      1
          cylinder {
               <   2.5670,  -0.3486,  -1.4860 > , <    2.4307,  -0.3704,
-1.4711 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }
// bond Pd1     O1      1
          cylinder {
               <   2.2944,  -0.3922,  -1.4562 > , <    2.1581,  -0.4140,
-1.4413 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }
// bond Pd1     O1      1
          cylinder {
               <   2.0217,  -0.4357,  -1.4264 > , <    1.8854,  -0.4575,
-1.4115 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }
// bond Pd1     O1      1
          cylinder {
               <   1.7491,  -0.4793,  -1.3966 > , <    1.6128,  -0.5011,
-1.3817 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }
// bond Pd1     O1      1
          cylinder {
               <   1.4765,  -0.5229,  -1.3668 > , <    1.3402,  -0.5447,
-1.3519 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }
// bond Pd1     O1      1
          cylinder {
               <   1.2039,  -0.5665,  -1.3370 > , <    1.0676,  -0.5883,
-1.3221 >,
  0.050
               texture { pigment { color color_bond }
               finish { finish_all } } }

scale  0.240
rotate y*180
translate y*-0.25
}

tx again

Kees


Post a reply to this message

From: Marc
Subject: Re: Problem: Text around/on a sphere, help me!
Date: 6 Jul 2007 17:12:58
Message: <468eb05a$1@news.povray.org>

news: web.468ea0cec66f4ceba5ca18bf0@news.povray.org...
> Part of what I have so far,
I don't see any text or object-pattern here
But you create your sphere remote from origin.
You should create them at origin, texture them with text on top THEN 
translate them :-)

Marc


Post a reply to this message

From: Chris B
Subject: Re: Problem: Text around/on a sphere, help me!
Date: 6 Jul 2007 18:38:14
Message: <468ec456$1@news.povray.org>
"-_-==TheCa5e==-_-" <Kee### [at] hotmailcom> wrote in message 
news:web.468e988ba97195aba5ca18bf0@news.povray.org...
> Hi, this might be easy for most of you, but after reading some tutorials I
> still wasn't able to do it. So, I would be very pleased and grateful if
> somebody could help me out.
>
> I have generated a scene of a molecule consisting of atoms (spheres) and
> bonds (cylinders) in POV-Ray.
>
> Now I want certain spheres look like metal balls with non reflecting text 
> on
> top of it, like it is printed. More specifically, I want to put the atom
> identification on top of the sphere. I have tried something with
> object_pattern but probably did something wrong??
>
> Any comments and suggestions are very welcome,
>
> thanx in advance,
>
> Kees
>

Hi Kees,

Here's a simple example of writing text onto a sphere. The text object 
'YourText' starts at the origin and is 2 units thick, stretching from z=0 to 
z=2. Translating it brings it in line with the surface of a 1 unit radius 
sphere centred at the origin.

The pigment declared as 'TextPigment' uses the object as a pigment and sets 
the 3D space inside the object to a yellow colour with the 3D space outside 
the object being set to transparent. The texture is applied to the object 
layered on top of another texture, which in this case is red, but could 
equally well be the your shiny texture.


camera {location  <0,0,-20> look_at <0,0,0> angle 30}
light_source {<-30, 10, -30> color rgb 1}

#declare YourText = text {ttf "crystal.ttf", "POV-Ray", 2, 0
  translate <-1.5,-0.5,-3> }

#declare TextPigment = pigment {object {YourText rgbt 1 rgb <1,1,0>}}

sphere {0,3
  texture {pigment {color rgb <1,0,0>}}
  texture {pigment {TextPigment}}
}

Regards,
Chris B.


Post a reply to this message

From: - -==TheCa5e==- -
Subject: Re: Problem: Text around/on a sphere, help me!
Date: 6 Jul 2007 20:15:02
Message: <web.468eda76c66f4ceba5ca18bf0@news.povray.org>
"Marc" <jac### [at] wanadoofr> wrote:

> news: web.468ea0cec66f4ceba5ca18bf0@news.povray.org...
> > Part of what I have so far,
> I don't see any text or object-pattern here
> But you create your sphere remote from origin.
> You should create them at origin, texture them with text on top THEN
> translate them :-)
>
> Marc

tx for the reply, indeed i considered your suggestion. However, since the
pov file was generated with the program PLATON using the crystal structure
of the compound i made myself, the spheres of interest are not at the
origen. In addition, most atoms (spheres) occur more then once in the
scene. Therefore I was hoping to be able to write a general texture or
pigment part for each type of sphere so I don't have to translate the text
for all of them.
I have tried something similar as performed in the folowing pov file:
http://csi.chemie.tu-darmstadt.de/ak/immel/script/redirect.cgi?filename=http://csi.chemie.tu-darmstadt.de/ak/immel/grap
hics/povray35/object_pattern.html
or see below,

but that didn't work. In here they made an text object and sticket that onto
an cylinder. I was hoping to be able to something similar.


global_settings {
assumed_gamma 1
max_trace_level 5

radiosity {
pretrace_start 0.08
pretrace_end 0.02
count 50

nearest_count 5
error_bound 0.15
recursion_limit 1

low_error_factor .5
gray_threshold 0.0
minimum_reuse 0.015
brightness 1

adc_bailout 0.01/2

}
}

camera {
location <6, 3, 6>
right (4/3)*x
look_at <0,0.5,0>
angle 36
}

light_source {
<-3, 10, 18>
color rgb <1.0, 0.9, 0.8>*2.4
}

sphere {
<0, 0, 0>, 1
texture {
pigment {
gradient y
color_map {
[0.0 color rgb < 1.0, 1.0, 1.0 >]
[0.3 color rgb < 0.6, 0.7, 1.0 >]
}
}
finish { diffuse 0 ambient 1 }
}
hollow on
no_shadow
scale 30000
}

#declare Tex_1=
texture {
pigment {
color rgb 0.6
}
finish {
ambient 0.0
diffuse 0.6
specular 0.15
}
}

plane {
y, 0
texture { Tex_1 }
}

#declare Text_Obj=
text {
ttf
"timrom.ttf",
" POV-Ray 3.5",
12, 0.0

scale 0.26
translate -0.5
rotate -90*z
translate 0.5
translate 0.8*y
}

#declare Tex_Metal_A=
texture {
pigment {
gradient y
color_map {
[0.35 color rgb <0.65,0.2,0.1> ]
[0.35 color rgb <0.15,0.2,0.4> ]
}
scale 2
}
finish {
ambient 0.0
diffuse 0.2
specular 0.4
roughness 0.1
metallic

reflection {
0.8
metallic
}
}
normal {
granite 0.05
warp {turbulence 1}
scale 0.1
}
}


#declare Tex_Column=
texture {
object {
Text_Obj
texture { Tex_1 },
texture { Tex_Metal_A }
}

warp { cylindrical }
}


#declare Obj=
union {
cylinder { 0, 2.1*y, 0.2 texture { Tex_Column } }
torus { 0.2, 0.04 translate 0.04*y }
torus { 0.2, 0.04 translate 2.06*y }
texture { Tex_1 }
}

#macro Obj2(Angle, Flip)
Obj
rotate Angle*y
#if (Flip)
rotate 180*z
translate 2.1*y
#end
rotate -90*x
translate 0.24*y
#end

#macro Obj3(Angle)
Obj
rotate Angle*y
rotate 90*x
rotate 180*z
scale <-1,-1,1>
translate 0.24*y
translate -2.1*z
scale 0.45
translate -0.4*z
#end

#macro Obj4(Angle)
Obj
rotate Angle*y
scale 0.8
translate 1.2*x
#end

object { Obj }

object { Obj2(0, false) translate <0.5,0,1> }

object { Obj3(190) rotate 90*y translate <-1,0,0.9> }
object { Obj3(190) rotate 110*y translate <-1,0,0.9> }
object { Obj3(190) rotate 130*y translate <-1,0,0.9> }
object { Obj3(190) rotate 150*y translate <-1,0,0.9> }
object { Obj3(190) rotate 170*y translate <-1,0,0.9> }
object { Obj3(190) rotate 190*y translate <-1,0,0.9> }

object { Obj rotate -20*y scale 0.6 translate <-1,0,0.9> }

object { Obj2(20, true) rotate 110*y translate <-1.4,0,-1.2> }

object { Obj2(20, true) scale 0.7 rotate 110*y translate <1.7,0,1.2> }

object { Obj4(260) rotate 20*y translate <0.6,0,-0.5> }
object { Obj4(260) rotate 40*y translate <0.6,0,-0.5> }
object { Obj4(260) rotate 60*y translate <0.6,0,-0.5> }
object { Obj4(260) rotate 80*y translate <0.6,0,-0.5> }
object { Obj4(260) rotate 100*y translate <0.6,0,-0.5> }
object { Obj4(260) rotate 120*y translate <0.6,0,-0.5> }

object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.5,0,-0.4> }
object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.7,0,-0.25> }
object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.9,0,-0.1> }
object { Obj2(-20, true) scale 0.42 rotate 160*y translate <2.1,0, 0.05> }


Post a reply to this message

From: OpalPlanet
Subject: Re: Problem: Text around/on a sphere, help me!
Date: 7 Jul 2007 21:20:02
Message: <web.46903b29c66f4ceb40f84dcd0@news.povray.org>
there's a guy in the binary group who has some cool txt on spheres, maybe it
would work for you? the thread is called  "RSOCP overkill"

Hope it helps-
OpalPlanet

"-_-==TheCa5e==-_-" <Kee### [at] hotmailcom> wrote:
> "Marc" <jac### [at] wanadoofr> wrote:

> > news: web.468ea0cec66f4ceba5ca18bf0@news.povray.org...
> > > Part of what I have so far,
> > I don't see any text or object-pattern here
> > But you create your sphere remote from origin.
> > You should create them at origin, texture them with text on top THEN
> > translate them :-)
> >
> > Marc
>
> tx for the reply, indeed i considered your suggestion. However, since the
> pov file was generated with the program PLATON using the crystal structure
> of the compound i made myself, the spheres of interest are not at the
> origen. In addition, most atoms (spheres) occur more then once in the
> scene. Therefore I was hoping to be able to write a general texture or
> pigment part for each type of sphere so I don't have to translate the text
> for all of them.
> I have tried something similar as performed in the folowing pov file:
>
http://csi.chemie.tu-darmstadt.de/ak/immel/script/redirect.cgi?filename=http://csi.chemie.tu-darmstadt.de/ak/immel/gr
ap
> hics/povray35/object_pattern.html
> or see below,
>
> but that didn't work. In here they made an text object and sticket that onto
> an cylinder. I was hoping to be able to something similar.
>
>
> global_settings {
> assumed_gamma 1
> max_trace_level 5
>
> radiosity {
> pretrace_start 0.08
> pretrace_end 0.02
> count 50
>
> nearest_count 5
> error_bound 0.15
> recursion_limit 1
>
> low_error_factor .5
> gray_threshold 0.0
> minimum_reuse 0.015
> brightness 1
>
> adc_bailout 0.01/2
>
> }
> }
>
> camera {
> location <6, 3, 6>
> right (4/3)*x
> look_at <0,0.5,0>
> angle 36
> }
>
> light_source {
> <-3, 10, 18>
> color rgb <1.0, 0.9, 0.8>*2.4
> }
>
> sphere {
> <0, 0, 0>, 1
> texture {
> pigment {
> gradient y
> color_map {
> [0.0 color rgb < 1.0, 1.0, 1.0 >]
> [0.3 color rgb < 0.6, 0.7, 1.0 >]
> }
> }
> finish { diffuse 0 ambient 1 }
> }
> hollow on
> no_shadow
> scale 30000
> }
>
> #declare Tex_1=
> texture {
> pigment {
> color rgb 0.6
> }
> finish {
> ambient 0.0
> diffuse 0.6
> specular 0.15
> }
> }
>
> plane {
> y, 0
> texture { Tex_1 }
> }
>
> #declare Text_Obj=
> text {
> ttf
> "timrom.ttf",
> " POV-Ray 3.5",
> 12, 0.0
>
> scale 0.26
> translate -0.5
> rotate -90*z
> translate 0.5
> translate 0.8*y
> }
>
> #declare Tex_Metal_A=
> texture {
> pigment {
> gradient y
> color_map {
> [0.35 color rgb <0.65,0.2,0.1> ]
> [0.35 color rgb <0.15,0.2,0.4> ]
> }
> scale 2
> }
> finish {
> ambient 0.0
> diffuse 0.2
> specular 0.4
> roughness 0.1
> metallic
>
> reflection {
> 0.8
> metallic
> }
> }
> normal {
> granite 0.05
> warp {turbulence 1}
> scale 0.1
> }
> }
>
>
> #declare Tex_Column=
> texture {
> object {
> Text_Obj
> texture { Tex_1 },
> texture { Tex_Metal_A }
> }
>
> warp { cylindrical }
> }
>
>
> #declare Obj=
> union {
> cylinder { 0, 2.1*y, 0.2 texture { Tex_Column } }
> torus { 0.2, 0.04 translate 0.04*y }
> torus { 0.2, 0.04 translate 2.06*y }
> texture { Tex_1 }
> }
>
> #macro Obj2(Angle, Flip)
> Obj
> rotate Angle*y
> #if (Flip)
> rotate 180*z
> translate 2.1*y
> #end
> rotate -90*x
> translate 0.24*y
> #end
>
> #macro Obj3(Angle)
> Obj
> rotate Angle*y
> rotate 90*x
> rotate 180*z
> scale <-1,-1,1>
> translate 0.24*y
> translate -2.1*z
> scale 0.45
> translate -0.4*z
> #end
>
> #macro Obj4(Angle)
> Obj
> rotate Angle*y
> scale 0.8
> translate 1.2*x
> #end
>
> object { Obj }
>
> object { Obj2(0, false) translate <0.5,0,1> }
>
> object { Obj3(190) rotate 90*y translate <-1,0,0.9> }
> object { Obj3(190) rotate 110*y translate <-1,0,0.9> }
> object { Obj3(190) rotate 130*y translate <-1,0,0.9> }
> object { Obj3(190) rotate 150*y translate <-1,0,0.9> }
> object { Obj3(190) rotate 170*y translate <-1,0,0.9> }
> object { Obj3(190) rotate 190*y translate <-1,0,0.9> }
>
> object { Obj rotate -20*y scale 0.6 translate <-1,0,0.9> }
>
> object { Obj2(20, true) rotate 110*y translate <-1.4,0,-1.2> }
>
> object { Obj2(20, true) scale 0.7 rotate 110*y translate <1.7,0,1.2> }
>
> object { Obj4(260) rotate 20*y translate <0.6,0,-0.5> }
> object { Obj4(260) rotate 40*y translate <0.6,0,-0.5> }
> object { Obj4(260) rotate 60*y translate <0.6,0,-0.5> }
> object { Obj4(260) rotate 80*y translate <0.6,0,-0.5> }
> object { Obj4(260) rotate 100*y translate <0.6,0,-0.5> }
> object { Obj4(260) rotate 120*y translate <0.6,0,-0.5> }
>
> object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.5,0,-0.4> }
> object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.7,0,-0.25> }
> object { Obj2(-20, true) scale 0.42 rotate 160*y translate <1.9,0,-0.1> }
> object { Obj2(-20, true) scale 0.42 rotate 160*y translate <2.1,0, 0.05> }


Post a reply to this message

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