question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebGLRenderTarget: .clone() does not clone framebuffer/texture data.

See original GitHub issue
Description of the problem

When cloning an equirectangular CubeTexture the result is a black texture. The same operation does work with a CubeTextureLoader loaded texture (with 6 images).

grafik No map after clone()

Three.js version
  • Dev
  • r117
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Resolved

When using refraction for an equirectangular texture with EquirectangularRefractionMapping, using it as a background does not work, an the mapping has wrong seams. For CubeTextureLoader with CubeRefractionMapping both of that works (see cubemap refraction).

grafik wrong background rendering & seam

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Sep 24, 2022

The clone() methods in three.js turned out to be problematic in various classes. They work well with math primitives but cloning more complex objects is problematic since it is not always possible to replicate the “correct” object state. This is especially true for render targets. After reconsidering this issue, it’s just not feasible to copy framebuffer data for cloned render targets. So WebGLRenderTarget.clone() just creates a new render target with the same configuration but not with copied data.

0reactions
JohannesDemlcommented, Jun 10, 2020

I guess I would prefer to report a warning in this case.

Sounds like a good solution. I agree, that it is kind of strange that it works.

For me the only valid feature request of this issue is the ability to clone render targets. Yes, I’m with you on that. Thanks for pointing me in the right direction with the mapping type. The docs are missing that description, I will add that today 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

three.js - Can't clone() Texture - Stack Overflow
TextureLoader().load() sets the needsUpdate flag for you, while cloning does not. Do this, instead var texture2 = texture1.clone(); texture2.
Read more >
Material#clone – three.js docs
Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower...
Read more >
Object3D - Verge3D User Manual - Soft8Soft
An object that can be used to store custom data about the Object3D. It should not hold references to functions as these will...
Read more >
THREE.js base for shadow testing - Unsaved project - Plunker
Vector3( 0, 1, 0 ) ); var quatInverse = quat.clone().inverse(); var lastPosition = new ... InstancedBufferGeometry but hardware does not support extension ...
Read more >
Team:Munich/Hardware/threeJS - iGEM 2018
clone : function () { ... this method does not support reflection matrices ... WebGLRenderTarget.prototype = Object.assign( Object.create( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found