PC.Picker not working with post effects

As soon as I enable a post effect (that alters the framebuffer ?) my pc.picker gives me no results anymore.

Late, but could be useful to others.

Post effects make your world to render into render target, instead of directly to framebuffer (which is a null render target internally)

See parameters of Picker.prepare:

This function only renders meshes rendered to specified render target, which defaults to null, and so world renders there. But post effects make this render to render target, and so they are no longer rendered by picker.

To solve this, you can specifically ask Picker to render your world layer, so it’s not skipped.

Instead of

picker.prepare(camera.camera, app.scene);

call

var worldLayer = app.scene.layers.getLayerByName("World");
picker.prepare(camera.camera, app.scene, worldLayer);

and picking is back in business.

4 Likes