POV-Ray : Newsgroups : povray.general : Isosurface, or perhaps log() help Server Time
4 Nov 2024 19:23:16 EST (-0500)
  Isosurface, or perhaps log() help (Message 1 to 6 of 6)  
From: Tom A 
Subject: Isosurface, or perhaps log() help
Date: 23 Oct 2003 19:07:23
Message: <3f985f2b$1@news.povray.org>
I was playing with functions, trying to learn about isosurfaces, when I 
found something that looked like a "black hole".  But I noticed what 
looked like some strange shadows or reflections on it, and I cleaned up 
my code and have some questions on it.

Basically, it's the log function.  In an image with the variable "close" 
  defined as false you can see the problems as black shapes in the hole.

With close set to true, the camera is moved right into the hole and the 
sides are not smooth.

Is this just a limitation of the algorithm used to create isosurfaces? 
Or am I doing something wrong?

Two more questions
Can the ?: (conditional) operator be used in a function?
Can vlength() be used in a function?  (It kept complaining about the "<" 
symbol on the vector I passed it).

Thanks.  Code follows:


// Persistence of Vision Ray Tracer Scene Description File
// File: i_test.pov
// Vers: 3.5
// Desc: Testing Isoserfaces - trying to get what I want
// Date:
// Auth: Tom A.
//

#version 3.5;

#include "colors.inc"

global_settings {
   assumed_gamma 1.0
}

// ----------------------------------------

#declare close = false;

camera {

   direction 1.5*z
   right     x*image_width/image_height
#if( close)
   location  <1.0, 4, -1.0>look_at   <0.0, 0.0,  0.0>
#else
   location  <0.0, 20.5, -53.50>look_at   <0.0, 0.0,  0.0>
#end
} // camera

sky_sphere {   pigment {  Black } }


light_source { <0,200, 0>  color White }


isosurface
{ function { (y-  log( sqrt(x*x+z*z) )*5)
            }

     contained_by { box { -15, 15 } }

   #if (close) // a sort of black whole type grid

    texture{
      pigment{ gradient z color_map{ [.02 White ] [.02 Clear ] } scale .25 }
      finish{ ambient .4 }
    }
    texture{
      pigment{ gradient x color_map{ [.02 White ] [.02 Clear ] } scale .25}
    }

   #else

     pigment{ gradient y scale 7 }

   #end
}


Post a reply to this message

From: Slime
Subject: Re: Isosurface, or perhaps log() help
Date: 23 Oct 2003 19:15:28
Message: <3f986110$1@news.povray.org>
> Basically, it's the log function.  In an image with the variable "close"
>   defined as false you can see the problems as black shapes in the hole.
>
> With close set to true, the camera is moved right into the hole and the
> sides are not smooth.


Without looking very closely at the code, I predict that you can solve the
problem by either reducing the "accuracy" or increasing the "max_gradient".
Check the documentation for each.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Christopher James Huff
Subject: Re: Isosurface, or perhaps log() help
Date: 23 Oct 2003 19:56:26
Message: <cjameshuff-AAFC6F.19541923102003@netplex.aussie.org>
In article <3f985f2b$1@news.povray.org>,
 "Tom A." <met### [at] yahoocom> wrote:

> I was playing with functions, trying to learn about isosurfaces, when I 
> found something that looked like a "black hole".  But I noticed what 
> looked like some strange shadows or reflections on it, and I cleaned up 
> my code and have some questions on it.

This sounds like typical artifacts of the isosurface intersection 
solving algorithm. If so, it has nothing directly to do with the log() 
function, it is caused by your function having too high of a gradient.
Using higher quality settings (mainly a higher max_gradient) will reduce 
or eliminate these artifacts.


> Can the ?: (conditional) operator be used in a function?

No. The select() function gives the same functionality, however.
http://povray.org/documentation/view/137/#s06_01_03_06


> Can vlength() be used in a function?  (It kept complaining about the "<" 
> symbol on the vector I passed it).

No. Neither can any other vector functions. User defined functions have 
no concept of "vectors". The only way you can get a vector value from 
one is to use a transform, pigment, or spline function, and you can't 
perform mathematical operations on vectors within a function.

A full listing of what you can use in functions is here:
http://povray.org/documentation/view/140/

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Mark Weyer
Subject: Re: Isosurface, or perhaps log() help
Date: 24 Oct 2003 05:36:44
Message: <3F98F3ED.2030504@informatik.uni-freiburg.de>
> This sounds like typical artifacts of the isosurface intersection 
> solving algorithm. If so, it has nothing directly to do with the log() 
> function, it is caused by your function having too high of a gradient.
> Using higher quality settings (mainly a higher max_gradient) will reduce 
> or eliminate these artifacts.

The log function is here used in a range containing zero. The derivative
of log at zero is infinite, so the gradient is unbounded and no max_gradient
can suffice.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: Tom A 
Subject: Re: Isosurface, or perhaps log() help
Date: 24 Oct 2003 11:20:32
Message: <3f994340$1@news.povray.org>
Christopher James Huff wrote:
> In article <3f985f2b$1@news.povray.org>,
>  "Tom A." <met### [at] yahoocom> wrote:
> 
> 
>>I was playing with functions, trying to learn about isosurfaces, when I 
>>found something that looked like a "black hole".  But I noticed what 
>>looked like some strange shadows or reflections on it, and I cleaned up 
>>my code and have some questions on it.
> 
> 
> This sounds like typical artifacts of the isosurface intersection 
> solving algorithm. If so, it has nothing directly to do with the log() 
> function, it is caused by your function having too high of a gradient.
> Using higher quality settings (mainly a higher max_gradient) will reduce 
> or eliminate these artifacts.

Thank you, and the the others who answered my questions.


> 
> 
> 
>>Can the ?: (conditional) operator be used in a function?
> 
> 
> No. The select() function gives the same functionality, however.
> http://povray.org/documentation/view/137/#s06_01_03_06
> 
> 
> 
>>Can vlength() be used in a function?  (It kept complaining about the "<" 
>>symbol on the vector I passed it).
> 
> 
> No. Neither can any other vector functions. User defined functions have 
> no concept of "vectors". The only way you can get a vector value from 
> one is to use a transform, pigment, or spline function, and you can't 
> perform mathematical operations on vectors within a function.
> 
> A full listing of what you can use in functions is here:
> http://povray.org/documentation/view/140/
> 

Tom A.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Isosurface, or perhaps log() help
Date: 24 Oct 2003 18:59:00
Message: <cjameshuff-00B2E3.18565224102003@netplex.aussie.org>
In article <3F9### [at] informatikuni-freiburgde>,
 Mark Weyer <wey### [at] informatikuni-freiburgde> wrote:

> The log function is here used in a range containing zero. The derivative
> of log at zero is infinite, so the gradient is unbounded and no max_gradient
> can suffice.

Right, but it reaches infinity at a line along the y axis, and the 
surface quickly moves outside the container object. A high enough 
max_gradient should get rid of most of the artifacts that show up. For 
this isosurface, max_gradient 12 almost completely eliminated the 
problems.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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