![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"SharkD" <nomail@nomail> wrote in message
> ... snip ...
> I'd like the grid lines to exist /within/ the sphere, as well as on the
> surface.
> Currently, if I cut a corner away from the sphere, the cut-away portion is
> completely opaque (dark green in this case, black if I use Trevor G
> Quayle's
> code).
>
Actually I think the grid lines do exist within the sphere and I suspect
that this is why you get a green or black surface in your cut-away. If the
cut surfaces align with a horizontal line (eg. latitude 0 degrees) and two
of the longitudinal lines (e.g. 0 and 90 degrees) then you'll get the colour
of the grid lines (assuming you apply the one texture to the whole object).
One way of resolving that would be to shift the horizontal lines up by half
the current separation and rotate the sphere around the vertical axis by
half a segment. Another would be to specify an appropriate texture of your
choice to the object doing the cutting. e.g. a displaced and rotated
gridline texture combined with an onion texture to give you the concentric
spheres.
> It's a personal request. I'd like to replace the SVG image with a nicely
> rendered one, as the SVG image was removed from an article for being "too
> ugly"
> (kind of a stupid reason to remove a diagram from an encyclopedia, but
> anyway...).
>
If it's an ugliness problem then presumably you don't want to just reproduce
something that's very similar to what you've got. Also, I agree with Nicolas
that a rendered image with grid-lines wouldn't scale as well as a vector
graphics image will, resulting in less clarity and potentially some of the
lines disappearing as it gets scaled down or uneven thickening as it gets
scaled up. You may want to consider keeping the lines from the existing SVG
file overlayed on top of prettier bitmapped spheres.
You could probably do smoothly graded spheres in POV-Ray using orthographic
projection and only ambient lighting, but I thought it was also possible to
do such colour grading in an SVG editor.
Hope there's something in all that that's helpful.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Chris B" <nom### [at] nomail com> wrote:
> "SharkD" <nomail@nomail> wrote in message
> > ... snip ...
> > I'd like the grid lines to exist /within/ the sphere, as well as on the
> > surface.
> > Currently, if I cut a corner away from the sphere, the cut-away portion is
> > completely opaque (dark green in this case, black if I use Trevor G
> > Quayle's
> > code).
> >
>
> Actually I think the grid lines do exist within the sphere and I suspect
> that this is why you get a green or black surface in your cut-away. If the
> cut surfaces align with a horizontal line (eg. latitude 0 degrees) and two
> of the longitudinal lines (e.g. 0 and 90 degrees) then you'll get the colour
> of the grid lines (assuming you apply the one texture to the whole object).
>
> One way of resolving that would be to shift the horizontal lines up by half
> the current separation and rotate the sphere around the vertical axis by
> half a segment. Another would be to specify an appropriate texture of your
> choice to the object doing the cutting. e.g. a displaced and rotated
> gridline texture combined with an onion texture to give you the concentric
> spheres.
>
> > It's a personal request. I'd like to replace the SVG image with a nicely
> > rendered one, as the SVG image was removed from an article for being "too
> > ugly"
> > (kind of a stupid reason to remove a diagram from an encyclopedia, but
> > anyway...).
> >
>
> If it's an ugliness problem then presumably you don't want to just reproduce
> something that's very similar to what you've got. Also, I agree with Nicolas
> that a rendered image with grid-lines wouldn't scale as well as a vector
> graphics image will, resulting in less clarity and potentially some of the
> lines disappearing as it gets scaled down or uneven thickening as it gets
> scaled up. You may want to consider keeping the lines from the existing SVG
> file overlayed on top of prettier bitmapped spheres.
>
> You could probably do smoothly graded spheres in POV-Ray using orthographic
> projection and only ambient lighting, but I thought it was also possible to
> do such colour grading in an SVG editor.
>
> Hope there's something in all that that's helpful.
>
> Regards,
> Chris B.
The grid lines do go all the way through. What he is referring to is the
concentric layer lines.
This should be fairly easy to do. A few notes:
1) The Longitudinal lines are fine, they are already a constant thickness
through.
2) The latitude lines are from a spherical map, so they will radiate to the
center as needed, but they aren't constant thickness. better to replace them
with another object pattern made from appropriately sized and offset cones.
3) For the concentric layer lines, a simple onion pattern should suffice.
4) A note on offsetting though. In the image, the lines aren't at the quadrants,
but rather the colour grids are centered on them, all grid lines should be
shifted accordingly. (This is why you get solid black when cutting though the
quadrant)
5) Unfortunately you will get thicker lines at the the center axis from the skew
of the longitudinal lines. This really can't be avoided if you want to maintain
a constant thickness in the planes. Perhaps they could be stopped short of the
center axis to prevent this.
6) Regarding 5), perhaps you don't need the separating grid lines for the
graphic, just the colour stepping alone (or even a constant gradient)would work
best. You could still highlight the cutout edges with black lines though (again
using an object pattern)
7) For the colour gradient, you could use a simple macro for the cells, however
you could also use the HSL->RGB functions I posted in a different thread (look
for the thread regarding colour spaces and colour interpolation). These
functions can be used to create a continous gradient function or modified to
give a stepped gradient.
I already started throwing some of the stuff together and may be able to post
something tomorrow.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Here is a layout with stepped gradient and black gridlines.
GRDTHK adjusts the thickness of the gridlines
LatDiv adjust how many steps are in the gradient
Note the thick black line down the middle resulting from cutting through the
skewed longitudinals.
-tgq
//START
camera {
location <5,10,-10>
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
angle 12
}
light_source {
<30, 50, -40>
rgb <1, 1, 1>}
plane {
y, -1
pigment {rgb 1}
}
//HSL to RGB
#declare tHSL=function(H,C){(H/360+C/3)-floor(H/360+C/3)}
#declare qHSL=function(H,S,L){select(L-1/2,L*(1+S),L+S-L*S)}
#declare pHSL=function(H,S,L){2*L-qHSL(H,S,L)}
#declare CHSL=function(H,S,L,C)
{
select(
-S
,//S>0
select(
tHSL(H,C)-1/6
,//tc<1/6
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*tHSL(H,C)
,
select(
tHSL(H,C)-1/2
,//tc<1/2
qHSL(H,S,L)
,
select(
tHSL(H,C)-2/3
,//tc<2/3
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*(2/3-tHSL(H,C))
,//esle
pHSL(H,S,L)
)
)
)
,//S=0
L
)
}
#declare RHSL=function (H,S,L){CHSL(H,S,L,+1)}
#declare GHSL=function (H,S,L){CHSL(H,S,L, 0)}
#declare BHSL=function (H,S,L){CHSL(H,S,L,-1)}
//END HSL to RGB
#declare LatDiv=6; //Number of Latitude divisions, used for long too
(degrees= 90/LatDiv)
#declare GRDTHK=0.01; //Line thickness for 1 unit radius sphere
#declare FX=function(x){360/(LatDiv*4)*int(x*LatDiv*4+0.5)}
#declare FY=function(y){int(y*LatDiv*2+0.5)/(LatDiv*2)}
#declare FZ=function(y){int(y*LatDiv+0.5)/LatDiv}
#declare FR= function(x,y,z){RHSL(FX(x),FZ(z),FY(y))}
#declare FG= function(x,y,z){GHSL(FX(x),FZ(z),FY(y))}
#declare FB= function(x,y,z){BHSL(FX(x),FZ(z),FY(y))}
#declare HSL=
pigment{
average
pigment_map{
[function{ FR(x,y,z) } color_map{[0 rgb 0][1 rgb <3,0,0>]}]
[function{ FG(x,y,z) } color_map{[0 rgb 0][1 rgb <0,3,0>]}]
[function{ FB(x,y,z) } color_map{[0 rgb 0][1 rgb <0,0,3>]}]
}
warp{spherical}
}
#declare AA=sin(GRDTHK/2);
#declare LAT=
union{
#local i=+90/LatDiv/2;#while(i<90)
difference{
cone{0,0,2*y,tan(radians(i))*2 translate -y/sin(radians(i))*AA}
cone{0,0,2*y,tan(radians(i))*2 translate y/sin(radians(i))*AA}
}
difference{
cone{0,0,-2*y,tan(radians(i))*2 translate y/sin(radians(i))*AA}
cone{0,0,-2*y,tan(radians(i))*2 translate -y/sin(radians(i))*AA}
}
#local i=i+90/(LatDiv);#end
}
#declare LONG=
union{
#local i=+90/LatDiv/2;#while(i<180)
cylinder{-z*sin(GRDTHK/2),z*sin(GRDTHK/2),1.1 rotate y*i}
#local i=i+90/(LatDiv);#end
}
#declare PLat=
pigment{
object{
LAT
pigment{onion scale 1/LatDiv
pigment_map{
[0.5-AA*LatDiv HSL scale LatDiv]
[0.5-AA*LatDiv rgb 0]
[0.5+AA*LatDiv rgb 0]
[0.5+AA*LatDiv HSL scale LatDiv]
}
}
pigment{rgb 0}
}
}
#declare PGrid=
pigment{
object{
LONG
pigment{PLat}
pigment{rgb 0}
}
}
difference{
sphere{0,1}
box{0,<1,1,-1>}
pigment{PGrid}
finish{ambient 0 diffuse 0.5}
}
//END
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Again, this time I've cored out the gridlines where not needed. This partly
removes the thick line down the center, but not completely depending on the
settings.
-tgq
//START
camera {
location <5,10,-10>
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
angle 12
}
light_source {
<30, 50, -40>
rgb <1, 1, 1>
}
plane {
y, -1
pigment {rgb 1}
}
//HSL to RGB
#declare tHSL=function(H,C){(H/360+C/3)-floor(H/360+C/3)}
#declare qHSL=function(H,S,L){select(L-1/2,L*(1+S),L+S-L*S)}
#declare pHSL=function(H,S,L){2*L-qHSL(H,S,L)}
#declare CHSL=function(H,S,L,C)
{
select(
-S
,//S>0
select(
tHSL(H,C)-1/6
,//tc<1/6
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*tHSL(H,C)
,
select(
tHSL(H,C)-1/2
,//tc<1/2
qHSL(H,S,L)
,
select(
tHSL(H,C)-2/3
,//tc<2/3
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*(2/3-tHSL(H,C))
,//esle
pHSL(H,S,L)
)
)
)
,//S=0
L
)
}
#declare RHSL=function (H,S,L){CHSL(H,S,L,+1)}
#declare GHSL=function (H,S,L){CHSL(H,S,L, 0)}
#declare BHSL=function (H,S,L){CHSL(H,S,L,-1)}
//END HSL to RGB
#declare LatDiv=6; //Number of Latitude divisions, used for long too
(degrees= 90/LatDiv)
#declare GRDTHK=0.01; //Line thickness for 1 unit radius sphere
#declare FX=function(x){360/(LatDiv*4)*int(x*LatDiv*4+0.5)}
#declare FY=function(y){int(y*LatDiv*2+0.5)/(LatDiv*2)}
#declare FZ=function(y){int(y*LatDiv+0.5)/LatDiv}
#declare FR= function(x,y,z){RHSL(FX(x),FZ(z),FY(y))}
#declare FG= function(x,y,z){GHSL(FX(x),FZ(z),FY(y))}
#declare FB= function(x,y,z){BHSL(FX(x),FZ(z),FY(y))}
#declare HSL=
pigment{
average
pigment_map{
[function{ FR(x,y,z) } color_map{[0 rgb 0][1 rgb <3,0,0>]}]
[function{ FG(x,y,z) } color_map{[0 rgb 0][1 rgb <0,3,0>]}]
[function{ FB(x,y,z) } color_map{[0 rgb 0][1 rgb <0,0,3>]}]
}
warp{spherical}
}
#declare AA=sin(GRDTHK/2);//GRDTHK*LatDiv/2/(pi*2/4);
#declare ABC=pigment{rgb 1}
#declare LAT=
union{
#local i=+90/LatDiv/2;#while(i<90)
difference{
cone{0,0,2*y,tan(radians(i))*2 translate -y/sin(radians(i))*AA}
cone{0,0,2*y,tan(radians(i))*2 translate y/sin(radians(i))*AA}
}
difference{
cone{0,0,-2*y,tan(radians(i))*2 translate y/sin(radians(i))*AA}
cone{0,0,-2*y,tan(radians(i))*2 translate -y/sin(radians(i))*AA}
}
#local i=i+90/(LatDiv);#end
}
#declare LONG=
difference{
union{
#local i=+90/LatDiv/2;#while(i<180)
cylinder{-z*sin(GRDTHK/2),z*sin(GRDTHK/2),1.1 rotate y*i}
#local i=i+90/(LatDiv);#end
}
sphere{0,1/LatDiv/2}
cone{0,0,2*y,tan(radians(90/LatDiv/2))*2}
cone{0,0,-2*y,tan(radians(90/LatDiv/2))*2}
}
#declare LAY=
union{
cone{0,0,2*y,tan(radians(90/LatDiv/2))*2}
cone{0,0,-2*y,tan(radians(90/LatDiv/2))*2}
scale LatDiv
}
#declare PLay=
pigment{
object{
LAY
pigment{rgb 0}
pigment{rgb 1}
}
}
#declare PLat=
pigment{
object{
LAT
pigment{onion scale 1/LatDiv
pigment_map{
[0.5-AA*LatDiv HSL scale LatDiv]
[0.5-AA*LatDiv PLay]
[0.5+AA*LatDiv PLay]
[0.5+AA*LatDiv HSL scale LatDiv]
}
}
pigment{rgb 0}
}
}
#declare PGrid=
pigment{
object{
LONG
pigment{PLat}
pigment{rgb 0}
}
}
difference{
sphere{0,1}
box{0,<1,1,-1>}
pigment{PGrid}
finish{ambient 0 diffuse 0.5}
}
//END
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I decided to go with an object pattern instead. It's a lot simpler.
Here's what the object looks like:
http://img228.imageshack.us/img228/6177/spheregriddd8.jpg
Here's what the scene looks like so far. I still need to change the colored
pigment so that it uses steps that match the grid, but that should be trivial.
http://img228.imageshack.us/img228/2742/hslspherewithgriday2.jpg
Here's the scene:
//BEGIN
//------------------------------------------------------------------------------Scenery
#include "Axes.inc"
#include "functions.inc"
#include "math.inc"
global_settings
{
assumed_gamma 1.0
ambient_light 1.0
}
light_source
{
<0, 0, -100> // light's position (translated below)
color rgb <1, 1, 1> // light's color
rotate <60,30,0>
parallel
shadowless
}
camera
{
#local CameraDistance = 10;
#local ScreenArea = 2;
#local AspectRatio = image_width/image_height;
// orthographic
location -z*CameraDistance
direction z*CameraDistance
right x*ScreenArea*AspectRatio
up y*ScreenArea
rotate x*asind(tand(30))
// rotate x*90
rotate y*45
}
//------------------------------------------------------------------------------Pigments
#declare Plain_White = pigment
{
color <1, 1, 1>
}
#declare Plain_Gray = pigment
{
color <1/2, 1/2, 1/2>
}
#declare Plain_Black = pigment
{
color <0, 0, 0>
}
#declare Plain_Clear = pigment
{
color rgbt <0, 0, 0, 1,>
}
#declare Hue = pigment
{
function
{
f_th(x,y,z) / pi / 2
}
color_map
{
[0 rgb <1, 0, 0>]
[1/3 rgb <0, 0, 1>]
[2/3 rgb <0, 1, 0>]
[1 rgb <1, 0, 0>]
}
}
#declare Saturation = pigment
{
function
{
f_r(x,y,z)
}
pigment_map
{
[0 Plain_Gray]
[1 Hue]
}
scale 1.0001
}
#declare Luminence = pigment
{
function
{
f_ph(x,y,z) / pi
}
pigment_map
{
[0 Plain_White]
[1/2 Saturation]
[1 Plain_Black]
}
}
//------------------------------------------------------------------------------CSG
objects
#declare sRadius = 1 ;
#declare sCenter = 0 ;
#declare radii = 6;
#declare longt = 12;
#declare lattt = 6;
#declare ObjectRadius = 1;
#declare LineThickness = 0.01;
#declare GridObject = intersection
{
union
{
#local i=ObjectRadius/radii/2;
#while(i<ObjectRadius)
difference
{
sphere
{
0, i + LineThickness/2
}
sphere
{
0, i - LineThickness/2
}
}
#local i=i+ObjectRadius/radii;
#end
#local i=360/longt/2;
#while(i<360)
intersection
{
plane
{
x, LineThickness/2
}
plane
{
-x, LineThickness/2
}
rotate y*i
}
#local i=i+360/longt;
#end
#local i=90/(lattt/2)/2;
#while(i<90)
difference
{
cone
{
0,0,
y,1/tand(i)
translate -y * 1/cosd(i) * LineThickness/2
}
cone
{
0,0,
y,1/tand(i)
translate y * 1/cosd(i) * LineThickness/2
}
}
difference
{
cone
{
0,0,
-y,1/tand(i)
translate y * 1/cosd(i) * LineThickness/2
}
cone
{
0,0,
-y,1/tand(i)
translate -y * 1/cosd(i) * LineThickness/2
}
}
#local i=i+90/(lattt/2);
#end
}
sphere
{
sCenter, ObjectRadius
}
}
#declare GridPigment = pigment
{
object
{
GridObject
color rgbt 1
color rgbt 0
}
scale 1.0001
}
difference
{
sphere
{
sCenter, sRadius
}
box
{
sCenter, <-sRadius,sRadius,-sRadius,> * 2
}
texture
{
Luminence
finish
{
ambient 1
}
}
texture {pigment{GridPigment}}
}
//END
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
No gridlines, stepped gradient, cutout outlined in black.
To remove outline, replace "pigment{PGrid}" with "pigment{HSL}" in the last
object.
//START
camera {
location <5,10,-10>
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
angle 12
}
light_source {
<30, 50, -40>
rgb <1, 1, 1>
}
plane {
y, -1
pigment {rgb 1}
}
//HSL to RGB
#declare tHSL=function(H,C){(H/360+C/3)-floor(H/360+C/3)}
#declare qHSL=function(H,S,L){select(L-1/2,L*(1+S),L+S-L*S)}
#declare pHSL=function(H,S,L){2*L-qHSL(H,S,L)}
#declare CHSL=function(H,S,L,C)
{
select(
-S
,//S>0
select(
tHSL(H,C)-1/6
,//tc<1/6
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*tHSL(H,C)
,
select(
tHSL(H,C)-1/2
,//tc<1/2
qHSL(H,S,L)
,
select(
tHSL(H,C)-2/3
,//tc<2/3
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*(2/3-tHSL(H,C))
,//esle
pHSL(H,S,L)
)
)
)
,//S=0
L
)
}
#declare RHSL=function (H,S,L){CHSL(H,S,L,+1)}
#declare GHSL=function (H,S,L){CHSL(H,S,L, 0)}
#declare BHSL=function (H,S,L){CHSL(H,S,L,-1)}
//END HSL to RGB
#declare LatDiv=6; //Number of Latitude divisions, used for long too
(degrees= 90/LatDiv)
#declare GRDTHK=0.01; //Line thickness for 1 unit radius sphere
#declare FX=function(x){360/(LatDiv*4)*int(x*LatDiv*4+0.5)}
#declare FY=function(y){int(y*LatDiv*2+0.5)/(LatDiv*2)}
#declare FZ=function(y){int(y*LatDiv+0.5)/LatDiv}
#declare FR= function(x,y,z){RHSL(FX(x),FZ(z),FY(y))}
#declare FG= function(x,y,z){GHSL(FX(x),FZ(z),FY(y))}
#declare FB= function(x,y,z){BHSL(FX(x),FZ(z),FY(y))}
#declare HSL=
pigment{
average
pigment_map{
[function{ FR(x,y,z) } color_map{[0 rgb 0][1 rgb <3,0,0>]}]
[function{ FG(x,y,z) } color_map{[0 rgb 0][1 rgb <0,3,0>]}]
[function{ FB(x,y,z) } color_map{[0 rgb 0][1 rgb <0,0,3>]}]
}
warp{spherical}
}
#declare AA=sin(GRDTHK/2);//GRDTHK*LatDiv/2/(pi*2/4);
#declare ABC=pigment{rgb 1}
#declare LONG =
intersection{
union{
torus{1,GRDTHK}
torus{1,GRDTHK rotate x*90}
torus{1,GRDTHK rotate z*90}
cylinder{0,x,GRDTHK}
cylinder{0,y,GRDTHK}
cylinder{0,-z,GRDTHK}
}
box{<-1,-1,1>*GRDTHK,<1,1,-1>}
}
#declare PGrid=
pigment{
object{
LONG
pigment{HSL}
pigment{rgb 0}
}
}
difference{
sphere{0,1}
box{0,<1,1,-1>}
pigment{PGrid}//change to HSL for no black outlines
finish{ambient 0 diffuse 0.5}
}
//END
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
And one more, with continuous smooth gradient instead of stepped.
-tgq
//START
camera {
location <5,10,-10>
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
angle 12
}
light_source {
<30, 50, -40>
rgb <1, 1, 1>
}
plane {
y, -1
pigment {rgb 1}
}
//HSL to RGB
#declare tHSL=function(H,C){(H/360+C/3)-floor(H/360+C/3)}
#declare qHSL=function(H,S,L){select(L-1/2,L*(1+S),L+S-L*S)}
#declare pHSL=function(H,S,L){2*L-qHSL(H,S,L)}
#declare CHSL=function(H,S,L,C)
{
select(
-S
,//S>0
select(
tHSL(H,C)-1/6
,//tc<1/6
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*tHSL(H,C)
,
select(
tHSL(H,C)-1/2
,//tc<1/2
qHSL(H,S,L)
,
select(
tHSL(H,C)-2/3
,//tc<2/3
pHSL(H,S,L)+2*(qHSL(H,S,L)-L)*6*(2/3-tHSL(H,C))
,//esle
pHSL(H,S,L)
)
)
)
,//S=0
L
)
}
#declare RHSL=function (H,S,L){CHSL(H,S,L,+1)}
#declare GHSL=function (H,S,L){CHSL(H,S,L, 0)}
#declare BHSL=function (H,S,L){CHSL(H,S,L,-1)}
//END HSL to RGB
#declare GRDTHK=0.01; //Line thickness for 1 unit radius sphere
#declare FR= function(x,y,z){RHSL(360*x,z,y)}
#declare FG= function(x,y,z){GHSL(360*x,z,y)}
#declare FB= function(x,y,z){BHSL(360*x,z,y)}
#declare HSL=
pigment{
average
pigment_map{
[function{ FR(x,y,z) } color_map{[0 rgb 0][1 rgb <3,0,0>]}]
[function{ FG(x,y,z) } color_map{[0 rgb 0][1 rgb <0,3,0>]}]
[function{ FB(x,y,z) } color_map{[0 rgb 0][1 rgb <0,0,3>]}]
}
warp{repeat z flip z}// to avoid coincident surface problem
warp{spherical}
}
#declare AA=sin(GRDTHK/2);//GRDTHK*LatDiv/2/(pi*2/4);
#declare ABC=pigment{rgb 1}
#declare LONG =
intersection{
union{
torus{1,GRDTHK}
torus{1,GRDTHK rotate x*90}
torus{1,GRDTHK rotate z*90}
cylinder{0,x,GRDTHK}
cylinder{0,y,GRDTHK}
cylinder{0,-z,GRDTHK}
}
box{<-1,-1,1>*GRDTHK,<1,1,-1>}
}
#declare PGrid=
pigment{
object{
LONG
pigment{HSL}
pigment{rgb 0}
}
}
difference{
sphere{0,1}
box{0,<1,1,-1>}
pigment{PGrid}//change to HSL for no black outlines
finish{ambient 0 diffuse 0.5}
}
//END
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"SharkD" <nomail@nomail> wrote:
> I decided to go with an object pattern instead. It's a lot simpler.
>
> Here's what the object looks like:
> http://img228.imageshack.us/img228/6177/spheregriddd8.jpg
>
> Here's what the scene looks like so far. I still need to change the colored
> pigment so that it uses steps that match the grid, but that should be trivial.
> http://img228.imageshack.us/img228/2742/hslspherewithgriday2.jpg
>
Looks good, looks like you got the maths figured out for the grid object. The
only real difference with what put together is you are using sphere objects for
the layers, whereas I used an onion pattern.
For the HSL colour spacing, look at the HSL pigment in my code, you will need to
play with the LatDiv numers in all three to get what you need.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Trevor G Quayle" <Tin### [at] hotmail com> wrote:
> "SharkD" <nomail@nomail> wrote:
> > I decided to go with an object pattern instead. It's a lot simpler.
> >
> > Here's what the object looks like:
> > http://img228.imageshack.us/img228/6177/spheregriddd8.jpg
> >
> > Here's what the scene looks like so far. I still need to change the colored
> > pigment so that it uses steps that match the grid, but that should be trivial.
> > http://img228.imageshack.us/img228/2742/hslspherewithgriday2.jpg
> >
>
> Looks good, looks like you got the maths figured out for the grid object. The
> only real difference with what put together is you are using sphere objects for
> the layers, whereas I used an onion pattern.
>
> For the HSL colour spacing, look at the HSL pigment in my code, you will need to
> play with the LatDiv numers in all three to get what you need.
>
> -tgq
Here's one of the other differences:
http://img442.imageshack.us/img442/1082/hslsphereisometricshowbh1.jpg
I can difference the whole object. It looks pretty cool. It's what I'm going to
use for the final image. I just need to add the labels and arrows and such to
make it a real diagram.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"SharkD" <nomail@nomail> wrote:
> Here's one of the other differences:
>
> http://img442.imageshack.us/img442/1082/hslsphereisometricshowbh1.jpg
>
> I can difference the whole object. It looks pretty cool. It's what I'm going to
> use for the final image. I just need to add the labels and arrows and such to
> make it a real diagram.
I uploaded it to the Object Collection as a macro (search for
"SphereGridMacro"). There were some things I fixed before uploading it, though.
I included a sample file showing three different ways of using the object.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |