POV-Ray : Newsgroups : povray.advanced-users : IsoSurface Help Server Time
31 Oct 2024 23:32:42 EDT (-0400)
  IsoSurface Help (Message 1 to 7 of 7)  
From: Woody
Subject: IsoSurface Help
Date: 2 Apr 2010 23:20:00
Message: <web.4bb6b3807b9446f84fd370d20@news.povray.org>
Can Someone help me out. I'm trying to figure out the weird coloring on the
lighted portion of the bottom half of the sphere.

The image is at

http://news.povray.org/web.4bb6af70dba6e9c64fd370d20%40news.povray.org

<web.4bb6af70dba6e9c64fd370d20@news.povray.org>

The source is

Source is as follows:


Can Someone help me out. I'm trying to figure out the weird coloring on the
lighted portion of the bottom half of the sphere.

The image is at

http://news.povray.org/web.4bb6af70dba6e9c64fd370d20%40news.povray.org

<web.4bb6af70dba6e9c64fd370d20@news.povray.org>

The source is

Source is as follows:


#include "colors.inc"
#include "math.inc"

camera {
  location  <0.0, 1.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}


#declare num =  8;
#declare fn_theta_deg_of_x_y = function(x,y) { mod(atan2d(y,x) + 360,360) }
#declare fn_block = function(x,y) {
-1*mod(floor(fn_theta_deg_of_x_y(x,y)/(180/num)),2) }
#declare fn_x_y_z  = function(x,y) { fn_block(x,y) }
isosurface {
  function { fn_block(x, y) }
  contained_by { sphere { 0, 1.0 } }
  isosurface [0.0]
  accuracy 0.001
  max_gradient 2000

  pigment{color Red}
}


Post a reply to this message

From: clipka
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 04:17:47
Message: <4bb6f9ab$1@news.povray.org>
Am 03.04.2010 05:18, schrieb Woody:
> Can Someone help me out. I'm trying to figure out the weird coloring on the
> lighted portion of the bottom half of the sphere.

When dealing with isosurfaces...

- Try avoiding discontinuous functions like floor(), mod() or the like. 
The algorithm doesn't work well with those.

- Make sure your function /crosses/ f(x)=0 (or whatever threshold you 
choose) instead of just touching it; it seems to me that your function 
never goes below the threshold, so that for some pixels POV-Ray is 
convinced that it never even reaches it.

For your purposes, I'd suggest using sin() or cos() to produce the 
repetitive banding, instead of the mod(floor(),2) operation.


Post a reply to this message

From: Alain
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 08:55:44
Message: <4bb73ad0$1@news.povray.org>

> Am 03.04.2010 05:18, schrieb Woody:
>> Can Someone help me out. I'm trying to figure out the weird coloring
>> on the
>> lighted portion of the bottom half of the sphere.
>
> When dealing with isosurfaces...
>
> - Try avoiding discontinuous functions like floor(), mod() or the like.
> The algorithm doesn't work well with those.
>
> - Make sure your function /crosses/ f(x)=0 (or whatever threshold you
> choose) instead of just touching it; it seems to me that your function
> never goes below the threshold, so that for some pixels POV-Ray is
> convinced that it never even reaches it.
>
> For your purposes, I'd suggest using sin() or cos() to produce the
> repetitive banding, instead of the mod(floor(),2) operation.

Also, using sin() or cos() will greatly reduce your max_gradient and 
will probably result in a faster rendering.


Alain


Post a reply to this message

From: Alain
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 11:13:37
Message: <4bb75b21$1@news.povray.org>

> Can Someone help me out. I'm trying to figure out the weird coloring on the
> lighted portion of the bottom half of the sphere.
>
> The image is at
>
> http://news.povray.org/web.4bb6af70dba6e9c64fd370d20%40news.povray.org
>
> <web.4bb6af70dba6e9c64fd370d20@news.povray.org>
>
> The source is
>
> Source is as follows:
>
>
> Can Someone help me out. I'm trying to figure out the weird coloring on the
> lighted portion of the bottom half of the sphere.
>
> The image is at
>
> http://news.povray.org/web.4bb6af70dba6e9c64fd370d20%40news.povray.org
>
> <web.4bb6af70dba6e9c64fd370d20@news.povray.org>
>
> The source is
>
> Source is as follows:
>
>
> #include "colors.inc"
> #include "math.inc"
>
> camera {
>    location<0.0, 1.5, -4.0>
>    direction 1.5*z
>    right     x*image_width/image_height
>    look_at<0.0, 0.0,  0.0>
> }
>
> light_source {
>    <0, 0, 0>             // light's position (translated below)
>    color rgb<1, 1, 1>   // light's color
>    translate<-30, 30, -30>
> }
>
>
> #declare num =  8;
> #declare fn_theta_deg_of_x_y = function(x,y) { mod(atan2d(y,x) + 360,360) }
> #declare fn_block = function(x,y) {
> -1*mod(floor(fn_theta_deg_of_x_y(x,y)/(180/num)),2) }
> #declare fn_x_y_z  = function(x,y) { fn_block(x,y) }
> isosurface {
>    function { fn_block(x, y) }
>    contained_by { sphere { 0, 1.0 } }
>    isosurface [0.0]
Here, this statement produce an error.
-> No matching } in 'isosurface', isosurface found instead.
Normal POV-Ray never use, nor used, that structure.

>    accuracy 0.001
>    max_gradient 2000
>
>    pigment{color Red}
> }
>
>
>
>
Discreete functions like mod(), ceil() and floor() produce extremely 
large max_gradient. In fact, it reatch infinity at the discontinuities.

Use something like this instead:
   function { f_sphere(x,y,z,1) + sin(atan2(x,y)*num )}

And reduce your max_gradient to something like 15 to 20



Alain


Post a reply to this message

From: Woody
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 17:00:01
Message: <web.4bb7ab5c4361fbb7b4bb947f0@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:> >    isosurface [0.0]
> Here, this statement produce an error.
> -> No matching } in 'isosurface', isosurface found instead.
> Normal POV-Ray never use, nor used, that structure.
Sorry,

You probably guessed, this was from the IsoSurface template, and when stripping
down the code of comments and uneeded information for the posting.

It wasn't in the original file.


Post a reply to this message

From: Woody
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 17:05:01
Message: <web.4bb7ad224361fbb7b4bb947f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 03.04.2010 05:18, schrieb Woody:
> > Can Someone help me out. I'm trying to figure out the weird coloring on the
> > lighted portion of the bottom half of the sphere.
>
> When dealing with isosurfaces...
>
> - Try avoiding discontinuous functions like floor(), mod() or the like.
> The algorithm doesn't work well with those.
>
> - Make sure your function /crosses/ f(x)=0 (or whatever threshold you
> choose) instead of just touching it; it seems to me that your function
> never goes below the threshold, so that for some pixels POV-Ray is
> convinced that it never even reaches it.
>
> For your purposes, I'd suggest using sin() or cos() to produce the
> repetitive banding, instead of the mod(floor(),2) operation.

Have any idea what you might do? The only way I can think to do it with Sin or
Cos functions is with fourier series, but this would require an extremely long
function.


Post a reply to this message

From: Woody
Subject: Re: IsoSurface Help
Date: 3 Apr 2010 17:40:00
Message: <web.4bb7b5634361fbb7b4bb947f0@news.povray.org>
Never mind. I figured it out by studying of all things financial derivatives, ie
construction using calls and puts.


Post a reply to this message

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