Since someone recently asked me how to mix 2 different environments in the same material (reflections), I’m reposting the proposed solution here.
Note: For a better effect, more generally supported, it would be preferable to mix the 2 environments in a render target. But if for some reason this is not desired (for example to push the effect further (eg fake caustics or whatever)), this solution remains an interesting avenue.
The project is created with next-js, (using react), but the code for three.js is encapsulated in a dedicated module.
A very useful behavior. I have always hoped that we could get a more pluggable API for this kind of effect, which I guess the wip material nodes may address.
Have you considered implementing this as a shader injection via onBeforeCompile?
It seems to me like the actual code modification might be rather minimal, and cleanly achieved with a little surgery on a shader chunk?