Skip to content

Conversation

@ThyOwen
Copy link

@ThyOwen ThyOwen commented Nov 30, 2025

Description

Alongside the rest of the initialization for subpixel_radiance, an empty MediumStack is initialized. Its behavior is conceptually similar to the existing CompositeBSDF. Media are stored in a statically allocated char pool, with pointers maintained in mediums[MaxMediums]. In processing medium closures, either HomogeneousMedium or EmptyMedium are inserted into the medium stack. There is a simple priority handling scheme that will shuffle the incumbent medium pointers to give high priority mediums lower indices. They both inherit from a shared CRTP interface, Medium. When processing BSDF closures, intersections with MxDielectric or MxGeneralizedSchlick may only be added when priority < current_priority or are both 0 (the precious priority). Attached to the MediumStack, an integrate method transmittance samples each medium and scatters using the phase function of the highest priority medium. As of now, only HenyeyGreenstein is implemented and inherits from BSDF.

With this being both a sizable update and my first commit to the project, I’m more than happy to iterate on this.

Tests

render-mx-medium-glass, render-mx-medium-vdf, render-mx-medium-anisotropic with OptiX references of the latter two. The images for render-mx-generalized-schlick-glass and render-mx-dielectric-schlick-glass have been updated as well.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format v17 before submitting, I definitely will look at
    the CI test that runs clang-format and fix anything that it highlights as
    being nonconforming.

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.

1 participant