Camera Pick

Blitz3D Forums/Blitz3D Programming/Camera Pick

Makepool(Posted 2004) [#1]
I'm using camera pick in my game but I get quite long times for the camera pick (15-20 milliseconds) on a 3Gh computer, is there any way to reduce this? I also notice that it changes quite noticeably as the camera rotates around the level. Anybody know what I can do to remedy these problems?


DJWoodgate(Posted 2004) [#2]
Reduce the numbers of entities and/or polys that can be picked. Do not pick every frame. Use a faster pick method, Speed is, fastest to slowest, sphere, box, poly - as might be expected. Be cautious picking meshes with constantly changing vertex data due to the time it takes blitz to generate an optimised representation for lookup.


Ross C(Posted 2004) [#3]
Try not to pick things that are too far away also. Try using linepick so you have control over the pick length :o)


big10p(Posted 2004) [#4]
15-20 millisecs??? :O How many picks are you doing per frame, exactly?


Makepool(Posted 2005) [#5]
One


Ezbe(Posted 2005) [#6]
Use a LOT smaller scale to reduce the length of picks. It would be a nice feature if you could set the 'stepping' for picks.


Makepool(Posted 2005) [#7]
Thanks for the feedback, I did some tests based on your recommendations and I can tell you that reducing the length of the linepicks does virtually nothing, the long pick times are due to the complexity of the objects that are pickable and I really can't compromise my models detail without reducing the quality of the scene so instead I plan to implement a system where when objects are not visible their entitypickmode is set to 0 and only turned on again when they come back on screen. Tests suggest this should work quite well and it's the only way I can think off to reduce the pick time.


DJWoodgate(Posted 2005) [#8]
Here is another possible optimisation that Halo suggested yonks ago. Make them all sphere pickable. Way faster. Then switch only the one hit to poly and pick again. This may miss and hit another sphere, in which case temporarily turn off picking for the false positive and pick again. Repeat down the pick line until you get a poly hit or a sphere miss. It is easy to determine if some spheres are so close to the camera that you need to immediately do a poly pick on them. You may consider an intermediate box pick stage as well, it is still a lot faster to pick boxes that high poly models, and I guess whether you do this would depend on the individual model complexity and how well it is contained by a sphere versus a box.


Ross C(Posted 2005) [#9]
Or, create a less detailed version of the mesh, and pick that, instead of the high detail mesh. Keep the picking mesh invisible, via EntityAlpha.