POV-Ray : Newsgroups : povray.advanced-users : Turning squares into a smooth isosurface : Re: Turning squares into a smooth isosurface Server Time
29 Jul 2024 02:31:01 EDT (-0400)
  Re: Turning squares into a smooth isosurface  
From: Warp
Date: 8 Apr 2003 10:07:32
Message: <3e92d7a3@news.povray.org>
Greg M. Johnson <gregj:-)565### [at] aolcom> wrote:
> I'm looking for a more sophisticated and automatic analogue to this
> approach,  perhaps starting with prisms,  DXF files,  boxes, or the like.
> What operations like this are available as an isosurface??

  One idea comes to my mind:

  You probably know the HF_Square() macro and how you can create a mesh
(which looks like a heightfield) with it using an image (ie. you make
a pigment function with the image and then a function which takes the .gray
value of this pigment function and give it to HF_Square()).

  My idea: Instead of making a function which takes the .gray value of
the pigment function, make this function to take several .gray values
from the pigment function and average them together (perhaps with a weight
value if you want).
  That is, when you normally would do this:

#declare ImageGray = function { Image(x,y,z).gray }

you would do for example this:

#declare ImageGray =
  function
  {  .16 * Image(x,y,z).gray +

     .13 * Image(x+Offsx,y,z).gray +
     .13 * Image(x-Offsx,y,z).gray +
     .13 * Image(x,y+Offsy,z).gray +
     .13 * Image(x,y-Offsy,z).gray +

     .08 * Image(x+Offsx,y+Offsy,z).gray +
     .08 * Image(x-Offsx,y+Offsy,z).gray +
     .08 * Image(x+Offsx,y-Offsy,z).gray +
     .08 * Image(x-Offsx,y-Offsy,z).gray
  }

  Then you give ImageGray to HF_Square() to generate the mesh.

  Note that the sum of all the factors should always be 1.

  The 'Offsx' and 'Offsy' values above are offset values which depend on the
resolution of the image. They could get the adjacent pixel of the image, but
they can perfectly go further, which probably smoothens the image more.
  And of course you can add even more "samples" to the function in order
to get a smoother result from a larger area (eg using "Offsx*2" etc).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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