Sign in to follow this  
Plerion

Selecting all visible elements in a circle

Recommended Posts

Plerion    381

Hello all

 

I have the following situation:

6NEpi.png

 

My goal is to select all visible cubes (in one of the viewports) around a certain radius of the mouse. The first part of the problem is selecting all cubes in a cylinder around the mouse which is no big deal. The main problem is how to decide if a cube is visible or if its hidden by another cube in the circle. What would you think is the most efficient way to only select the visible cubes? For the orthographic projections ist pretty easy i just need to check if theres a block in direction of the camera with its depth smaller than the one querying. But for the perspectivic projection i fail to find a good way to check for that property.

 

Any help is greatly appreciated!

 

Greetings and thanks in advance

Plerion

Share this post


Link to post
Share on other sites
timothyjlaird    599

What are your limitations? Is this WebGL?

 

Since you asked for *any* help...I just know of the older school solution of picking by making a separate frame buffer, giving each granular of geometry a unique color (in your case each cube), doing a render to that separate frame buffer, extracting all colors in the radius of your cylinder and that would tell you the cubes that were selected. I think that leaves with with a limit of 255^3 cubes per scene though...and performance would be shot to hell but it might technically work.

Edited by timothyjlaird

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this