Warning when using a shader as texture



I’m getting a warning from three.js - “THREE.WebGLRenderer.setTexture2D: don’t use render targets as textures. Use their .texture property instead.” and this is the code that’s causing the issue, a shader that’s applied to a mesh:

water = new THREE.Water( renderer, camera, scene, {
    textureWidth: 256,
    textureHeight: 256,
    waterNormals: waterNormals,
    side: THREE.Backside,
    sunColor: 0xfcffb9,
    waterColor: 0x01293e,
    distortionScale: 100
 } );

 seaMesh = new THREE.Mesh( new THREE.CircleGeometry( 6000, 20 ), water.material );

The shader used is water-matrial.js from here: https://github.com/jbouny/ocean

I’ve compared the code in the demo with the shader with my own code and both match but I’m using three.js 0.93.0, it’s using 0.72.0. What’s the issue and how do I fix the warning?


I suggest you use the code from the official example: https://threejs.org/examples/webgl_shaders_ocean

It works with the latest three.js version (R98) without warnings. The implementation is also from the same author.


I’ll take a look but still curious as to what the issue is as there is only one warning I couldn’t eliminate. Thanks.