POV-Ray : Newsgroups : povray.general : Groves in sphere : Re: Groves in sphere Server Time
2 Aug 2024 22:15:21 EDT (-0400)
  Re: Groves in sphere  
From: Mike Williams
Date: 17 Jul 2004 07:07:23
Message: <iGokfAAleQ+AFwPR@econym.demon.co.uk>
Wasn't it no.### [at] heresorry who wrote:
>Hi,
>I want to growe few rows on a sphere surface - how can I do it?
>
>One of ideas would be to difference a sphere with a part of torus with same 
>radius 
>and center.
>
>difference {
>  sphere { 0 R }
>  intersection {
>    torus { R 0.05 }
>    box { ... } // only part of torus
>    rotate ...
>  }
>  [... more intersections ...]
>}
>
>I would rather like to have my bups/groves in a .bmp file... so I need something 
>like height_field, but wrapped into a sphere (I will need only a small part of 
>sphere about 1/10th of its surface so distorsions aroud "edges" of 
>sphere/texture 
>- is not a problem)
>
>Other soulution would be maybe to use  
>sphere { 0 R  normal { bump_map { bmp ..... 
>but I need very realistic results, normals are not enought.
>
>Hmm maybe some isosurface (or parametric) - but this soulution is very slow...

Simple isosurfaces like this are not all that slow. Try this for grooves
that follow lines of latitude. It only takes about 7 times longer than
rendering a plain sphere{0,1}.

#include "functions.inc"
#declare Frequency=60;
#declare Depth=0.02;

isosurface {
  function {f_sphere(x,y,z,1) + sin(Frequency*f_ph(x,y,z))*Depth}
  max_gradient 1.8
  contained_by {sphere {0,1}}
  pigment {rgb 1}
}

If you don't want sharp edges on the sides of the grooves use

  contained_by {sphere {0,1+Depth}}

For lines of longitude use

  sin(Frequency*f_th(x,y,z))

For lines of latitude that get closer near the equator use

  sin(Frequency*y)

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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