PeapBoy 20 Report post Posted October 13, 2017 Hello, When cloning a material - say, a BABYLON.StandardMaterial -, everything is fine except for renderTargetTexture. PG: https://playground.babylonjs.com/#BLG0FL material.clone() function calls renderTargetTexture.clone() function. But renderTargetTexture.clone() function creates a new empty RenderTargetTexture with the same properties. Btw, I'm sure that adding "scene.customRenderTargetTextures.push()" at the end of the clone function would resolve this issue. But I don't think that people want to create a new RTT each time they clone a material (it would kill the app, especially on iOS devices). Not sure about which behaviour adopt here, any idea ? Thanks ! Quote Share this post Link to post Share on other sites
Deltakosh 4315 Report post Posted October 13, 2017 Actually we should not clone the renderTargetTexture and let the use do it manually. So perhaps the fix here is just to block the clone of the RTT Thoughts? Quote Share this post Link to post Share on other sites
PeapBoy 20 Report post Posted October 13, 2017 I agree. I could do this on monday if you want. Quote Share this post Link to post Share on other sites
Deltakosh 4315 Report post Posted October 13, 2017 please Quote Share this post Link to post Share on other sites
PeapBoy 20 Report post Posted October 16, 2017 First I wanted to add a new propertyType to handle this but we cannot anticipate if a diffuse/reflection/whatever texture will be - or not - a RTT. So I just check sourceProperty.isRenderTarget in clone function. Quote Share this post Link to post Share on other sites
aWeirdo 339 Report post Posted October 16, 2017 @PeapBoy Nice catch, sorry to complain, but my OCD hurts my brain when switch cases aren't ordered from lowest to highest Quote Share this post Link to post Share on other sites
PeapBoy 20 Report post Posted October 16, 2017 Is it better like this ? 1 aWeirdo reacted to this Quote Share this post Link to post Share on other sites
aWeirdo 339 Report post Posted October 16, 2017 Much, cheers Quote Share this post Link to post Share on other sites