Refraction with IBL

Hi,

I have implemented the ability to use equirectangular EXRs in my program by using the approach outlined in this example: https://threejs.org/examples/webgl_materials_envmaps_exr.html

After trying to render glass material with refraction and digging deeper though the shader code of the above example it looks like it always assumes reflection mapping. I have played with the shader code to try to get it to do refraction, but all attempts have been unsuccessful so far.

Am I missing something and it’s simpler to do than I think or does it require writing an extensive amount of shader code to achieve the following result, but with equirectangular EXR:
https://jsfiddle.net/antonbagayev/2pxtwqne/42/

Thank you!

Um, I don’t understand your fiddle. Why have you set the opacity value of the second material to 0?

CubeRefractionMapping: https://jsfiddle.net/amjfqL82/
CubeReflectionMapping: https://jsfiddle.net/uw2gpvye/

Sorry, in my jsfiddle I simply meant to highlight just the refraction material. I forked your example and changed some parameters. My point is - can I achieve the same refraction results, but with the EXR environment map example above (https://threejs.org/examples/webgl_materials_envmaps_exr.html). That one uses EquirectangularToCubeGenerator, then PMREMGenerator and lastly PMREMCubeUVPacker that in the end produce a CubeUVRenderTarget that when assigned as envMap to material produces same results as for CubeUVReflectionMapping. Setting mapping of texture for that CubeUVRenderTarget to CubeUVRefractionMapping makes no difference, as I think the main logic for how the environment map gets applied to the model lives in the shader codes of the above 3 classes. My experiments with changing the shader code of these 3 classes didn’t yet produce satisfactory results. And I am wondering if I am even on the right pass.