0

In my scene i have a glowing cube. Firstly, i render the cube on a texture and then render the texture applying gaussian blur post processing. In this way i get the result right when i am not in VR mode. Here it is -

enter image description here

But when i go to VR mode, it gives me distorted result. Please check the following image - Please ignore the lines and dots

Can anyone please tell me why is happening? Do i have to make any adjustment to render on texture for VR mode?

Update:

My code is like this -

function render() {
    generate_blur_texture();
    effect.render(scene, camera);  
}

var rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat});
var rtTextureFinal = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat});

function generate_blur_texture() {
    // i think the key point is, i am using `renderer` here instead of 'effect'
    renderer.render(scene, camera, rtTexture, true);
    // then further rendering on rtTexture and rtTextureFinal (ping pong) to   generate blur, this time i only draw a quad to sample from the texture

    // ultimately, rtTexture contains the blurred texture
}

Three.js Revision: 77

Rasheduzzaman Sourov
  • 1,375
  • 2
  • 15
  • 36
  • can you add a code-example (ideally working) that shows this behaviour? There are far too many possibilities to answer your question as it is. (Just from a first glance, it looks like the blur is somehow not taking the different viewport-dimension into account) – Martin Schuhfuß Sep 27 '16 at 14:20
  • @MartinSchuhfuß I have updated the post with some code representing what i am doing. Please let me know if you need more code. Thanks – Rasheduzzaman Sourov Sep 27 '16 at 14:32
  • that doesn't really help very much. Where and how is the blur-texture used, how is it rendered (which shader are you using)? (side-note: as you just generate a texture, it's totally fine to just use `renderer.render()`, no problem there. – Martin Schuhfuß Sep 27 '16 at 14:43

0 Answers0