POV-Ray : Newsgroups : povray.beta-test : Finish block dispersion handling. v3.8 (and v3.7). Server Time
8 Oct 2024 17:14:23 EDT (-0400)
  Finish block dispersion handling. v3.8 (and v3.7). (Message 1 to 6 of 6)  
From: William F Pokorny
Subject: Finish block dispersion handling. v3.8 (and v3.7).
Date: 1 Jul 2021 07:37:40
Message: <60dda904$1@news.povray.org>
Expect not much of an issue given how long it's been this way, but, FWIW...

---
For backward compatibility we support some interior keywords in the 
finish block too. The related finish variables are Temp_Caustics, 
Temp_IOR, Temp_Dispersion and Temp_Refract.

The documentation doesn't indicate dispersion was ever previously 
supported for the finish block, but we have partial code for it.

The finish block parsing is missing for Temp_Dispersion. User's having 
scenes with finish block dispersion get syntax errors.

Taking the ior as being specified in the finish block, if a user were to 
specify dispersion in the interior block, as our documentation 
indicates, they get confusing results due this code in object.cpp:

if (Finish->Temp_IOR >= 0.0)
{
     Object->interior->IOR = Finish->Temp_IOR;
     Object->interior->Dispersion = Finish->Temp_Dispersion;
}

The defaulted Finish->Temp_Dispersion value (1.0) is used and the user 
has no way to override the default due the lack of finish { dispersion } 
parsing.

And, yes, users can mix the interior vs finish block definitions 
supported in both blocks in confusing ways. We don't warn that 
conflicting definitions are a problem, and, such conflicts are not 
flagged during parsing. A finish block ior>0.0 overrides any ior set in 
the interior block.

---
Aside:
The compatibility warning message when you specify, for example, ior in 
the finish block is misleading. All about backwards compatibility when 
the concern is, I believe, forward compatibility.

Index of refraction value should be specified in 'interior{...}' statement.
Use of this syntax may not be backwards compatible with earlier versions 
of POV-Ray.

Bill P.


Post a reply to this message

From: clipka
Subject: Re: Finish block dispersion handling. v3.8 (and v3.7).
Date: 1 Jul 2021 09:27:57
Message: <60ddc2dd$1@news.povray.org>
Am 01.07.2021 um 13:37 schrieb William F Pokorny:
> Expect not much of an issue given how long it's been this way, but, FWIW...
> 
> ---
> For backward compatibility we support some interior keywords in the 
> finish block too. The related finish variables are Temp_Caustics, 
> Temp_IOR, Temp_Dispersion and Temp_Refract.
> 
> The documentation doesn't indicate dispersion was ever previously 
> supported for the finish block, but we have partial code for it.
> 
> The finish block parsing is missing for Temp_Dispersion. User's having 
> scenes with finish block dispersion get syntax errors.
> 
> Taking the ior as being specified in the finish block, if a user were to 
> specify dispersion in the interior block, as our documentation 
> indicates, they get confusing results due this code in object.cpp:
> 
> if (Finish->Temp_IOR >= 0.0)
> {
>      Object->interior->IOR = Finish->Temp_IOR;
>      Object->interior->Dispersion = Finish->Temp_Dispersion;
> }
> 
> The defaulted Finish->Temp_Dispersion value (1.0) is used and the user 
> has no way to override the default due the lack of finish { dispersion } 
> parsing.

Refraction settings seem to have been officially moved from `finish` to 
the then-new `interior` in POV-Ray v3.1.

Dispersion was only added later, in POV-Ray v3.5. My guess is that 
whoever added the feature has probably considered whether to extend the 
old in-finish syntax to also support dispersion, but came to no definite 
conclusion, and therefore designed the mechanism under the hood to 
easily support such an extension, but that extension never materialized.

> And, yes, users can mix the interior vs finish block definitions 
> supported in both blocks in confusing ways. We don't warn that 
> conflicting definitions are a problem, and, such conflicts are not 
> flagged during parsing. A finish block ior>0.0 overrides any ior set in 
> the interior block.

A finish block ior >0.0 does trigger a warning, which should be enough 
of an indication for anyone to notice that they're doing an oopsie. If 
they're deliberately continuing to use an entirely undocumented feature 
despite earning warnings, I'd argue that we're not their baby-sitters.

> ---
> Aside:
> The compatibility warning message when you specify, for example, ior in 
> the finish block is misleading. All about backwards compatibility when 
> the concern is, I believe, forward compatibility.
> 
> Index of refraction value should be specified in 'interior{...}' statement.
> Use of this syntax may not be backwards compatible with earlier versions 
> of POV-Ray.

The intention of the message is to say, "when you use this syntax, the 
behavior of this version may not be backwards compatible with that of 
earlier versions".

I'd be happy to hear a better phrasing.


Post a reply to this message

From: Kenneth
Subject: Re: Finish block dispersion handling. v3.8 (and v3.7).
Date: 5 Jul 2021 08:30:00
Message: <web.60e2fa31e6d4fedfd98418916e066e29@news.povray.org>
[Windows 10, running a v3.8xx 'experimental' pvengine  that piggybacks on
v3.7.0]

Both of these examples produce fatal errors:

