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.
var worldLayer = app.scene.layers.getLayerByName("World"); picker.prepare(camera.camera, app.scene, worldLayer);
and picking is back in business.
I’m seeing the issue with picking not working with a camera with a post effect ( if I disable the effect, picking works ).
I’ve tried the solution above, but it doesn’t work - did something change with the latest version of PlayCanvas, that requires a different solution?
Nothing obvious comes to my mind, but please do create a simple repro if you can, and create an issue here and I’ll investigate: https://github.com/playcanvas/engine/issues
I’ve just added you to my project with write access.
If you click on the pop up items, you’ll see that you can select them OK ( they should pop off ).
If you then select the camera, and turn on the script for the scanlines, you’ll notice that clicking doesn’t work.
Hope this helps narrow down the problem, and fixes it for other users too!
I managed to create a simple project showing the problem.
Steps to see the problem
1 Run the app
2 Click on the nearest plane - it should disappear
3 Stop the app
4 Select the Camera
5 Turn on the “scanlines” script
6 Run the app
7 Click on the nearest plane - the plane behind disappears.
This shows a total different Picker result, based only on enabling a postEffect
I hope this helps narrow the problem down!
Added issue: https://github.com/playcanvas/engine/issues/3093
awesome, thanks @Mal_Duffin, I’ll investigate this.
the fix is here @Mal_Duffin https://github.com/playcanvas/engine/pull/3116
it should come out with the engine release hopefully sometimes next week
That’s fantastic Martin, many thanks!