POV-Ray : Newsgroups : povray.newusers : Problem merging two isosurfaces : Re: Problem merging two isosurfaces Server Time
28 Jul 2024 14:30:16 EDT (-0400)
  Re: Problem merging two isosurfaces  
From: Trevor G Quayle
Date: 15 Oct 2008 15:35:00
Message: <web.48f64533c4ddaaee81c811d20@news.povray.org>
"Mike" <win### [at] hotmailcom> wrote:
> I have been trying to create basically a cube in which the top and bottom face
> is a 2D sine wave (egg crate pattern).  I have been able to do this using
> isosurface, with some trouble however.  The way I found to do this was to make
> one isosurface sine wave pattern contained by a box and then make another one
> also contained by a box and flip it over.  My problem is that when I try to
> merge the two objects I create, I have tried merge and union I always see a
> middle boundary in between them.  The indicies of refraction are matched and I
> am using fresnel reflection, so I do not see how or why I am seeing this.  If
> anyone has any ideas on how to make this artifact go away that would be very
> helpful.  I have posted the code I used to make the object below.

For what you are doing a heightfield would be far better suited and much easier
to work with.  See below.  You'll need to work with the values to get what you
want for scalings and translations.  The RES parameter adjusts the resolution
used for the heightfield.

Some things to note:
-HFs are created on the X/Z plane from <0,0> to <1,1>
-HFs read the function on the X/Y plane at Z=0  (ie, HF read from XY plane but
create on XZ plane - perpedicular)
-HF height is in the Y axis and ranges from 0 to 1, but actually acts like a
plane, ie, it is infinite below the surface (doesn't stop at 0)


This object should render far faster than an isosurface without errors or holes.
Higher values for RES will give more accurate results but will increase parse
time, however they shouldn't significantly affect render time.

Hope some of this helps.

-tgq



//START
#declare f_1= function (x,y){( 0.9-0.1*sin(3*6.2832*x)*sin(3*6.2832*y))}

#declare RES=100; //hf resolution
#local HF1=
  height_field{
    function RES,RES {pattern{ function {
      f_1 (x*1.9,y*1.9)
    }
   }
  }
  smooth
  translate <-1/2,-1/2,-1/2>
  scale <2.01,2,2.01> //scale the HF slightly larger in X/Z directions to be
removed
}

intersection{
  object{HF1 pigment {rgb 1}}  //Top HF
  object{HF1 rotate 180*z pigment {rgb 1}}  //Bottom HF
  box{-1,1 pigment {rgb 1}}  //Cube to trim sides
  scale <1.9,1,1.9>
}

//END


Post a reply to this message

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