POV-Ray : Newsgroups : povray.newusers : Balls on a grid Server Time
26 Nov 2024 12:18:13 EST (-0500)
  Balls on a grid (Message 1 to 8 of 8)  
From: Ralf
Subject: Balls on a grid
Date: 4 Jun 2004 10:35:00
Message: <web.40c08856b1fbe2ea7b0df26c0@news.povray.org>
Hello Everybody!

I trying to arrange labelled balls on a grid (see subsequent code). The
problem is that the balls look like pool balls. To become more reliable I
would like use uni-colored balls labelled with black text.


error.

In the web I just found examples with text in a glass ball or text growing
out from a ball. Unfortunately all my attempts to modify failed.



Thanks in advance!

Ralf




// Persistence Of Vision raytracer version 3.5 file.
// by Ralf
// 03-06-2004





#include "colors.inc"
#include "functions.inc"
#include "stones.inc"

global_settings {
    assumed_gamma 1.8
    max_trace_level 32
}



camera {location <7.5,17.5,7.5> look_at <7.5,0,7.5>}

light_source {<7.5,20,7.5> color White}



/* *********************************************************** */



#macro MakeBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
    #local Mn = min_extent(Text);
    #local Mx = max_extent(Text);
    #local PatternObj =
    union {
        object {Text
            translate -Mn - 0.5*(Mx-Mn)
            scale  x + y + z*1/(Mx.z - Mn.z)
            scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
            translate -z*1
        }
        #debug "n"
        #debug str((Mx.z - Mn.z),0,0)
        #debug "n"
        object {Text
            translate -Mn - 0.5*(Mx-Mn)
            scale  -x + y + z*1/(Mx.z - Mn.z)
            scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
            translate z*1
        }
        difference {
            cylinder {-z*2, z*2, 5}
            cylinder {-z*2, z*2, SpotSize/2}
        }
    }
    sphere  {< 0, 0, 0>, 1
        texture {
            object {PatternObj texture {WhiteTex}, texture {ColorTex}}
        }
    }
#end


#macro MakeTextBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
    #local TextObj =
    text {ttf "crystal.ttf", Text, 1, 0 /* pigment { Black } */
}
    MakeBall(TextObj, SpotSize, SpotClearance, ColorTex, WhiteTex)
#end


#declare RedTex =
texture {
    pigment {color Red}
}
#declare WhiteTex =
texture {
    pigment {color White}
}

#declare BlackTex =
texture {
    pigment {color Black}
}

#declare GreenTex =
texture {
    pigment {color Green}
}



#declare BlueTex =
texture {
    pigment {color Blue}
}



#declare YellowTex =
texture {
    pigment {color Yellow}
}


/* Grid */
cylinder {<0, 0, 0>, <15, 0, 0>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 2.5>, <15, 0, 2.5>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 5>, <15, 0, 5>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 7.5>, <15, 0, 7.5>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 10>, <15, 0, 10>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 12.5>, <15, 0, 12.5>,  0.05  open   texture { T_Stone25
scale 4 }}
cylinder {<0, 0, 15>, <15, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 0>, <0, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<2.5, 0, 0>, <2.5, 0, 15>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<5, 0, 0>, <5, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<7.5, 0, 0>, <7.5, 0, 15>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<10, 0, 0>, <10, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<12.5, 0, 0>, <12.5, 0, 15>,  0.05  open   texture { T_Stone25
scale 4 }}
cylinder {<15, 0, 0>, <15, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}




