Skip to content

Conversation

@facelessuser
Copy link

@facelessuser facelessuser commented Jan 30, 2026

My suggested fix via #10579 (comment) was not the ideal fix and artificially limited tnear. This is a numerical instability issue and should be addressed as such by using an epsilon comparison to prevent rays that are too small. This corrects the fix.

I've also adjusted the algorithm to match the flow of MINDE in regardless to checking lightness before returning out of gamut colors.

I also revised the cleanup step. Since the destination is a gamut-bound space, we can clip there as we do in MINDE.

Related #10579

…section calculation

The suggested fix via w3c#10579 (comment)
was not the ideal fix and artificially limited `tnear`. This is a
numerical instability issue and should be addressed as such by using an
epsilon compare to prevent rays that are too small.

Related w3c#10579
@facelessuser facelessuser force-pushed the css-color-4/fix-raytrace branch from d55fb79 to db955e1 Compare February 2, 2026 04:51
@svgeesus
Copy link
Contributor

svgeesus commented Feb 2, 2026

@facelessuser could you please:

  1. Create a W3C account, if you don't already have one
  2. Link your GitHub and W3C accounts (the menu item "Connected accounts" on your W3C account page).

I can then make a link for an individual royalty free license commitment (for the whole Ray Trace GM, not just this specific pull request). Thanks!

@facelessuser
Copy link
Author

Excellent, I'll create an account!

- Return unbounded colors
- Return black/white if SDR lightness is exceeded.
- Then if color is out of gamut continue chroma reduction
@facelessuser facelessuser changed the title [css-color-4] Correction to ray trace to avoid throwing off our intersect calculation #10579 [css-color-4] Correction to ray trace to avoid throwing off our intersect calculation and match MINDE flow #10579 Feb 2, 2026
@facelessuser
Copy link
Author

Cool, I've made the request and also updated the algorithm to better match the CSS MINDE flow. This also addresses the concern about clipping and converting to the destination space. I've updated it to follow what CSS MINDE does.

A final note, I settled on 1E-12 for the ray size threshold. It's generally recommended either 1E-9 or 1E-12 for high precision cases in double floating point. I'm probably indifferent to whichever, as I don't think there would be a significant difference.

@facelessuser
Copy link
Author

I've made the account and linked GitHub.

@svgeesus
Copy link
Contributor

svgeesus commented Feb 3, 2026

Thanks! The request for non-participant license commitment has been sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants