I have an effect which I currently create by layering an alpha pass overlay onto a base material using a second material pass using a shader. For a variety of reasons I’d like to consolidate this into a single material, so I used the conversion utility to convert the base standard material into a shader, then added my separate overlay code.
This works, however my scene uses a reflection probe, and the new shader material doesn’t appear to sample the reflection probe in any way.
I’d like to try adding the reflections back in myself, but it isn’t clear how. The ReflectionProbe class doesn’t appear to provide access to the texture. Shader built-ins don’t appear to provide any access, just the write-only RADIANCE and IRRADIANCE values. The rendering server has a lot of functions dealing with reflection probes, but I still don’t see a way to access the texture.
Anyone know a way to do this, or incorporate reflection probes into shaders in any way?
Sampling the (ir)radiance maps directly is not supported yet:
or incorporate reflection probes into shaders in any way?
The reflection’s visibility is determined by ROUGHNESS (sharper at lower roughness) and METALLIC (more visible at lower roughness). Higher SPECULAR values will make the reflection more visible, although only 0.5 (the default) is considered physically accurate.
Okay, so it sounds like as long as I want reflection probes to have an effect I need to stick with the multi-pass rendering.
Maybe you have a suggestion for a different workaround. One of the reasons I want to put this color overlay into the base material is that on top of all of this I do a localized heat haze effect which uses a screen reading texture. Because screen reading textures won’t sample render passes using the transparency pipeline my color overlays vanish behind the haze effect. However I haven’t figured out a way to apply my color overlay as a second pass without writing ALPHA.
I can skip the ALPHA write and write a new color completely, discarding fragments below an threshold for my overlay, but that gives a very different appearance than my desired effect, which includes both gradations in the color overlay as well as some blending with the base material underneath.
If I could somehow use ALPHA writes in my shader, but convince Godot to apply this pass before creating the screen texture it would solve my problem, if not quite as elegantly as incorporating the color overlay directly into the base material.
Well, I feel like an idiot. The compositor effect wasn’t going to be a great fit as i wanted to isolate my haze effect to specific meshes which may have other unhazed objects between them and the camera.
However I tried setting these objects render priority to a low negative number and ensuring that they hit the transparency pipeline, and the haze worked without conflict! I’m pretty sure I had tinkered with render priorities before, but may have got the ordering backwards and not realized that lower priorities come later.
Anyways, I believe my original problem is solved, if not exactly in the way I was thinking when I posted my original question. Appreciate thye suggestions in any case.