Im working in a demo rebuild where I combine Phaser v3.85.2 and ThreeJS r169 in a 2d/3d mini game. In this case Im working on rebuilding the game and making it compatible with latest releases of each library plus adding responsive design.
Check out the jsfiddle here:
The problem Im having is that the 3D sphere gets distored when rendering:
Now, if you go to the demo code on the link below and comment out line 549, this.ball3D.renderOrder = 1;, you’ll see the 3D ball rendered correctly, but now the 3D platforms don’t render:
If you change the ThreeJS version on the importmap on the HTML to 117, the rendering order is correct even if the material for the platforms is missing:
I suspect it may have something to do with the WEBGL2 rendering update, but how can I fix it to display the sphere correctly and the platforms?
That’s correct @PavelBoytchev. Line 549, this.ball3D.renderOrder = 1;, has nothing to do with the problem. In fact, I’m almost certain the problem is the WEBGL2 update and the drop of WEBGL support, as I suspected before. To test that in the fiddle, change to version 162 on the HTML importmap, and in the JS line 611, change webgl2 to webgl1, and we get a proper render.
Version 162 is the last version to support WEBGL, after that only WEBGL2 is supported.