0

I'm fighting some unexpected behavior.

It seems that i can't get anything to render to target.

renderer.render( scene , cam , renderTarget , false ); // does not work, empty target

either one of these though, will fill the target, this one though renders to frame buffer once

renderer.render( scene , cam , renderTarget , false );
renderer.render( scene , cam ); //this somehow causes the renderTarget to be filled

or this:

renderer.setRenderTarget( renderTarget );
renderer.render( scene , cam , renderTarget , false );
renderer.setRenderTarget( null );

What am i doing wrong?

pailhead
  • 5,162
  • 2
  • 25
  • 46

1 Answers1

0

This is how I render to a THREE.WebGLRenderTarget:

var pickingScene = new THREE.Scene();
var pickingTexture = new THREE.WebGLRenderTarget(renderer.domElement.clientWidth, renderer.domElement.clientHeight);
pickingTexture.texture.minFilter = THREE.LinearFilter;

renderer.render(pickingScene, camera, pickingTexture);
Hasan
  • 2,444
  • 3
  • 30
  • 44
  • Thats how it should work. but mine doesnt, which version is this? – pailhead Aug 09 '16 at 18:25
  • @pailhead that works on r79 and r78. What errors are you getting? – Hasan Aug 09 '16 at 18:27
  • it just doesnt work, i don't get any errors but i don't get data in the texture. It's mostly failing with the PMREM generator, i have to add the stuff from the question. I get that another draw call fixes it and forces it to be rendered, but i don't understand why. The source seems to be handling this correctly, i have no idea why making these calls manually fixes it. – pailhead Aug 09 '16 at 18:32