Skip to content

improved the dispersion computation#9544

Merged
pixelflinger merged 1 commit intomainfrom
ma/better-dispersion
Jan 6, 2026
Merged

improved the dispersion computation#9544
pixelflinger merged 1 commit intomainfrom
ma/better-dispersion

Conversation

@pixelflinger
Copy link
Collaborator

  • Split the function so that the 3-components loop is more apparent.
  • Factored out the parts of the computation that don't depend on the index of refraction, so they're only computed once.
  • Moved the lod-from-roughness computation out of the loop as well. It does depend on the IOR, but so little that it's not worth it.

The most important result of this change is that the code is now in good shape if we wanted to change the implementation of dispersion for these cases (for e.g.) :

  • do the computation in the XYZ space
  • use more than 3 wavelengths samples
  • or use a stochastic approach, trading banding for noise

@pixelflinger pixelflinger added the internal Issue/PR does not affect clients label Dec 21, 2025
Base automatically changed from ma/dispersion-ubershaders to main December 22, 2025 18:12
@pixelflinger pixelflinger marked this pull request as ready for review December 22, 2025 19:35
@pixelflinger
Copy link
Collaborator Author

@poweifeng the renderdiff difference is just one pixel and barely visible and only for gles. I think we can accept the new image as master (I just don't know how).

@pixelflinger pixelflinger requested a review from z3moon December 22, 2025 20:20
@pixelflinger pixelflinger force-pushed the ma/better-dispersion branch 2 times, most recently from d9d8794 to 08c13a8 Compare January 5, 2026 23:50
- Split the function so that the 3-components loop is more apparent.
- Factored out the parts of the computation that don't depend on the
index of refraction, so they're only computed once.
- Moved the lod-from-roughness computation out of the loop as well. 
  It does depend on the IOR, but so little that it's not worth it.

The most important result of this change is that the code is now in
good shape if we wanted to change the implementation of dispersion for
these cases (for e.g.) :
- do the computation in the XYZ space
- use more than 3 wavelengths samples
- or use a stochastic approach, trading banding for noise

RDIFF_BRANCH=ma/better-dispersion
@pixelflinger pixelflinger merged commit 5661365 into main Jan 6, 2026
17 checks passed
@pixelflinger pixelflinger deleted the ma/better-dispersion branch January 6, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Issue/PR does not affect clients

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants