I'm trying to understand how to preprocess envMaps correctly with the PMREMGenerator.
My current situation:
I create a PMREM immediately after setting up my scene, and compile its equirectangular shader (that compile step is not clear to me, but that's what I've seen in examples):
this.mPmremGenerator = new THREE.PMREMGenerator(this.mRenderer);
this.mPmremGenerator.compileEquirectangularShader();
Next, I use TextureLoader to load the envmap texture, and in its callback, I use fromEquirectangular to preprocess the envmap into a RenderTarget, and extract the new texture from it and return it.
private preprocessEnvMap(pEnvMap: Texture) {
const WorldContext.mainScene.pmremGenerator;
return aPmremGenerator.fromEquirectangular(pEnvMap).texture;
}
Finally, I take the returned texture, assign it as my material's envMap, and call the material's needsUpdate = true.
The result is that I get a shader error:
THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog No compiled fragment shader when at least one graphics shader is attached.
Help will be much appreciated,
Thanks
EDIT:
This is an example where I use the PMREMGenerator with a standard material:
https://codepen.io/tfreifeld/pen/OJWgdem
You can see that both the image in the background and in the envmap are blurry.
This is the original image: