POV-Ray : Newsgroups : povray.beta-test : Isosurface: max_gradient warning? Server Time
27 Apr 2024 10:27:42 EDT (-0400)
  Isosurface: max_gradient warning? (Message 11 to 20 of 20)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Cousin Ricky
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 12:35:01
Message: <web.51c722c522807ec9540235480@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> Since I never suspected thread safety until you brought it up, I had not tried
> it with +WT1.  I just tried +WT1 with Mr. Pokorny's scene, and there was no
> warning.

A reason to keep 3.6 hanging around (at least until 3.7.1): to test isosurface
functions?

(There is at least one other reason: the crackle pattern changed in 3.7, with no
provision for backwards compatibility.  Doctor John's coderot scene renders
quite differently, for example.)


Post a reply to this message

From: William F Pokorny
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 13:13:10
Message: <51c72ca6$1@news.povray.org>
On 06/23/2013 04:27 AM, Le_Forgeron wrote:
> Le 22/06/2013 15:57, Thomas de Groot nous fit lire :
>> On 22-6-2013 10:38, Le_Forgeron wrote:
> So, I cannot duplicate the original issue, at least on the unix port.
>
>> Whatever value for max_gradient I use (too low or too high) the
>> expected warning never appears in the message window like it used to
>> do. I need it to determine the values for evaluate.
>
> The only difference is less context.
> Or is it a Windows specific issue ? (I hope not)
>
It seems to be the case the gradient warnings are only generated if the 
isosurface is naked. If it is wrapped in an object as was the case with 
my thread safety example, we get no warnings.

