POV-Ray : Newsgroups : povray.advanced-users : Question on Isosurfaces Server Time
30 Jul 2024 02:19:04 EDT (-0400)
  Question on Isosurfaces (Message 1 to 1 of 1)  
From: CreeD
Subject: Question on Isosurfaces
Date: 6 Aug 2000 15:30:48
Message: <01bfffdd$8fd1a640$b913a1d0@mk>
Hi.  I'm looking to make a soccer ball-like object that combines
two functions into one isosurface:
A: the ball
and B: The hexagons on the ball. I want these hexagons to be raised, which
is why
I'm using an isosurface and not a sphere with a function as a surface
normal.  

In addition I'm trying to use random numbers to generate random hexagon
colors
on this ball.

Can someone tell me what's wrong with this code?  I have several problems
that have stumped me.

1. Both the hexagon pigment and the isosurface function"FHexagon" tend to
create
the hexagons asymmetrically, so that at the poles of my sphere there are
hexagons,
and these "extrude" downwards along the y axis to the opposite pole. I'd
like
hexagons all around the equator as well.

2. If I use a rounded box instead of a sphere 
(function "rounded_box" <3> gets me a sphere) 
the pigment seems to map a little more normally, but the isosurface
function still looks wrong and keeps 'cubing' my sphere to boot. My
temporary fix is to just contain it with a sphere instead of a box.

3. The pigments in my hexagon pattern (which are semi random) seem to
affect whether the isosurface shows up at all and change the shape.  I
guess I should declare one pigment for the function and a different one for
the texture, but if I can work around this I'd like to.  In any case, I
seem to remember a page with a tutorial on how to make a pigment 3D, and
the example used was a crackle pattern made into an isosurface function and
then added to a sphere function to get a crackly sphere.  How does that
work? (and what happened to the page?)

code below:

#declare PHexagon = 
pigment {hexagon
  color rgb <2,2,2>+10*rand(RandColor)
  color rgb <2,4,2>*rand(RandColor)
  color rgb <1,2,4>-rand(RandColor)
	}

#declare FHexagon = function {pigment {PHexagon}} 

#declare FRBox = function {"rounded_box" <3>}

#declare FBoxSurface =
function {FRBox
         |    FHexagon(x,y,z)*10 
//The or bar is there because "+" and "&" never seem to work... 
             }

isosurface {

     function {FBoxSurface}
     
contained_by {sphere {<0,0,0>,3}} 
//but what I really want is a box so you can see
//the hexagon ridges...
 
eval     threshold  5     method 2 
//tweaking the threshold helps make it visible, but not correct ...

texture {
 pigment{function{FHexagon}
  color_map {
   [0 color rgbf<rand(RandColor)*rand(RandColor), 
               rand(RandColor),
               rand(RandColor),0>] 
   [.3 color rgbf<rand(RandColor).4,
               rand(RandColor)^2,
               rand(RandColor)*rand(RandColor),0>]
   [1  color
rgbf<rand(RandColor)+.5,rand(RandColor)+.3,2*rand(RandColor)^2+.5,0>] 
  
   }//end color map
  }//end pigment 
//normal {function {FHexagon(x*10,y*10,z*10)*10}scale 10 rotate x*-90}
//The normal looks okay but it's not what I want.
}//end texture
finish {phong 1 phong_size 2 ambient .2}
rotate x*90} //end iso


Post a reply to this message

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