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

Created on 19 Mar 2019  路  2Comments  路  Source: mrdoob/three.js

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: https://github.com/freeciv/freeciv-web/commit/c5c37f2e928af78d7035a7d21911b47ccb8b41a4
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!

Question

Most helpful comment

Thanks!

For those interested, the results can be seen here: https://www.freecivweb.org/

The commit is here: https://github.com/freeciv/freeciv-web/commit/dcf12ff42d79b50e1635ebafd7a63e2f1f78cf6b

All 2 comments

You also have to update THREE.Reflector and THREE.Refractor. By using the latest version of all related files, there should be (hopefully) no problems. As you can see here, the official demo works without any warnings: https://threejs.org/examples/webgl_water

Thanks!

For those interested, the results can be seen here: https://www.freecivweb.org/

The commit is here: https://github.com/freeciv/freeciv-web/commit/dcf12ff42d79b50e1635ebafd7a63e2f1f78cf6b

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

zsitro picture zsitro  路  3Comments

jack-jun picture jack-jun  路  3Comments

jlaquinte picture jlaquinte  路  3Comments

makc picture makc  路  3Comments