Inserting some comments in the IsoSurface::DispatchShutdownMessages code 
as follows:
//------------------------ code -------------
mginfo->max_gradient = max((DBL)temp_max_gradient,mginfo->max_gradient);

    cerr << "In DispatchShutdownMessages" << endl;
         if (isCopy == false)
         {
    cerr << "isCopy false" << endl;
                 FunctionCode *fn = vm->GetFunction(*(Function));

                 if (fn != NULL)
                 {
    cerr << "fn not NULL" << endl;
                         if (eval == false)
                         {
    cerr << "eval == false" << endl;
                                 // Only show the warning if necessary!
//------------------------ code -------------
it looks like the "if (isCopy == false)" does not test positive when the 
isosurface is wrapped in an object, but it does when the isosurface is 
naked.

Bill P.


Post a reply to this message

From: James Holsenback
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 14:00:11
Message: <51c737ab@news.povray.org>
On 06/23/2013 01:13 PM, William F Pokorny wrote:
> On 06/23/2013 04:27 AM, Le_Forgeron wrote:
>> Le 22/06/2013 15:57, Thomas de Groot nous fit lire :
>>> On 22-6-2013 10:38, Le_Forgeron wrote:
>> So, I cannot duplicate the original issue, at least on the unix port.
>>
>>> Whatever value for max_gradient I use (too low or too high) the
>>> expected warning never appears in the message window like it used to
>>> do. I need it to determine the values for evaluate.
>>
>> The only difference is less context.
>> Or is it a Windows specific issue ? (I hope not)
>>
> It seems to be the case the gradient warnings are only generated if the
> isosurface is naked. If it is wrapped in an object as was the case with
> my thread safety example, we get no warnings.
>
> Inserting some comments in the IsoSurface::DispatchShutdownMessages code
> as follows:
> //------------------------ code -------------
> mginfo->max_gradient = max((DBL)temp_max_gradient,mginfo->max_gradient);
>
>     cerr << "In DispatchShutdownMessages" << endl;
>          if (isCopy == false)
>          {
>     cerr << "isCopy false" << endl;
>                  FunctionCode *fn = vm->GetFunction(*(Function));
>
>                  if (fn != NULL)
>                  {
>     cerr << "fn not NULL" << endl;
>                          if (eval == false)
>                          {
>     cerr << "eval == false" << endl;
>                                  // Only show the warning if necessary!
> //------------------------ code -------------
> it looks like the "if (isCopy == false)" does not test positive when the
> isosurface is wrapped in an object, but it does when the isosurface is
> naked.
>
> Bill P.
>

I'm wondering when it was broken, or if that's the intended behavior ... 
perhaps some kind of note in the documentation /might/ be the way to go. 
Just a thought.


Post a reply to this message

From: MichaelJF
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 14:05:00
Message: <web.51c7385122807ec9fb5cc2da0@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 06/23/2013 04:27 AM, Le_Forgeron wrote:
> > Le 22/06/2013 15:57, Thomas de Groot nous fit lire :
> >> On 22-6-2013 10:38, Le_Forgeron wrote:
> > So, I cannot duplicate the original issue, at least on the unix port.
> >
> >> Whatever value for max_gradient I use (too low or too high) the
> >> expected warning never appears in the message window like it used to
> >> do. I need it to determine the values for evaluate.
> >
> > The only difference is less context.
> > Or is it a Windows specific issue ? (I hope not)
> >
> It seems to be the case the gradient warnings are only generated if the
> isosurface is naked. If it is wrapped in an object as was the case with
> my thread safety example, we get no warnings.
>
> Inserting some comments in the IsoSurface::DispatchShutdownMessages code
> as follows:
> //------------------------ code -------------
> mginfo->max_gradient = max((DBL)temp_max_gradient,mginfo->max_gradient);
>
>     cerr << "In DispatchShutdownMessages" << endl;
>          if (isCopy == false)
>          {
>     cerr << "isCopy false" << endl;
>                  FunctionCode *fn = vm->GetFunction(*(Function));
>
>                  if (fn != NULL)
>                  {
>     cerr << "fn not NULL" << endl;
>                          if (eval == false)
>                          {
>     cerr << "eval == false" << endl;
>                                  // Only show the warning if necessary!
> //------------------------ code -------------
> it looks like the "if (isCopy == false)" does not test positive when the
> isosurface is wrapped in an object, but it does when the isosurface is
> naked.
>
> Bill P.

First I can confirm Thomas issue, but I cannot remember if it was the change
from 3.6 to 3.7 or from a release candidate of 3.7 to the next as the
max_gradient warnings disappeared. My quick work around is simple: if you see
black holes: rise it. If you trace an isosurface (exspecially for camera
position) and you yield a black image you most likely dropped through a black
whole due to this issue: rise it too. This occurs for example using randomized
camera locations within Jaime's project tierra. It would be fine to have a guess
how much to rise it as we had in the past, which would save the one or other
rendering hour of course.

But what is a "naked isosurface"? Isosurfaces must be contained in a container
object. Having Poser, I only can imagine "naked" mesh objects ... ;-)

Best regards,
Michael


Post a reply to this message

From: Le Forgeron
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 15:24:00
Message: <51c74b50$1@news.povray.org>
Le 23/06/2013 20:00, James Holsenback nous fit lire :
>> it looks like the "if (isCopy == false)" does not test positive when the
>> isosurface is wrapped in an object, but it does when the isosurface is
>> naked.
>>
>> Bill P.
>>
> 
> I'm wondering when it was broken, or if that's the intended behavior ...
> perhaps some kind of note in the documentation /might/ be the way to go.
> Just a thought.

isCopy seems to be intended to avoid displaying the same warning over
and over for the same isosurface (as duplicated isosurface indeed are
not copied but reference the same sub-structure).

#declare Ob = isosurface{...}; // that's not a copy
object {Ob ... } // that's a copy

Previously (3.6.1) the warning was displayed at the destruction of the
isosurface (when the sub-structure was actually referenced by no one else)	

  if((Stage == STAGE_SHUTDOWN) && (mginfo->refcnt == 0))

In 3.7, isCopy was introduced with change 4707, 16th February 2009,
along with the change introducing means for objects to submit message on
shutdown.
It was reported in windows source with change 4714, 21th February 2009.

If the symptom "isosurface embbeded in object (CSG) does not show the
warning" is correct, it might be a "feature/bug". The parser copied the
isosurface object and deleted the original before the render started.
When the render ends, it find only copies and because the refcnt is not
used anymore (for that purpose), it miss the last remaining true data to
display.

Instead of isCopy, what about adding in mginfo a boolean
"printed_warning" (actual name should be more appropriate), set to false
on creation, and turn to true on the first call (instead of last for
3.6.1) of the warning displaying function (test for false, set to true
if false) ? (and dropping isCopy in the process)

For instance, i'm afraid the following sequence would fails with current
code:

#declare Foo = isosurface{ ... };
#declare Bar = object { Foo ... };
#undef Foo;

(or any pop of #local context, such as building the isosurface via macro
or loop, or replacing the value of a previous #declare/#local )


Post a reply to this message

From: James Holsenback
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 15:31:17
Message: <51c74d05$1@news.povray.org>
On 06/23/2013 03:24 PM, Le_Forgeron wrote:
> Le 23/06/2013 20:00, James Holsenback nous fit lire :
>>> it looks like the "if (isCopy == false)" does not test positive when the
>>> isosurface is wrapped in an object, but it does when the isosurface is
>>> naked.
>>>
>>> Bill P.
>>>
>>
>> I'm wondering when it was broken, or if that's the intended behavior ...
>> perhaps some kind of note in the documentation /might/ be the way to go.
>> Just a thought.
>
> isCopy seems to be intended to avoid displaying the same warning over
> and over for the same isosurface (as duplicated isosurface indeed are
> not copied but reference the same sub-structure).
>
> #declare Ob = isosurface{...}; // that's not a copy
> object {Ob ... } // that's a copy
>
> Previously (3.6.1) the warning was displayed at the destruction of the
> isosurface (when the sub-structure was actually referenced by no one else)	
>
>    if((Stage == STAGE_SHUTDOWN) && (mginfo->refcnt == 0))
>
> In 3.7, isCopy was introduced with change 4707, 16th February 2009,
> along with the change introducing means for objects to submit message on
> shutdown.
> It was reported in windows source with change 4714, 21th February 2009.
>
> If the symptom "isosurface embbeded in object (CSG) does not show the
> warning" is correct, it might be a "feature/bug". The parser copied the
> isosurface object and deleted the original before the render started.
> When the render ends, it find only copies and because the refcnt is not
> used anymore (for that purpose), it miss the last remaining true data to
> display.
>
> Instead of isCopy, what about adding in mginfo a boolean
> "printed_warning" (actual name should be more appropriate), set to false
> on creation, and turn to true on the first call (instead of last for
> 3.6.1) of the warning displaying function (test for false, set to true
> if false) ? (and dropping isCopy in the process)
>
> For instance, i'm afraid the following sequence would fails with current
> code:
>
> #declare Foo = isosurface{ ... };
> #declare Bar = object { Foo ... };
> #undef Foo;
>
> (or any pop of #local context, such as building the isosurface via macro
> or loop, or replacing the value of a previous #declare/#local )
>
>

Ok that explains when it happened (nice detective work btw) ... I'm 
starting to think that the isosurface documentation needs to reflect the 
change in behavior.


Post a reply to this message

From: Warp
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 15:44:15
Message: <51c7500f@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Instead of isCopy, what about adding in mginfo a boolean
> "printed_warning" (actual name should be more appropriate), set to false
> on creation, and turn to true on the first call (instead of last for
> 3.6.1) of the warning displaying function (test for false, set to true
> if false) ? (and dropping isCopy in the process)

The problem with that is that all copies of the same isosurface object
would need a shared variable, which has to be separate for all distinct
isosurface objects, unless it's enough to print a warning about one
isosurface object and ignore the rest.

-- 
                                                          - Warp


Post a reply to this message

From: Cousin Ricky
Subject: Re: Isosurface: max_gradient warning?
Date: 23 Jun 2013 21:25:08
Message: <web.51c79e9d22807ec9540235480@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> It seems to be the case the gradient warnings are only generated if the
> isosurface is naked. If it is wrapped in an object as was the case with
> my thread safety example, we get no warnings.

Confirmed.  If only I still had the concentration required to investigate
computer code.

[code]
#version 3.7;

#ifndef (MG) #declare MG = 40/9; #end
#ifndef (Naked) #declare Naked = no; #end

global_settings
{ assumed_gamma 1
  radiosity {} //force isosurface calculations from all directions
}

light_source { <-3.3125, 7.6250, -5.7374>, rgb 1 }

camera
{ location <0.0000, 1.0000, -5.6713>
  look_at <-0.7969, 1.2000, -0.0598>
  angle 10.7447
}

#include "functions.inc"

#if (Naked)
  isosurface
  { function { f_sphere (x, 0, z, (2660 - 40*y) / 9) }
    contained_by { box { <-80, 31, -24>, <-128, 56, 24> } }
    max_gradient MG
    pigment { rgb <1, 0.75, 0> }
    scale 1/128
    rotate -35 * x
    translate y
  }
#else
  #declare Test = isosurface
  { function { f_sphere (x, 0, z, (2660 - 40*y) / 9) }
    contained_by { box { <-80, 31, -24>, <-128, 56, 24> } }
    max_gradient MG
    pigment { rgb <1, 0.75, 0> }
    scale 1/128
    rotate -35 * x
    translate y
  }
  object { Test }
#end
[/code]

On the command line, try:

  declare=MG=1 declare=Naked=1

and

  declare=MG=1 declare=Naked=0

To lose the warning, I had to declare the isosurface.  Just wrapping the naked
isosurface in an object{} generated a warning.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Isosurface: max_gradient warning?
Date: 24 Jun 2013 03:04:30
Message: <51c7ef7e$1@news.povray.org>
On 23-6-2013 20:02, MichaelJF wrote:
> First I can confirm Thomas issue, but I cannot remember if it was the change
> from 3.6 to 3.7 or from a release candidate of 3.7 to the next as the
> max_gradient warnings disappeared. My quick work around is simple: if you see
> black holes: rise it. If you trace an isosurface (exspecially for camera
> position) and you yield a black image you most likely dropped through a black
> whole due to this issue: rise it too. This occurs for example using randomized
> camera locations within Jaime's project tierra. It would be fine to have a guess
> how much to rise it as we had in the past, which would save the one or other
> rendering hour of course.
>
> But what is a "naked isosurface"? Isosurfaces must be contained in a container
> object. Having Poser, I only can imagine "naked" mesh objects ... ;-)

It is an isosurface not wrapped into an object by #declare or #local. I 
can indeed confirm too that this is the true cause.

My suggestion (my 2 cents) would be to leave things as they are now, but 
to explain the behaviour in the Docs. If a user wants to test the 
max_gradient value he can write an #if #else switch like Bill did below.

Good spotting by the way by those who found the answer.

Thomas


Post a reply to this message

From: Le Forgeron
Subject: Re: Isosurface: max_gradient warning?
Date: 24 Jun 2013 03:08:20
Message: <51c7f064$1@news.povray.org>
Le 23/06/2013 21:44, Warp nous fit lire :
> Le_Forgeron <jgr### [at] freefr> wrote:
>> Instead of isCopy, what about adding in mginfo a boolean
>> "printed_warning" (actual name should be more appropriate), set to false
>> on creation, and turn to true on the first call (instead of last for
>> 3.6.1) of the warning displaying function (test for false, set to true
>> if false) ? (and dropping isCopy in the process)
> 
> The problem with that is that all copies of the same isosurface object
> would need a shared variable, which has to be separate for all distinct
> isosurface objects, unless it's enough to print a warning about one
> isosurface object and ignore the rest.
> 
From my understanding, the function is already shared (in the mginfo
sub-structure) (indeed, mginfo currently store the max_gradient and more
data too), so, if it come from the same declaration of function, it make
sense to report the warning only once. That won't solve the tricky
non-thread-safe issue on max_gradient, but would restore a behaviour
similar to 3.6.1: for each copies of the same isosurface (but
transformation & friends), display the warning only once (but at least
once).


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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