ERROR: 0:527: 'assign' : cannot convert from 'const int' to 'highp float'

An error is reported when I load the page for the first time.
Then, I refresh the page again, and the model can be loaded normally without errors.
Then, I press “ctrl+f5” again, and an error appears.

 THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false

Program Info Log: Fragment shader is not compiled.
FRAGMENT

ERROR: 0:527: 'assign' : cannot convert from 'const int' to 'highp float'
  522: 		}
  523: 		uv.x += face * faceSize;
  524: 		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  525: 		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  526: 		uv.x *= CUBEUV_TEXEL_WIDTH;
> 527: 		uv.y *= CUBEUV_TEXEL_HEIGHT;
  528: 		#ifdef texture2DGradEXT
  529: 			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  530: 		#else
  531: 			return texture2D( envMap, uv ).rgb;
  532: 		#endif
  533: 	}

There is model loading in my code, and the material of the model is changed to MeshPhysicalMaterial.
Or is it caused by the following code?

this.scene.environment = new RGBELoader().load('imgs/lantian_1.hdr');
this.scene.environment.mapping = THREE.EquirectangularReflectionMapping;
        

Can you try loading the env map like so:

const loader = new RGBELoader();
this.scene.environment = await loader.loadAsync('imgs/lantian_1.hdr');

You probably have to refactor your code a bit so you can use the async/await syntax.

1 Like

yes,you are right!
In non asyn state, many situations will lead to errors!

and , i find other way :

loader.load(‘url’,function(envMap){
… …
})