Updating WaterShader.js to r102: the renderTarget argument has been removed.

Freeciv-web uses Three.js to render the 3D WebGL version: https://github.com/freeciv/freeciv-web
I recently updated from Three.js r99 to r102, and got this error message in the rendering code for water:
THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.

Freeciv-web uses WaterShader.js from an earlier Three.js version, perhaps r95, here:
https://github.com/freeciv/freeciv-web/blob/develop/freeciv-web/src/main/webapp/javascript/webgl/libs/WaterShader.js

I have tried to update WaterShader.js to the Three.js r102 “way of doing things”, here: freeciv/freeciv-web@c5c37f2
The water is rendered, but the reflections in the water are not rendered.

I see the migration guide here: https://github.com/mrdoob/three.js/wiki/Migration-Guide#r101–r102
However, I don’t fully understand how to apply this migration guide to WaterShader.js, and need help with it.

So what is the proper way to “upgrade” WaterShader.js, so that it works in Three.js r102?
Thanks!

Author: Fantashit

2 thoughts on “Updating WaterShader.js to r102: the renderTarget argument has been removed.

Comments are closed.