Advertisement Jump to content
Sign in to follow this  
Plerion

Selecting all visible elements in a circle

This topic is 1808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!