object {MakeTextBall("NM_8", 1.5, 0, GreenTex, WhiteTex)
    rotate x*100
    rotate z*350
    translate z*0
    translate y*0
    translate x*0
}
object {MakeTextBall("NM_2", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*100
    translate z*0
    translate y*0
    translate x*2.5
}


object {MakeTextBall("DM_10", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*95
    rotate z*350
    translate z*2.5
    translate y*0
    translate x*0
}


object {MakeTextBall("DM_4", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    rotate z*350
    translate z*5
    translate y*0
    translate x*0
}

object {MakeTextBall("DM_6", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*7.5
    rotate z*350
    translate y*0
    translate x*0
}


object {MakeTextBall("TM_2", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    rotate z*350
    translate z*10
    translate y*0
    translate x*0
}


object {MakeTextBall("NM_5", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*85
    rotate z*350
    translate z*12.5
    translate y*0
    translate x*0
}

object {MakeTextBall("IM_10", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*80
    rotate z*350
    translate z*15
    translate y*0
    translate x*0
}


object {MakeTextBall("IM_3", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*80
    translate z*15
    translate y*0
    translate x*2.5
}



object {MakeTextBall("IT_3", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*85
    translate z*12.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("TM_1", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    translate z*10
    translate y*0
    translate x*2.5
}




object {MakeTextBall("DM_3", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*7.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("TM_10", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    translate z*5
    translate y*0
    translate x*2.5
}

object {MakeTextBall("IT_8", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*95
    translate z*2.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("IT_7", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*100
    translate z*0
    translate y*0
    translate x*5
}


object {MakeTextBall("IT_9", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*95
    translate z*2.5
    translate y*0
    translate x*5
}


object {MakeTextBall("DM_7", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*5
    translate y*0
    translate x*5
}

object {MakeTextBall("TM_6", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    translate z*7.5
    translate y*0
    translate x*5
}

object {MakeTextBall("DM_9", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*10
    translate y*0
    translate x*5
}

object {MakeTextBall("IM_2", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*85
    translate z*12.5
    translate y*0
    translate x*5
}


object {MakeTextBall("IT_5", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*80
    translate z*15
    translate y*0
    translate x*5
}

object {MakeTextBall("NM_4", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*80
    translate z*15
    translate y*0
    translate x*7.5
}


object {MakeTextBall("IM_9", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*85
    translate z*12.5
    translate y*0
    translate x*7.5
}


object {MakeTextBall("NM_10", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*90
    translate z*10
    translate y*0
    translate x*7.5
}

object {MakeTextBall("TM_4", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    translate z*7.5
    translate y*0
    translate x*7.5
}


object {MakeTextBall("IT_4", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*90
    translate z*5
    translate y*0
    translate x*7.5
}

object {MakeTextBall("IT_10", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*95
    translate z*2.5
    translate y*0
    translate x*7.5
}

object {MakeTextBall("IT_3", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*100
    translate z*0
    translate y*0
    translate x*7.5
}


object {MakeTextBall("NM_9", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*100
    translate z*0
    translate y*0
    translate x*10
}

object {MakeTextBall("TM_9", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*95
    translate z*2.5
    translate y*0
    translate x*10
}

object {MakeTextBall("DM_8", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*5
    translate y*0
    translate x*10
}

object {MakeTextBall("TM_5", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    translate z*7.5
    translate y*0
    translate x*10
}


object {MakeTextBall("NM_6", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*90
    translate z*10
    translate y*0
    translate x*10
}

object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*85
    translate z*12.5
    translate y*0
    translate x*10
}

object {MakeTextBall("IM_7", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*80
    translate z*15
    translate y*0
    translate x*10
}


object {MakeTextBall("IM_4", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*80
    translate z*15
    translate y*0
    translate x*12.5
}


object {MakeTextBall("IT_1", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*85
    translate z*12.5
    translate y*0
    translate x*12.5
}


object {MakeTextBall("IM_4", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    translate z*10
    translate y*0
    translate x*12.5
}

object {MakeTextBall("NM_7", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*90
    translate z*7.5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("IM_5", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*90
    translate z*5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("NM_3", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*95
    translate z*2.5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("DM_5", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*100
    translate z*0
    translate y*0
    translate x*12.5
}

object {MakeTextBall("TM_8", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*100
    rotate z*10
    translate z*0
    translate y*0
    translate x*15
}


object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
    rotate x*95
    rotate z*10
    translate z*2.5
    translate y*0
    translate x*15
}


object {MakeTextBall("DM_1", 1.5, 0.1, BlueTex, WhiteTex)
    rotate x*90
    rotate z*10
    translate z*5
    translate y*0
    translate x*15
}


object {MakeTextBall("IT_2", 1.5, 0.1, YellowTex, BlackTex)
    rotate x*90
    rotate z*10
    translate z*7.5
    translate y*0
    translate x*15
}


object {MakeTextBall("TM_3", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*90
    rotate z*10
    translate z*10
    translate y*0
    translate x*15
}

object {MakeTextBall("TM_7", 1.5, 0.1, BlackTex, WhiteTex)
    rotate x*85
    rotate z*10
    translate z*12.5
    translate y*0
    translate x*15
}

object {MakeTextBall("NM_1", 1.5, 0.1, GreenTex, WhiteTex)
    rotate x*80
    rotate z*10
    translate z*15
    translate y*0
    translate x*15
}


plane  {<0,1,0 >,-1  pigment {color White} finish {ambient .5}}


/* Eof */


Post a reply to this message

From: Phil Cook
Subject: Re: Balls on a grid
Date: 4 Jun 2004 12:45:32
Message: <opr82wq7jqefp2ch@news.povray.org>
And lo on Fri,  4 Jun 2004 10:33:58 EDT, Ralf <mos### [at] gmxde> did  
spake, saying:

> Hello Everybody!
>
> I trying to arrange labelled balls on a grid (see subsequent code). The
> problem is that the balls look like pool balls. To become more reliable I
> would like use uni-colored balls labelled with black text.
>
> Modifying the “text{..}” by inserting “pigment {color Black}” cerates an
> error.
>
> In the web I just found examples with text in a glass ball or text  
> growing
> out from a ball. Unfortunately all my attempts to modify failed.
>
> Now I’m looking for an example of a solid sphere labelled with text.
>
> Thanks in advance!
>
> Ralf
<snip code>

Just a quicky but substituting this  macro:
//start code
#macro MakeBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
     #local Mn = min_extent(Text);
     #local Mx = max_extent(Text);



#declare TextTexture=texture{
         pigment{object{Text colour Clear colour Black}
             translate -Mn - 0.5*(Mx-Mn)
             scale  x + y + z*1/(Mx.z - Mn.z)
             scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -  
<Mn.x, Mn.y, 0>) + z
             translate -z*1
        }}

sphere  {< 0, 0, 0>, 1
texture{pigment {cylindrical color_map{[0 Black][0.2 Black][0.2 White][1  
White]}rotate x*90}}
texture{TextTexture}
}


#end
//end code

Just one side of text though, I'll let you play with the other side  and  
Substitute the colours :)

HTH

--
Phil Cook

-- 
All thoughts and comments are my own unless otherwise stated and I am  
happy to be proven wrong.


Post a reply to this message

From: Marvin T
Subject: Re: Balls on a grid
Date: 4 Jun 2004 13:36:45
Message: <40c0b32d@news.povray.org>
Okay, Phil posted a reply since I started messing with this, but here 
goes anyway....

I've typically added text to simple shapes a different way - I make a 
union of the base object and an intersection of the "text" with a 
similar shape that is very slightly larger.  That way the text is above 
the sphere/cylinder, but imperceptibly so.  Sort of what would happen if 
the text was a layer of paint on the object surface.

In your case, the face color can be applied the same way, too.  I 
modified your macro, adding a "text" texture at the end (and the scaling 
and translation is unnecessarily different, since I was tweaking it to 
see what you were doing).   In any event, here's an example of what I mean:

-------- SNIP --------
#macro MakeTextBall(Text, SpotSize, SpotClearance, SphereTex, FaceTex, 
TextPig)
     #local TextObj = text {ttf "crystal.ttf", Text, 1, 0 };
     #local Mn = min_extent(TextObj);
     #local Mx = max_extent(TextObj);
     union {
	// First, the sphere:
	sphere  {< 0, 0, 0>, 1 texture {SphereTex}}
	// Next, the color behind the text:
	intersection {
	    cylinder {-z*2, z*2, SpotSize/2}
	    sphere { <0,0,0>, 1.0001 }
	    texture{FaceTex}
	}
	// Last, the text:
	intersection {
	    union {
		#local ii=0; #while (ii<2)
		object {TextObj
		    translate -Mn - 0.5*(Mx-Mn)
		    scale 
<-1,1,0>*(SpotSize-SpotClearance)/vlength(<Mx.x,Mx.y,0>-<Mn.x,Mn.y,0>)+z/(Mx.z-Mn.z)
		    translate -z*1
		    #if (ii) rotate 180*x #end
		}
		#local ii=ii+1; #end
	    }
	    sphere { <0,0,0>, 1.0002 }
	    texture{TextPig}
	}
     }
#end
-------- SNIP --------

In this case the sphere is 1.0000 in radius, the "face" color is 1.0001 
and the text is 1.0002 -- giving the layered effect I was trying to 
describe.

Note that this method doesn't "wrap" the text, so if the text covers 
much of an arc on the object, it may be distorted too much.

Ralf wrote:
> Hello Everybody!
> 
> I trying to arrange labelled balls on a grid (see subsequent code). The
> problem is that the balls look like pool balls. To become more reliable I
> would like use uni-colored balls labelled with black text.
> 

> error.
>


Post a reply to this message

From: Christopher James Huff
Subject: Re: Balls on a grid
Date: 5 Jun 2004 12:02:01
Message: <cjameshuff-4D99B0.11020305062004@news.povray.org>
In article <40c0b32d@news.povray.org>,
 Marvin T <pov### [at] maltasoftcom> wrote:

> I've typically added text to simple shapes a different way - I make a 
> union of the base object and an intersection of the "text" with a 
> similar shape that is very slightly larger.  That way the text is above 
> the sphere/cylinder, but imperceptibly so.  Sort of what would happen if 
> the text was a layer of paint on the object surface.

This way will be slower and consume more memory than simply using the 
object pattern. It is also more likely to cause artifacts from precision 
problems, and is very difficult with more complex shapes, though it is 
easy with spheres.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Phil Cook
Subject: Re: Balls on a grid
Date: 5 Jun 2004 14:29:32
Message: <opr84wvpzke4dfwg@news.povray.org>
And lo on Sat, 05 Jun 2004 11:02:03 -0500, Christopher James Huff 
<cja### [at] earthlinknet> did spake, saying:

> In article <40c0b32d@news.povray.org>,
>  Marvin T <pov### [at] maltasoftcom> wrote:
>
>> I've typically added text to simple shapes a different way - I make a
>> union of the base object and an intersection of the "text" with a
>> similar shape that is very slightly larger.  That way the text is above
>> the sphere/cylinder, but imperceptibly so.  Sort of what would happen if
>> the text was a layer of paint on the object surface.
>
> This way will be slower and consume more memory than simply using the
> object pattern. It is also more likely to cause artifacts from precision
> problems, and is very difficult with more complex shapes, though it is
> easy with spheres.

Out of curiosity is there an easily explainable :) reason why you can't 
layer multiple object patterns? The obvious answer to this otherwise would 
have been to create the differenced cylinders texture and layer the text 
texture on top.

--
Phil Cook


-- 
All thoughts and comments are my own unless otherwise stated and I am 
happy to be proven wrong.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Balls on a grid
Date: 6 Jun 2004 17:54:26
Message: <cjameshuff-0E0E85.16542906062004@news.povray.org>
In article <opr84wvpzke4dfwg@news.povray.org>,
 Phil Cook <phi### [at] rocainnospamfreeservecouk> wrote:

> Out of curiosity is there an easily explainable :) reason why you can't 
> layer multiple object patterns? The obvious answer to this otherwise would 
> have been to create the differenced cylinders texture and layer the text 
> texture on top.

You can nest them, which lets you accomplish the same things. The object 
pattern is about as simple as a pattern can get, supporting multiple 
objects would be a lot more complex. I have been thinking about such a 
patch, though...or rather, two similar patterns, one which "layers" each 
object over the previous ones, and another which averages overlapping 
objects together.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Phil Cook
Subject: Re: Balls on a grid
Date: 7 Jun 2004 04:58:45
Message: <opr87u47k4efp2ch@news.povray.org>
And lo on Sun, 06 Jun 2004 16:54:30 -0500, Christopher James Huff  
<cja### [at] earthlinknet> did spake, saying:

> In article <opr84wvpzke4dfwg@news.povray.org>,
>  Phil Cook <phi### [at] rocainnospamfreeservecouk> wrote:
>
>> Out of curiosity is there an easily explainable :) reason why you can't
>> layer multiple object patterns? The obvious answer to this otherwise  
>> would
>> have been to create the differenced cylinders texture and layer the text
>> texture on top.
>
> You can nest them, which lets you accomplish the same things.

Of course! silly me that would allow you to remove the MakeBall macro and  
just have:

//code
#macro MakeTextBall(Text, SpotSize, SpotClearance, OuterColor, SpotColor,  
TextColor)

   #local TextObj =
     text {ttf "crystal.ttf", Text, 1, 0 }

     #local Mn = min_extent(TextObj);
     #local Mx = max_extent(TextObj);



#declare Texttexture=
         pigment{object{TextObj colour Clear colour TextColor}
             translate -Mn - 0.5*(Mx-Mn)
             scale  x + y + z*1/(Mx.z - Mn.z)
             scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -  
<Mn.x, Mn.y, 0>) + z
             translate -z*1
        }

#declare Spottexture=
         pigment{object{difference {
             cylinder {-z*2, z*2, 5}
             cylinder {-z*2, z*2, SpotSize/2}
         }
        colour SpotColor colour OuterColor}}

#declare Spheretexture=texture{pigment{Spottexture}}  
texture{pigment{Texttexture}}

sphere  {< 0, 0, 0>, 1
texture{Spheretexture}
}


#end
//end code

Remove all those ...Tex #declare's and put the colours directly in the  
call, adding in the colour of the text directly as part of the macro:
//code
object {MakeTextBall("NM_8", 1.5, 0, Green, White, Black)
     rotate x*100
     rotate z*350
     translate z*0
     translate y*0
     translate x*0
}
//end code


> The object
> pattern is about as simple as a pattern can get, supporting multiple
> objects would be a lot more complex. I have been thinking about such a
> patch, though...or rather, two similar patterns, one which "layers" each
> object over the previous ones, and another which averages overlapping
> objects together.

Have fun :)

--
Phil Cook

-- 
All thoughts and comments are my own unless otherwise stated and I am  
happy to be proven wrong.


Post a reply to this message

From: Ralf
Subject: Re: Balls on a grid
Date: 8 Jun 2004 03:20:01
Message: <web.40c5681b890e5fa57b0df26c0@news.povray.org>
Dear Phil

Thank you for your advice. Your first solution already works pretty well.

An other very good solution was mailed directly by Friedrich. Because this
might be of interest for any Newbies working on similar problems, I list
the code below.

Thanks to all of you for your help :-)

Ralf



/* Code from Friedrich */

#include "functions.inc"
#include "colors.inc"

#include "stones.inc"

global_settings {
    assumed_gamma 1.8
    max_trace_level 32
}



#declare Camera_1 = camera { location <7.5,17.5,7.5>
                            right x*image_width/image_height
                            look_at <7.5,0,7.5>}

#declare Camera_2 = camera { angle 5.1                       // Weiter weg =
weniger Verzerrung!  Lo
                            location <7.5,280,7.5>
                            right x*image_width/image_height
                            look_at  <7.5, 0,7.5>}
camera {Camera_2}

light_source {<7.5,20+100,7.5> color White}     // Licht weiter weg wirft


// sky -------------------------------------------------------------------
sky_sphere{ pigment{ gradient <0,1,0>
                     color_map{ [0   color rgb<1,1,1>]//White
                                [0.4 color
rgb<1,1,1>]//<0.14,0.14,0.56>]//~Navy
                                [0.6 color
rgb<1,1,1>]//<0.14,0.14,0.56>]//~Navy
                                [1.0 color rgb<1,1,1>]//White
                              }
                     scale 2 }
           } // end of sky_sphere
//------------------------------------------------------------------------


/* *********************************************************** */



#macro MakeBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
    #local Mn = min_extent(Text);
    #local Mx = max_extent(Text);
    #local PatternObj =
    union {
        object {Text
            translate -Mn - 0.5*(Mx-Mn)
            scale  x + y + z*1/(Mx.z - Mn.z)
            scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
            translate -z*1
        }
       /* #debug "n"
        #debug str((Mx.z - Mn.z),0,0)
        #debug "n"    geschenkt! */
        object {Text
            translate -Mn - 0.5*(Mx-Mn)
            scale  -x + y + z*1/(Mx.z - Mn.z)
            scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
            translate z*1
        }
      /*  difference {                           //  Das macht den Farbring
der Billiardkugeln! Lo
            cylinder {-z*2, z*2, 5}
            cylinder {-z*2, z*2, SpotSize/2}
        }
      */
    }// end of union of "PatternObj"  Lo

    sphere  {< 0, 0, 0>, 1
        texture {
            object {PatternObj texture {WhiteTex}, texture {ColorTex}}

        }
    rotate <90,0,0>

    }
#end


#macro MakeTextBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
    #local TextObj =
    text { ttf "arial.ttf" /*crystal.ttf"*/ , Text, 1, 0  // texture{
pigment { Black } } "Das geht nicht! "
           scale <0.75,1,1> // Lo
         } // end of text object

    MakeBall(TextObj, SpotSize, SpotClearance, ColorTex, WhiteTex)
#end


#declare RedTex =
texture {
    pigment {color Red}
}
#declare WhiteTex =
texture {
    pigment {color White*1.2}
    finish  {phong 1}
}

#declare BlackTex =
texture {
    pigment {color Black}
}

#declare GreenTex =
texture {
    pigment {color Green}
}



#declare BlueTex =
texture {
    pigment {color Blue}
}



#declare YellowTex =
texture {
    pigment {color Yellow}
}

#declare YellowGreenTex =
texture {
    pigment {color rgb<0.8,1,0.3>}
    finish  {ambient 0.15 diffuse 0.85 phong 0.5}
}


#declare HellgelbTex =
texture {
    pigment {color rgb<1.0,1.0,0.5>}
    finish  {ambient 0.15 diffuse 0.85 phong 0.5}
}

#declare DotterGelbTex =
texture {
    pigment {color rgb<1.0,0.6,0.0>}
    finish  {ambient 0.15 diffuse 0.85 phong 0.5}
}

#declare Metall1 = texture { Polished_Chrome
                   //  pigment{ color rgb<1,0,0>}
                   normal { bumps 0.5 scale 0.005}
                   finish { ambient 0.1 diffuse 0.85  phong 1}
                 } // end of texture

#declare Metall2 = texture { Polished_Chrome
                     pigment{ color rgb<1,0.6,0>}
                   normal { bumps 0.5 scale 0.005}
                   finish { ambient 0.1 diffuse 0.85  phong 1}
                 } // end of texture

/* Gitter definieren */
/*
cylinder {<0, 0, 0>, <15, 0, 0>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 2.5>, <15, 0, 2.5>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 5>, <15, 0, 5>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 7.5>, <15, 0, 7.5>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 10>, <15, 0, 10>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 12.5>, <15, 0, 12.5>,  0.05  open   texture { T_Stone25
scale 4 }}
cylinder {<0, 0, 15>, <15, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 0>, <0, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<2.5, 0, 0>, <2.5, 0, 15>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<5, 0, 0>, <5, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<7.5, 0, 0>, <7.5, 0, 15>,  0.05  open   texture { T_Stone25 scale
4 }}
cylinder {<10, 0, 0>, <10, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
cylinder {<12.5, 0, 0>, <12.5, 0, 15>,  0.05  open   texture { T_Stone25
scale 4 }}
cylinder {<15, 0, 0>, <15, 0, 15>,  0.05  open   texture { T_Stone25 scale 4
}}
*/


Raster(weite) sind einfacher!
#declare Stab = cylinder {<0, 0, 0>, <15, 0, 0>,  0.05   texture {T_Stone25
scale 4 }}
                                                        // texture
{Metall2}}
#declare Raster = 2.5;

#local Nr = 0; #local End = 7; // start / end of loop
#while (Nr < End)

  object{ Stab translate<0,0,Nr*Raster>}
  object{ Stab rotate<0,-90,0>
               translate<Nr*Raster,0,0>}
 #local Nr = Nr + 1;
#end // of while loop
//-------------------------------------------------------------------------------------------

object {MakeTextBall("NM_8", 1.5, 0, BlackTex, Metall2)
    //rotate y*100
    //rotate z*350
    translate z*0
    translate y*0
    translate x*0
}
object {MakeTextBall("NM_2", 1.5, 0.1, BlackTex, YellowGreenTex)
    // rotate x*100
    translate z*0
    translate y*0
    translate x*2.5
}


object {MakeTextBall("DM_10", 1.5, 0.1, BlackTex, WhiteTex)
   // rotate x*95
   // rotate z*350
    translate z*2.5
    translate y*0
    translate x*0
}


object {MakeTextBall("DM_4", 1.5, 0.1, BlackTex, WhiteTex)
   // rotate x*90
   // rotate z*350
    translate z*5
    translate y*0
    translate x*0
}

object {MakeTextBall("DM_6", 1.5, 0.1, BlackTex, WhiteTex)
   // rotate x*90
    translate z*7.5
   // rotate z*350
    translate y*0
    translate x*0
}


object {MakeTextBall("TM_2", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    //rotate z*350
    translate z*10
    translate y*0
    translate x*0
}


object {MakeTextBall("NM_5", 1.5, 0.1, BlackTex, Metall2)
    //rotate x*85
    //rotate z*350
    translate z*12.5
    translate y*0
    translate x*0
}

object {MakeTextBall("IM_10", 1.5, 0.1, Metall2, BlackTex)
    //rotate x*80
    //rotate z*350
    translate z*15
    translate y*0
    translate x*0
}


object {MakeTextBall("IM_3", 1.5, 0.1, BlackTex, HellgelbTex)
    //rotate x*80
    translate z*15
    translate y*0
    translate x*2.5
}



object {MakeTextBall("IT_3", 1.5, 0.1, BlackTex, DotterGelbTex)
    //rotate x*85
    translate z*12.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("TM_1", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    translate z*10
    translate y*0
    translate x*2.5
}




object {MakeTextBall("DM_3", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    translate z*7.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("TM_10", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    translate z*5
    translate y*0
    translate x*2.5
}

object {MakeTextBall("IT_8", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*95
    translate z*2.5
    translate y*0
    translate x*2.5
}


object {MakeTextBall("IT_7", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*100
    translate z*0
    translate y*0
    translate x*5
}


object {MakeTextBall("IT_9", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*95
    translate z*2.5
    translate y*0
    translate x*5
}


object {MakeTextBall("DM_7", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    translate z*5
    translate y*0
    translate x*5
}

object {MakeTextBall("TM_6", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    translate z*7.5
    translate y*0
    translate x*5
}

object {MakeTextBall("DM_9", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    translate z*10
    translate y*0
    translate x*5
}

object {MakeTextBall("IM_2", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*85
    translate z*12.5
    translate y*0
    translate x*5
}


object {MakeTextBall("IT_5", 1.5, 0.1, YellowTex, BlackTex)
    // rotate x*80
    translate z*15
    translate y*0
    translate x*5
}

object {MakeTextBall("NM_4", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*80
    translate z*15
    translate y*0
    translate x*7.5
}


object {MakeTextBall("IM_9", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*85
    translate z*12.5
    translate y*0
    translate x*7.5
}


object {MakeTextBall("NM_10", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*90
    translate z*10
    translate y*0
    translate x*7.5
}

object {MakeTextBall("TM_4", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    translate z*7.5
    translate y*0
    translate x*7.5
}


object {MakeTextBall("IT_4", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*90
    translate z*5
    translate y*0
    translate x*7.5
}

object {MakeTextBall("IT_10", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*95
    translate z*2.5
    translate y*0
    translate x*7.5
}

object {MakeTextBall("IT_3", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*100
    translate z*0
    translate y*0
    translate x*7.5
}


object {MakeTextBall("NM_9", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*100
    translate z*0
    translate y*0
    translate x*10
}

object {MakeTextBall("TM_9", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*95
    translate z*2.5
    translate y*0
    translate x*10
}

object {MakeTextBall("DM_8", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    translate z*5
    translate y*0
    translate x*10
}

object {MakeTextBall("TM_5", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    translate z*7.5
    translate y*0
    translate x*10
}


object {MakeTextBall("NM_6", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*90
    translate z*10
    translate y*0
    translate x*10
}

object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*85
    translate z*12.5
    translate y*0
    translate x*10
}

object {MakeTextBall("IM_7", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*80
    translate z*15
    translate y*0
    translate x*10
}


object {MakeTextBall("IM_4", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*80
    translate z*15
    translate y*0
    translate x*12.5
}


object {MakeTextBall("IT_1", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*85
    translate z*12.5
    translate y*0
    translate x*12.5
}


object {MakeTextBall("IM_4", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    translate z*10
    translate y*0
    translate x*12.5
}

object {MakeTextBall("NM_7", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*90
    translate z*7.5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("IM_5", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*90
    translate z*5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("NM_3", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*95
    translate z*2.5
    translate y*0
    translate x*12.5
}

object {MakeTextBall("DM_5", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*100
    translate z*0
    translate y*0
    translate x*12.5
}

object {MakeTextBall("TM_8", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*100
    //rotate z*10
    translate z*0
    translate y*0
    translate x*15
}


object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
    //rotate x*95
    //rotate z*10
    translate z*2.5
    translate y*0
    translate x*15
}


object {MakeTextBall("DM_1", 1.5, 0.1, BlueTex, WhiteTex)
    //rotate x*90
    //rotate z*10
    translate z*5
    translate y*0
    translate x*15
}


object {MakeTextBall("IT_2 ", 1.5, 0.1, YellowTex, BlackTex)
    //rotate x*90
    //rotate z*10
    translate z*7.5
    translate y*0
    translate x*15
}


object {MakeTextBall("TM_3 ", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*90
    //rotate z*10
    translate z*10
    translate y*0
    translate x*15
}

object {MakeTextBall("TM_7 ", 1.5, 0.1, BlackTex, WhiteTex)
    //rotate x*85
    //rotate z*10
    translate z*12.5
    translate y*0
    translate x*15
}

object {MakeTextBall("NM_1 ", 1.5, 0.1, GreenTex, WhiteTex)
    //rotate x*80
    //rotate z*10
    translate z*15
    translate y*0
    translate x*15
}


plane  {<0,1,0 >,-1  pigment {color White} //finish {ambient .5}}
                                           finish {ambient 1 diffuse 0}}
//alternativ


/* Eof */


Post a reply to this message

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