POV-Ray : Newsgroups : povray.newusers : Isosurface problem Server Time
22 Dec 2024 00:25:11 EST (-0500)
  Isosurface problem (Message 1 to 8 of 8)  
From: John Greenwood
Subject: Isosurface problem
Date: 29 Jan 2014 05:35:00
Message: <web.52e8d82bcfb9f6d0a7cafab50@news.povray.org>
I have created an isosurface with _exactly_ the shape I want, but there is one
region where generation breaks down, I think because of surfaces coinciding.

Any suggestions?

#version 3.7;
global_settings { assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}

#include "colors.inc"
#include "functions.inc"

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

#declare CamLoc = < 0, 0,-20>;

camera {
 location CamLoc
        right     x*image_width/image_height
 look_at < 0, 0, 0>
 angle 30
}

light_source {CamLoc color White*0.35}
light_source {<-50, 150,-75> color White}

background { color rgb<1,1,1>*0.35 }


/*
box {<-4,-3, 1>, < 4, 3, 2>
 texture {
  pigment {checker color rgb < 0.05, 0, 0.35>, color White}
  finish {ambient 0 diffuse 1}
 }
}
*/
//-------------------------------------------
#local Yo = 0.08;
#local Zo = .635;
#local Xa = 0.75;
#local Yb = 1.6;
#local Rr = 2.560;
#local Ko = 0.23;


#declare IsoFinish =
finish {
 ambient 0 diffuse 1
 specular 1 roughness 0.02
 brilliance 2
}

#declare  Shape =
intersection   {
isosurface {

// I think the isosurface function does not like sqrt with negative roots.
// This gives a very strange result
//    function {-sqrt((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))
+pow(x,2)}

// This works except fo the "Ears" where the parabola reflects
    function {-((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))
+pow(x,4)}
    max_gradient 200
    accuracy     0.001
    threshold 0
    contained_by {box {<0,0,-1>,<2,2,1>}}
           }
// This is the shape I want; But....
// This chops off the ears but the surfaces coincide at the corners and we get a
hole
     cylinder {<-1,Rr,0>,<2,Rr,0>,Rr}


   texture {
  pigment {color  rgb<0.8,0,0>}
  finish {IsoFinish}}
        rotate <180, 90, 0>     }

#declare Spread = 3;
 object {Shape rotate <-90, 45, -90> translate <-Spread, Spread, 0>}
 object {Shape rotate <0, 90, 0> translate <-Spread, 0, 0>}
 object {Shape rotate <0, 45, 45> translate <-Spread, -Spread, 0>}

 object {Shape rotate <-120, 0, 0> translate <0, Spread, 0>}
 object {Shape rotate <0, 0, 0> translate <0, 0, 0>}
 object {Shape rotate <45, 0, 0> translate <0, -Spread, 0>}

 object {Shape rotate <45, 45, 45> translate <Spread, Spread, 0>}
 object {Shape rotate <0, -45, 0> translate <Spread, 0, 0>}
 object {Shape rotate <-100, 45, 0> translate <Spread, -Spread, 0>}


Post a reply to this message

From: Doctor John
Subject: Re: Isosurface problem
Date: 29 Jan 2014 07:17:20
Message: <52e8f150$1@news.povray.org>
On 29/01/14 10:30, John Greenwood wrote:
> I have created an isosurface with _exactly_ the shape I want, but there is one
> region where generation breaks down, I think because of surfaces coinciding.
> 
> Any suggestions?
> 
> // This works except fo the "Ears" where the parabola reflects
>     function {-((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))+pow(x,4)}
>     max_gradient 200
>     accuracy     0.001
>     threshold 0
>     contained_by {box {<0,0,-1>,<2,2,1>}}
>            }

You need the keyword 'all_intersections' thus:
function
{-((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))+pow(x,4)}
    max_gradient 32
    accuracy     0.001
    threshold 0
    all_intersections
    contained_by {box {<0,0,-1>,<2,2,1>}}
           }
You will also notice that I have reduced your max_gradient to 32 thus
gaining an ~40% increase in speed.

See: http://www.povray.org/documentation/view/3.7.0/300/ At the bottom
of the page there is a short paragraph about max_trace and
all_intersections.

John
-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

From: Alain
Subject: Re: Isosurface problem
Date: 29 Jan 2014 13:46:01
Message: <52e94c69@news.povray.org>