1) Using ONLY dispersion and dispersion_samples in a finish{}block, PLUS an
interior{ior} block:

Possible Parse Error: Unmatched {
....
Parse Error: No matching }, dispersion found instead

[This warning message makes no sense, IMO]

2) Using BOTH ior and dispersion/dispersion_samples in a finish{} block, but NO
interior {} block:

Parse Warning: Index of refraction value should be specified in 'interior{...}'
statement...   Use of this syntax may not be backwards compatible with earlier
versions of POV-Ray.
Possible Parse Error: Unmatched {
....
Parse Error: No matching }, dispersion found instead

[The 'Parse Warning' part of this message seems to indicate that such syntax can
(or could) be used at some point in the past...but it completely fails in 3.8xx
-- which makes the 'backwards-compatible' part of the warning no longer
necessary or even meaningful now. In other words, how can such syntax be used at
all now if it produces a fatal error anyway? ]

----------

I tried the same constructs in v3.7.0, and got the same fatal errors and warning
messages.

If the 'dispersion' feature was newly added in v3.5-- and was apparently usable
in a finish{} block at that point(?)-- at what point in POV-ray's later
development did such syntax start causing *fatal* errors?


Post a reply to this message

From: clipka
Subject: Re: Finish block dispersion handling. v3.8 (and v3.7).
Date: 5 Jul 2021 08:39:23
Message: <60e2fd7b$1@news.povray.org>
Am 05.07.2021 um 14:25 schrieb Kenneth:

> 1) Using ONLY dispersion and dispersion_samples in a finish{}block, PLUS an
> interior{ior} block:
> 
> Possible Parse Error: Unmatched {
> ....
> Parse Error: No matching }, dispersion found instead
> 
> [This warning message makes no sense, IMO]

It does, because `dispersion` does not belong in `finish`, and never did.

> 2) Using BOTH ior and dispersion/dispersion_samples in a finish{} block, but NO
> interior {} block:
> 
> Parse Warning: Index of refraction value should be specified in 'interior{...}'
> statement...   Use of this syntax may not be backwards compatible with earlier
> versions of POV-Ray.
> Possible Parse Error: Unmatched {
> ....
> Parse Error: No matching }, dispersion found instead
> 
> [The 'Parse Warning' part of this message seems to indicate that such syntax can
> (or could) be used at some point in the past...but it completely fails in 3.8xx
> -- which makes the 'backwards-compatible' part of the warning no longer
> necessary or even meaningful now. In other words, how can such syntax be used at
> all now if it produces a fatal error anyway? ]

Using `ior` in `finish` _was_ valid official syntax at some point, and 
you only get a warning for it. Using `dispersion` alongside of it has 
_never_ been valid in `finish`, and you get an error for even trying.

> If the 'dispersion' feature was newly added in v3.5-- and was apparently usable
> in a finish{} block at that point(?)-- at what point in POV-ray's later
> development did such syntax start causing *fatal* errors?

Refraction parameters had been deprecated in `finish` even before 
`dispersion` was added to the set of refraction parameters. Using the 
latter in `finish` would _always_ have raised a fatal error: Originally 
because `dispersion` wasn't a thing at all, and later because once it 
became a thing, refraction parameters in `finish` had already ceased to 
be a thing.


Post a reply to this message

From: Kenneth
Subject: Re: Finish block dispersion handling. v3.8 (and v3.7).
Date: 5 Jul 2021 09:15:00
Message: <web.60e3059be6d4fedfd98418916e066e29@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 05.07.2021 um 14:25 schrieb Kenneth:
>
> > 1) Using ONLY dispersion and dispersion_samples in a finish{}block, PLUS an
> > interior{ior} block:
> >
> > Possible Parse Error: Unmatched {
> > ....
> > Parse Error: No matching }, dispersion found instead
> >
> > [This warning message makes no sense, IMO]
>
> It does, because `dispersion` does not belong in `finish`, and never did.

Hmm. It would be nicer for us plebeians if the message said, "The dispersion
keyword is not allowed in a finish block. Use it in an interior block instead."

Basic yet informative! :-)  Those "Unmatched brackets..." warnings seem to be
'generic' at times IIRC, causing me to scratch my head in wonder.

> Using `ior` in `finish` _was_ valid official syntax at some point, and
> you only get a warning for it. Using `dispersion` alongside of it has
> _never_ been valid in `finish`, and you get an error for even trying.
>

Aha! My methodology was wrong. Thanks.


Post a reply to this message

From: clipka
Subject: Re: Finish block dispersion handling. v3.8 (and v3.7).
Date: 5 Jul 2021 11:08:39
Message: <60e32077@news.povray.org>
Am 05.07.2021 um 15:14 schrieb Kenneth:

> Basic yet informative! :-)  Those "Unmatched brackets..." warnings seem to be
> 'generic' at times IIRC, causing me to scratch my head in wonder.

Yes, that's why they're categorized as "possible parse error", rather 
than "parse error".

Essentially, that's POV-Ray saying, "I've encountered _something_ I 
haven't expected here at all; did you perhaps forget a closing `}`? No? 
Well, then never mind, and let's see what other complaints I may raise 
that might be more helpful."


Post a reply to this message

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