Selection tests for 3d level editor

Started by
5 comments, last by Erik Labree 23 years, 8 months ago
Hello there, I''m doing some research for designing a 3d level editor. Something like WorldCraft, UnrealEd or 3dS. The topic i would like some feedback about is how do you find the right polygon when someone selects it with his mouse pointer in the viewport. I could think up 2 solutions: 1) Make some kind of Z-buffer but don''t store the Z-value of the pixel but instead store a unique id of the polygon to wich the pixel belongs in the buffer. So when a user clicks in the viewport you determine the right screencoords and retrieve the unique id from the buffer and then search for the right polygon. 2) Shoot a ray in (camera space) from 0,0,0 through the viewport (where the user clicked the mouse) and test wich polygon gets hit first. Is this the way it''s done? Are there other ways to do it? Which is best? Thanks for your time... Erik Labree
Advertisement
are u using gl if so use the selection buffer
shooting a ray works well. if you have some kind of space division it''ll make it much quicker instead of testing every polygon in the world.
oops that was me..
you could do the z-buffer thing too. i''d imagine if you do it right there will be barely any speed loss
-werdup-
Hello all,

Zedzeek - Thanks for pointing out that OpenGL already has an implementation to support selection. I''ve looked into it and it might work well. Did you use it for your "World Builder" ?
But i rather not commit my self to an API yet and handle it myself.

shmaLbus - Yeah, i think i''ll use the ray method.

Thanks Erik


yes i did, selection is more accurate than shooting rays ( u can select an area and find out all the objects contained within it) but u have to read data from the card which can slow the program down
zedzeek - I already use OpenGL for 3d graphics so i'm gone give it a shot. You confinced me.
You said "have to read data from the card". Isn't it implemented in software?

Thanks.



Edited by - Erik Labree on August 22, 2000 10:24:23 AM

This topic is closed to new replies.

Advertisement