[osg-users] Selecting visible primitives within a region

Charlie Tan chen.qunhan at gmail.com
Wed Nov 14 23:40:40 PST 2018


Hi,

Apologies firstly for the many topics I have posted lately. I have been running into this particular problem and have been researching for a long time before deciding to post this.

Basically I am trying to do a click-and-drag selection to select all the visible faces for an editing program. 

Initially I thought of using LineSegmentIntersector to iterate over all the pixels (or every X pixels) seen in the viewport, take the first intersection and from there get a list of all primitives. But i realized that this may take up too much processing time. 

Next I thought of using PolytopeIntersector to find all primitives inside the viewport, then using the maxDistance to sort the primitives by z-order to see which of them come first, but quickly realised that it will not work conceptually (since a primitive with highest maxDistance does not imply it is necessarily occluded).

Next I have searched that there are people discussing using the method of assigning different colors to different primitives, and rendering all the primitives onto a virtual plane. From the virtual plane, get the list of colors the survives the culling, and then from there determine the primitives that survive.

Unfortunately I am not sure (if even possible) to do this in OpenSceneGraph. If anyone could point me in the right direction with some simple code, or if there is another way to better tackle this problem, it is very much appreciated.


Thanks a lot for the help!

Cheers,
Charlie

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75196#75196







More information about the osg-users mailing list