I noticed that the code block that handles iridescence is missing in the CSM shader replacement for lights_fragment_begin.
It is my understanding that these 2 shaders need to be carefully kept in sync manually, due to the unfortunate nature of how the CSM constructor overwrites the property in the global ShaderChunk object here:
There has been no commit in the history of CSM’s shader around the time that got implemented in the main shader (May 25 2022). I haven’t found an issue on github or in this forum.
I can do that later, but I’ll have to take a closer look first.
Although the situation makes me a little uncomfortable. Ultimately, I want to do something very similar to this, but in a way that’s more responsible. I was hoping to find a strategy to avoid this kind of problem, or at least mitigate it.
For what it’s worth, it might make sense to merge specifically CSMs into the core library, but that is of course not an actual solution.
After a bit of a deeper dive I’m deciding not to touch this for now.
The reason is that the current version of the CSM module which is distributed with three is too far behind the original author’s version, and the original author has, (possibly among other things), included a critical bugfix in the shader (unrelated to this topic) here:
(that if is missing in three’s version, which leads to an index-out-of-bounds array access into CSM_cascades, possibly other things too).
I’m not comfortable letting these versions diverge further, as I consider aforementioned bug to be a much more pressing issue than iridescence support.