> I have created an isosurface with _exactly_ the shape I want, but there is one
> region where generation breaks down, I think because of surfaces coinciding.
>
> Any suggestions?
>
> #version 3.7;
> global_settings { assumed_gamma 1.0 }
> #default{ finish{ ambient 0.1 diffuse 0.9 }}
>
> #include "colors.inc"
> #include "functions.inc"
>
> //-------------------------------------------
>
> #declare CamLoc = < 0, 0,-20>;
>
> camera {
>   location CamLoc
>          right     x*image_width/image_height
>   look_at < 0, 0, 0>
>   angle 30
> }
>
> light_source {CamLoc color White*0.35}
> light_source {<-50, 150,-75> color White}
>
> background { color rgb<1,1,1>*0.35 }
>
>
> /*
> box {<-4,-3, 1>, < 4, 3, 2>
>   texture {
>    pigment {checker color rgb < 0.05, 0, 0.35>, color White}
>    finish {ambient 0 diffuse 1}
>   }
> }
> */
> //-------------------------------------------
> #local Yo = 0.08;
> #local Zo = .635;
> #local Xa = 0.75;
> #local Yb = 1.6;
> #local Rr = 2.560;
> #local Ko = 0.23;
>
>
> #declare IsoFinish =
> finish {
>   ambient 0 diffuse 1
>   specular 1 roughness 0.02
>   brilliance 2
> }
>
> #declare  Shape =
> intersection   {
> isosurface {
>
> // I think the isosurface function does not like sqrt with negative roots.
> // This gives a very strange result
> //    function {-sqrt((1-pow(z/Zo,2))*pow((y-Rr+sqrt(pow(Rr,2)-pow(z,2))),2))
> +pow(x,2)}
>

This negate the function. It effectively make the outside part the 
"inside" of your shape. If the function don't require been negated, 
you'll only see the contained_by object.
You may also need to negate the thresshold value.


Alain


Post a reply to this message

From: Doctor John
Subject: Re: Isosurface problem
Date: 30 Jan 2014 07:04:19
Message: <52ea3fc3$1@news.povray.org>
On 29/01/14 10:30, John Greenwood wrote:
> I have created an isosurface with _exactly_ the shape I want, but there is one
> region where generation breaks down, I think because of surfaces coinciding.
> 
> Any suggestions?

John, I've realised why you are having a bit of difficulty with getting
the max_gradient right for your isosurfaces.

In v3.6, a warning was issued if you had set max_gradient too high or
too low. In v3.7, that behaviour became broken (something to do with
thread safety). In
http://news.povray.org/povray.beta-test/thread/%3C51c55b9f%241%40news.povray.org%3E/?mtop=384497
some work-rounds are suggested but I can't get them to work.

If you want to get the old behaviour you will have install v3.6 in
parallel with v3.7. You then get warnings such as:
> Shutdown Warning: The maximum gradient found was 29.821, but max_gradient of the
>  isosurface was set to 10.000. The isosurface may contain holes! Adjust
>  max_gradient to get a proper rendering of the isosurface.

If you're running Windows, I can't help with installing 3.6 along with
3.7; if, however, you're running Linux it's easy:
1. Download v3.6 source
2. ./configure, make but don't make install.
3. cd /usr/local/bin; sudo mv povray povray37
4. Return to your 3.6 source directory
5. sudo make install
6. cd /usr/local/bin; sudo mv povray povray36
You now have povray36 and povray37 as commands. Simples!

John
-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

From: William F Pokorny
Subject: Re: Isosurface problem
Date: 30 Jan 2014 07:20:57
Message: <52ea43a9$1@news.povray.org>
On 01/30/2014 07:04 AM, Doctor John wrote:
> On 29/01/14 10:30, John Greenwood wrote:
>
> John, I've realised why you are having a bit of difficulty with getting
> the max_gradient right for your isosurfaces.
>
> In v3.6, a warning was issued if you had set max_gradient too high or
> too low. In v3.7, that behaviour became broken (something to do with
> thread safety). In
>
http://news.povray.org/povray.beta-test/thread/%3C51c55b9f%241%40news.povray.org%3E/?mtop=384497
> some work-rounds are suggested but I can't get them to work.
>
>...
>
> John
>
John & John,
I believe we found previously that if you render the isosurface NOT 
wrapped in an object, the maximum gradient warning is issued in 3.7. I 
thought the idea was to document this issue, but I admit I lost track.

When you get warnings it was the case in 3.7, unless running one thread, 
the value might not be the absolute maximum seen because values are 
getting overwritten by differing threads.

Bill P.


Post a reply to this message

From: Doctor John
Subject: Re: Isosurface problem
Date: 30 Jan 2014 07:45:12
Message: <52ea4958@news.povray.org>
On 30/01/14 12:20, William F Pokorny wrote:
> John & John,
> I believe we found previously that if you render the isosurface NOT
> wrapped in an object, the maximum gradient warning is issued in 3.7. I
> thought the idea was to document this issue, but I admit I lost track.
> 
> When you get warnings it was the case in 3.7, unless running one thread,
> the value might not be the absolute maximum seen because values are
> getting overwritten by differing threads.
> 
> Bill P.

Thanks for that, Bill.

So, John, the thing is to do a test run on your (naked) isosurface
without any CSG operations then, when you've got max_gradient right,
proceed to your full CSG modified scene.

BTW Christoph Hormann has some good information regarding isosurface CSG
in http://www.imagico.de/pov/ic/index.php

John
-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

From: John Greenwood
Subject: Re: Isosurface problem
Date: 30 Jan 2014 08:35:01
Message: <web.52ea543a28c3ea73a7cafab50@news.povray.org>
Doctor John <j.g### [at] gmailcom> wrote:
> On 30/01/14 12:20, William F Pokorny wrote:
> > John & John,
> > I believe we found previously that if you render the isosurface NOT
> > wrapped in an object, the maximum gradient warning is issued in 3.7. I
> > thought the idea was to document this issue, but I admit I lost track.
> >
> > When you get warnings it was the case in 3.7, unless running one thread,
> > the value might not be the absolute maximum seen because values are
> > getting overwritten by differing threads.
> >
> > Bill P.
>
> Thanks for that, Bill.
>
> So, John, the thing is to do a test run on your (naked) isosurface
> without any CSG operations then, when you've got max_gradient right,
> proceed to your full CSG modified scene.
>
> BTW Christoph Hormann has some good information regarding isosurface CSG
> in http://www.imagico.de/pov/ic/index.php
>
> John
> --
> Protect the Earth
> It was not given to you by your parents
> You hold it in trust for your children

Thanks for all the above. I will try and digest it in the next week.

John Greenwood


Post a reply to this message

From: Alain
Subject: Re: Isosurface problem
Date: 30 Jan 2014 16:43:27
Message: <52eac77f$1@news.povray.org>

> Doctor John <j.g### [at] gmailcom> wrote:
>> On 30/01/14 12:20, William F Pokorny wrote:
>>> John & John,
>>> I believe we found previously that if you render the isosurface NOT
>>> wrapped in an object, the maximum gradient warning is issued in 3.7. I
>>> thought the idea was to document this issue, but I admit I lost track.
>>>
>>> When you get warnings it was the case in 3.7, unless running one thread,
>>> the value might not be the absolute maximum seen because values are
>>> getting overwritten by differing threads.
>>>
>>> Bill P.
>>
>> Thanks for that, Bill.
>>
>> So, John, the thing is to do a test run on your (naked) isosurface
>> without any CSG operations then, when you've got max_gradient right,
>> proceed to your full CSG modified scene.
>>
>> BTW Christoph Hormann has some good information regarding isosurface CSG
>> in http://www.imagico.de/pov/ic/index.php
>>
>> John
>> --
>> Protect the Earth
>> It was not given to you by your parents
>> You hold it in trust for your children
>
> Thanks for all the above. I will try and digest it in the next week.
>
> John Greenwood
>
>

To help speed up the rendering of isosurfaces, you can use the evaluate 
option instead of using max_gradient.

You do this as follow:

#declare min_factor=0.6; // good general satrting value

In the isosurface, where max_gradient is located, replace max_gradient 
with the following:
evaluate Found_Max_Gradient*min_factor sqrt(1/min_factor) 0.7

This will usualy make the isosurface render faster. It's very usefull if 
you #declare an isosurface and use several instances of it with slight 
variations.
Something like this (actual working code):

#include "functions.inc"
#declare Num=8;
#declare P=Num;
#declare Stp=360/Num;
#declare min_factor=0.6;
union{
#while(P>0)
		#declare Ofx=rand(R)*100;
		#declare Ofy=rand(R)*100;
		#declare Ofz=rand(R)*100;
// this shift the denting in a random fashion 
isosurface{function{-f_superellipsoid(x,y,z,0.11,0.11)+f_dents(x+Ofz,y+Ofy,z+Ofz)*0.0219}
	evaluate 1*min_factor sqrt(1/min_factor) 0.7
	contained_by{box{-1 1}}
	rotate<rand(R) rand(R) rand(R)>*360
	pigment{rgb <0.51, 0.45, 0.56>}
	scale 0.47
	translate<10,2.032,0> rotate ((Stp)*P+rand(R)*Stp/4)*y
// Add some jitter to the objects position
			photons{target reflection on}
	}
#end
finish{
	reflection{0.6 metallic}
	specular albedo 1 metallic
	roughness 0.001
	diffuse albedo 0.17
	brilliance 1.97
	irid{0.18 thickness 0.1}
	}
}
Here, the f_dents function is randomly shifted for each iterations 
making all objects different.


Alain


Post a reply to this message

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