Skip to content

Commit 24a74f8

Browse files
authored
[css-color-4] Corrections for Raytrace GMA #14029 (#14080)
1. Sign was wrong on delta threshold within the ray trace pseudocode: `<` should have been `>`. 2. Update gamut surface distance threshold from `1e-6` to `1e-12` which allows for better hue preservation in certain cases when using 64-bit unit types. 3. Values are presented from the 64-bit perspective, footnotes should clarify this and offer proper 32-bit values as well. This should be done for both the ray trace delta threshold and the gamut surface distance threshold. 4. Update `clip(|current|)` to `clip(|origin_rgb|)` as `current` doesn't exist in the context of the pseudocode.
1 parent 9b290fa commit 24a74f8

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

‎css-color-4/Overview.bs‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6300,8 +6300,8 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
63006300
<li>if |origin_rgb| is not in gamut
63016301
<ul>
63026302
<!-- we do, so perform chroma reduction -->
6303-
<li>let |low| be 0.0 + 1E-6 <a href="#raytrace-footnote-1"><sup>1</sup></a></li>
6304-
<li>let |high| be 1.0 - 1E-6 <a href="#raytrace-footnote-2"><sup>2</sup></a></li>
6303+
<li>let |low| be 0.0 + 1E-12 <a href="#raytrace-footnote-1"><sup>1</sup></a></li>
6304+
<li>let |high| be 1.0 - 1E-12 <a href="#raytrace-footnote-2"><sup>2</sup></a></li>
63056305
<li>let |last| be |origin_rgb|</li>
63066306
<li>for (i=0; i&lt;4; i++)
63076307
<ul>
@@ -6339,7 +6339,7 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
63396339
<li>let clip(|color|) be a function which converts |color| to |destination|,
63406340
clamps each component to the bounds of the reference range for that component
63416341
and returns the result</li>
6342-
<li>set |clipped| to clip(|current|)</li>
6342+
<li>set |clipped| to clip(|origin_rgb|)</li>
63436343
<li>return |clipped| as the gamut mapped color</li>
63446344
</ol>
63456345

@@ -6366,7 +6366,7 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
63666366
<li>let |d| be |b| - |a|</li>
63676367
<li>let |direction| <i>[i]</i> be |d|</li>
63686368
<!-- Non parallel cases -->
6369-
<li>if abs(|d|) < 1E-12
6369+
<li>if abs(|d|) > 1E-12 <a href="#raytrace-footnote-7"><sup>7</sup></a></li>
63706370
<ul>
63716371
<li>let |inv_d| be 1 / |d|</li>
63726372
<li>let |t1| be (|bmin| <i>[i]</i> - |a| ) * |inv_d| </li>
@@ -6392,7 +6392,7 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
63926392
<li>if |tnear| &lt; 0
63936393
<ul>
63946394
<li>let |tnear| be |tfar|
6395-
<a href="#raytrace-footnote-7"><sup>7</sup></a>
6395+
<a href="#raytrace-footnote-8"><sup>8</sup></a>
63966396
</li>
63976397
</ul>
63986398
</li>
@@ -6416,7 +6416,7 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
64166416
It is assumed the minimum value is 0
64176417
and that all channels have the same minimum.
64186418
The value should be small relative to the unit type.
6419-
64 bit could easily be as small as 1e-14, but 1e-6 is fine in practice.</li>
6419+
The specifed value of 1e-12 is for 64-bit, but for 32-bit, 1e-6 should be used.</li>
64206420
<li id="raytrace-footnote-2">
64216421
1.0 represents the maximum in-gamut channel value,
64226422
and it is assumed all channels have the same maximum.</li>
@@ -6438,7 +6438,10 @@ Sample Pseudocode for the Ray Trace Gamut Mapping</h4>
64386438
this simplifies to a single constant
64396439
rather than a 3-element array.</li>
64406440
<li id="raytrace-footnote-7">
6441-
favoring the first intersection in the direction |start| -> |end| .
6441+
The value should be small relative to the unit type.
6442+
The specifed value of 1e-12 is for 64-bit, but for 32-bit, 1e-6 should be used.</li>
6443+
<li id="raytrace-footnote-8">
6444+
favoring the first intersection in the direction |start| -> |end| .</li>
64426445
</ol>
64436446

64446447
</div>

0 commit comments

Comments
 (0)