POV-Ray : Newsgroups : povray.newusers : Balls on a grid : Re: Balls on a grid Server Time
30 Jul 2024 10:11:36 EDT (-0400)
  Re: Balls on a grid  
From: Phil Cook
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

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