Semantic Pointing for Object Picking in Complex 3D Environments
by Christian Kössler and Felix Kreuzer
|
This Project adds Semantic Pointing support to the "The Vengeful Hand of God" Game by Christian Kössler.
The Code-Documentation at hand does not cover the Source code of the Game itself, but merely a c++ class containing helper functions exclusively related to the semantic pointing task and the games' pre-existing functions which had to be modified in order to support semantic picking.
The game starts with a welcome screen explaining all the controls and the rules of the game. Use F1 or click the left mouse button to hide the welcome screen and start the game.
We also provide controls for semantic pointing related options:
The game was tested on NVIDIA GPUs exclusively.
We basically followed the ideas presented in the paper :
Adaptive Pickbuffer Region
The pickbuffer lookup regions size varies depending on the cutoff distance. We chose this approach because once the cutoff distance is reached, the scaling functions have no effect anyway. The scalable pickbuffer region also comes in handy when using the bubble cursor since its' activation region can be scaled.
Nearest pickable object distance computation
Instead of the Quadtree- based approach we implemented two custom search algorithms:
naive pickbuffer search algorithm
We sample each pixel in the pickbuffer window and save the object with the lowest euclidean distance to the mouse cursor.
"cicular" pickbuffer search algorithm
We start sampling pickbuffer values in the 8-neighborhood around the mouse cursor and grow the search region outwards until we find an ID. This algorithm performs better in scenes with lots of pickable objects which is often the case in the game.
We dismissed the quadtree-based pickbuffer search, because in our context the scene keeps changing all the time. Building and updating the quadtree would obviously cost a lot of computation time. Our approaches mentioned above do not contribute negatively on the fps.
Linear/Inverse scaling functions
The method PickingHelper::scale_by_distance calls either the linear scaling function in PickingHelper::mouse_scale_linear or the inverse scaling function in PickingHelper::mouse_scale_inverse depending on the value of the switch PickingHelper::m_useLinearScaling . The functions are used to scale both mouse speed and mouse cursor size.
Bubble Cursor
When the bubble cursor is in use, the nearest object gets highlighted and can be shot immediately, without aiming precisely. This makes the game much easier, since one can shoot like a madman and actually hit stuff. If you want to emulate the bubble cursor behaviour presented in the paper, just scale the pickbuffer region until it fills out the screen. The downside of the full-screen region is, that an object far away from the cursor center might be selected, because it's the nearest one.
The Scene class contains a method Scene::updateObjectPicking for reading and evaluating the pickbuffer and a method Scene::updateCursorPosition for updating the cursor size and position. All other functions and variables related to semantic pointing can be found in the PickingHelper class. Helper Functions for providing and reading GPU buffers are found in utility.hpp We do not provide a code documentation for the game- and render logic.
We provide a Visual Studio 2012 Solution and all the headers and libraries needed to compile the code.