POV-Ray : Newsgroups : povray.unix : FYI. Watch out for bad color to grey value conversions. : FYI. Watch out for bad color to grey value conversions. Server Time
7 Dec 2021 14:30:20 EST (-0500)
  FYI. Watch out for bad color to grey value conversions.  
From: William F Pokorny
Date: 29 Jan 2021 12:57:43
Message: <60144c97$1@news.povray.org>
I'm going to blame the couple of you reviving a dormant thread about 
color to grey conversions for this! Always knock on wood after 
mentioning a feature... ;-)

For those compiling versions of POV-Ray v3.8, be on the look out for 
issues with the color to grey conversions. Issues which might affect 
more than .grey, .gray functionality, though that's where I picked up 
the problem.

The following code:

//---
#version 3.8;
global_settings { assumed_gamma 1.0 }

#declare Color = rgb <0.0,1.0,0.0>;
#declare FnP = function { pigment { Color } }
#debug concat("\n\nred  = ",str(Color.red,2,3)," \n")
#debug concat("green  = ",str(Color.green,2,3)," \n")
#debug concat("blue  = ",str(Color.blue,2,3)," \n")
#debug concat("filter  = ",str(Color.filter,2,3)," \n")
#debug concat("transmit = ",str(Color.transmit,2,3)," \n")
#debug concat("gray  = ",str(Color.gray,2,3)," \n")
#debug concat("grey  = ",str(Color.grey,2,3)," \n")
#debug concat("\nFnGray  = ",str(FnP(0,0,0).gray,2,3)," \n")
#debug concat("FnGrey  = ",str(FnP(0,0,0).grey,9,16)," \n")

// .hf ?
// Most sensitive to red ?  Using all three channels or?
#declare FnHf = function { FnP(0,0,0).hf }
#debug concat("FnHf  = ",str(FnHf(0,0,0),9,16)," \n")

//Sanity check not something aside from .grey
#debug concat("FnVal0  = ",str(0.9876,2,3)," \n")
#debug concat("FnVal1  = ",str(0.98761,9,-1)," \n")
#debug concat(" ","\n\n")
//---

should generate:

red  = 0.000
green  = 1.000
blue  = 0.000
filter  = 0.000
transmit = 0.000
gray  = 0.589
grey  = 0.589

FnGray  = 0.589
FnGrey  = 0.5890000000000000
FnHf  = 0.0039062470588235
FnVal0  = 0.988
FnVal1  =  0.987610

but the gray/grey values reported are wrong (for as right as they get) 
for recent code versions and compiles.

First, thought it must be something in my povr changes because I have a 
v38 compile done on New Year's Eve which works. After chasing ghosts for 
the better part of a day, I finally tried re-compiling v3.8 master again 
and to my surprise it too now fails.

I've since found a commit at c341c943 which works and a commit 5219e71c 
(1) that fails - with 15 commits between. I should be able to zero in on 
the issue, but unless I get lucky, it will take time.

(1) - Nine before Christoph's last v3.8 commit.

My guess at the moment is there is some dependency which changed in a 
way breaking code. In broken versions, I don't seem to reach the 
conversion code. Clang++ compiles mirror the g++ behavior.

FWIW! Expect it very much hit or miss whether - or when - others might 
see this issue. Be aware of it. I'm unsure of the scope beyond the 
.grey/.gray feature and using Ubuntu 20.04.1.

Bill P.


Post a reply to this message

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