How to do Picking via IdMapping in Scenejs?

191 views Asked by At

We have ONE huge Json Mesh like this which we render with scenejs:

{"vertices":[
0.0, 0.0, 0.0,
0.0, 0.0, 2.0,
1.0, 0.0, 2.0,
0.0, 2.0, 2.0, //... next object
],
"normals":[
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0, //... next object
],
"colors":[
1.0, 0.0, 0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
0.0, 0.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, //... next object
],
"idMapColors":[
0.0, 0.0, 0.0, 0.756,
0.0, 0.0, 0.0, 0.756,
0.0, 0.0, 0.0, 0.756,
0.0, 0.0, 0.0, 0.756, //... next object
]}

The idMapColors are unique for each "object" and can be converted into an id to provide additional information.

We now want to render the mesh with normal colors on screen and with idMapColors in a second rendering path. We than want to read out the color value in the second FrameBuffer (for idMapColors) at a specific Point(Mouse Position).

How to do this in Scenejs? We could render the idMapColors to a Framebuffer, but how to access its data?

On the wiki at https://github.com/xeolabs/scenejs/wiki/frameBuf we found that picking is in further work, is there any possibility to do this at the moment?

0

There are 0 answers