POV-Ray : Newsgroups : povray.binaries.images : why the difference??? Server Time
19 Aug 2024 18:21:47 EDT (-0400)
  why the difference??? (Message 1 to 5 of 5)  
From: Oded
Subject: why the difference???
Date: 20 Oct 2000 20:00:05
Message: <39f0dc85@news.povray.org>
between the following two pov-codes' results.
I have no idea, hope someone can tell me why two identical objects look
different
one is a simple CSG, the other an isosurface
attached are the results...


///////////Code A start/////////////
#version unofficial MegaPov 0.6
isosurface {
        function {
                if(1 - x,0,1)+
                if(1 - y,0,1)+
                if(1 - z,0,1)+
                if(x + 1,0,1)+
                if(y + 1,0,1)+
                if(z + 1,0,1)
        }
        threshold 0.5
        contained_by { box {<-10,-10,-10>,<10,10,10>}}
        pigment {rgb 1}
}
light_source {<10,14,24> rgb 1}
camera {
        location 3
        look_at 0
        }

//////////code B start//////////////

intersection {
        plane {<1,0,0> , 1}
        plane {<0,1,0> , 1}
        plane {<0,0,1> , 1}
        plane {-<1,0,0> , 1}
        plane {-<0,1,0> , 1}
        plane {-<0,0,1> , 1}
        pigment {rgb 1}
}
light_source {<10,14,24> rgb 1}
camera {
        location 3
        look_at 0
        }

////////END//////////////////


Post a reply to this message


Attachments:
Download 'CornerIsoFree.jpg' (4 KB) Download 'CornerIso.jpg' (4 KB)

Preview of image 'CornerIsoFree.jpg'
CornerIsoFree.jpg

Preview of image 'CornerIso.jpg'
CornerIso.jpg


 

From: Mike Williams
Subject: Re: why the difference???
Date: 21 Oct 2000 02:06:25
Message: <GhZalLASIT85EwOS@econym.demon.co.uk>
Wasn't it Oded who wrote:
>between the following two pov-codes' results.
>I have no idea, hope someone can tell me why two identical objects look
>different
>one is a simple CSG, the other an isosurface
>attached are the results...

I don't fully understand why the two objects look different, but I can
tell you that it's the isosurface that's wrong, and I can tell you what
you can do to fix it.

But you may not like the solution.



Method 1 isosurfaces sometimes have problems when the function has an
extremely high gradient, so you can fix it by using method 2, i.e. be
adding either

   method 2
   eval

or, in this particular case,

   method 2
   max_gradient 4000

The reason that you may not like the solution is that it now takes a
ridiculously long time to render the image.

Note that, for this function, the max_gradient is dependent on the
accuracy. The gradient is really infinite at the surface of the object
because the value of "if(1 - x,0,1)" changes from 0 to 1 over an
arbitrarily small distance. The smallest distance that gets considered
depends on the accuracy setting.


An alternative solution would be to generate the isosurface box from a
function that has less steep gradients, such as 

isosurface {
        function { (y*y-0.5) & (x*x-0.5) & (z*z-0.5) }
        threshold 0.5
        contained_by {box <-2,-2,-2><2,2,2>}
        pigment {rgb 1}
}

Which is correct whether you use method 1 or method 2, and renders
quickly if you use method 1 or if you make the bounding box a reasonable
size.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christoph Hormann
Subject: Re: why the difference???
Date: 21 Oct 2000 02:57:54
Message: <39F13E71.63853111@schunter.etc.tu-bs.de>
Oded wrote:
> 
> between the following two pov-codes' results.
> I have no idea, hope someone can tell me why two identical objects look
> different
> one is a simple CSG, the other an isosurface
> attached are the results...
> 

As Mike said, the isosurface function you used is not that good because of the
high gradient (abrupt changes in value) occuring.  In general the if(,,)
construct is not very suited for isosurface functions in most cases.  

You should use the classical isosurface cube instead:

isosurface{                             
  function { abs(x) & abs(y) & abs(z) } 
  threshold 0.5
  contained_by{ box { <-2,-2,-2> <2,2,2> } }     
} 

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Oded
Subject: Re: why the difference???
Date: 21 Oct 2000 06:25:18
Message: <39f16f0e@news.povray.org>
thanks, both of you

got it now.
since im not gonna make a box, its just an example of a more general
problem.
i have a question , what does the '&' operator do (not logically, i mean
actually, since you dont have true/false nor bits in real numbers....)?

Christoph Hormann <Chr### [at] schunteretctu-bsde> wrote in message
news:39F13E71.63853111@schunter.etc.tu-bs.de...
>
>
> Oded wrote:
> >
> > between the following two pov-codes' results.
> > I have no idea, hope someone can tell me why two identical objects look
> > different
> > one is a simple CSG, the other an isosurface
> > attached are the results...
> >
>
> As Mike said, the isosurface function you used is not that good because of
the
> high gradient (abrupt changes in value) occuring.  In general the if(,,)
> construct is not very suited for isosurface functions in most cases.
>
> You should use the classical isosurface cube instead:
>
>

>   function { abs(x) & abs(y) & abs(z) }
>   threshold 0.5
>   contained_by{ box { <-2,-2,-2> <2,2,2> } }
> }
>
> Christoph
>
> --
> Christoph Hormann <chr### [at] gmxde>
> Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Christoph Hormann
Subject: Re: why the difference???
Date: 21 Oct 2000 06:45:14
Message: <39F173BB.50F0B764@schunter.etc.tu-bs.de>
Oded wrote:
> 
[...]
> i have a question , what does the '&' operator do (not logically, i mean
> actually, since you dont have true/false nor bits in real numbers....)?
> 

Have a look at part 3 of Samuel T.'s isosurface tutorial:

http://www.hamiltonite.pwp.blueyonder.co.uk/raytracing/STBenge/iso_tutorial3.html


Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

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