![]() |
An Architecture of 3D Interaction for Models Deformed on the GPU Doctorate work of Harlen Costa Batagelo, advised by Dr.-Ing. Wu, Shin-Ting |
||||||||||||||||||
IntroductionThis doctorate work is about the development of a software architecture for supporting direct manipulations that efficiently deal with models deformed on the GPU. This is motivated by the increasing number of applications that employ vertex and pixel shaders to deform geometry but demand accurate interactions with such models after the deformations on the rendering pipeline. The goal of the architecture is to provide basic functionalities of cursor picking and cursor snapping without requiring a copy of the 3D models to exist in system memory, i.e., the same models used for rendering are also used for interaction. This architecture provides a foundation for the development of interaction tasks which are at the same time efficient – because most part of processing for interaction is performed on the GPU – and accurate with respect to what is being actually visualized. The architecture is designed mainly for games and editors of game assets in which the user is able to perform accurate and efficient picking and snapping of meshes deformed in real-time, such as skinned mesh models, surfaces with per-vertex and per-pixel displacements (e.g., relief mapping, parallax occlusion mapping) and meshes under arbitrary deformations. The architecture produces pixel-exact results and therefore ensures that the user interacts with what he is actually seeing, even if the original model submitted to the rendering pipeline has a very different final appearance. Project news (2008-04-12)We are adapting the proposed architecture of interaction for supporting volume data. The goal is to allow the direct manipulation of volume data processed on the GPU and rendered as isosurfaces or direct rendering. As for surfaces, the only data necessary for this interaction are the data already stored in video memory for rendering. For volume data, these are the 3D textures containing the raw volume data and gradient data. Below is a screenshot and video of a prototype application that demonstrates snapping a cursor to isosurfaces of volume data rendered by ray casting on the GPU.
More results about interaction with volume data are available here. Thesis download
Videos
Development history and publicationsThe architecture development started in 2002 inspired by previous works on interaction via direct manipulation. In particular, the architecture followed the philosophy of the MTK (Manipulation Toolkit) project, which exploited the idea of making the processing of interaction an application-independent task. At that time, however, as we observed the fast advance of the shader languages for performing geometry modeling tasks, the problem of interacting with models deformed on graphics hardware became our main focus. The possibility of performing all the interaction computation on the GPU seemed to be the best way of both solving the problem of efficiently interacting with deformed geometry and maintaining the interaction application-independent. In 2005 we implemented the basic idea of the architecture, which comprises computing geometry attributes on the GPU after the deformations (only vertex normals at that time), storing such attributes into render targets and using them for performing picking and surface snapping on geometry arbitrarily deformed on the GPU. The work was greatly extended in 2006 in order to devise a full architecture of interaction implemented as a simple function library. Besides vertex normals, the architecture was now able to compute vertex tangents and bitangents for detail mapping algorithms. Recently, we have proposed a novel algorithm for computing elements of discrete differential geometry of 2nd and 3rd orders. This includes the tensor of curvature, tensor of curvature derivative, principal directions and principal curvatures. Such choice of attributes was the result of the analysis of several direct manipulation tasks which showed that differential geometry attributes and user-defined attributes for each surface point suffice for most interaction tasks using a 2D cursor.
FeaturesThe basic idea of the architecture is to use the actual rendering pipeline to compute all the attributes necessary to perform fundamental direct manipulation actions (picking and snapping). The architecture does that by rendering the objects of interest onto off-screen buffers in additional render passes, using a set of shaders that compute the required attributes. The objects of interest are the objects that the user may interact with, and are the same objects used for the actual rendering. Instead of producing an image for visualization, the pixels of the render targets will be written with color-encoded geometry attributes of the mesh (e.g., position, normal vector and curvatures). The contents of these off-screen buffers are read back by the CPU and the geometric information is made available to the application. The application is responsible for actually using the geometric data for performing the interaction task. The current version of the architecture has the following features:
EfficiencyThe process of performing a picking interaction task by rendering the geometry to an off-screen buffer and then reading back its contents from a single pixel is way faster than evaluating an algorithm of ray-triangle intersections on the CPU. This favorable result is mainly due to the higher stream processing power of today’s GPUs compared to CPUs. The required additional render passes are usually very efficient since only a quite small screen area is relevant to the application (normally a single pixel). For that reason, the CPU stalls due to reading back the render targets are negligible for most cases. Our architecture uses the model already in video memory to perform all the computations, while the traditional intersection test on the CPU requires a copy of the model in system memory. On the other hand, our architecture require additional video memory if the model is deformed in real-time. This is because the attributes of each model are stored as vertex textures. Floating point textures are used to store vertex positions, vertex normals and other attributes computed on the GPU. The application may take advantage of such additional data and use them for the actual rendering. The efficiency test results presented in the thesis were obtained using a graphics card NVIDIA GeForce 8800 GTX. The same tests running on a GeForce 6200 and GeForce 7900 GTX are available below:
DownloadThe architecture is provided as a small C++ library and a set of SM 3.0 shaders. The library contains two classes: CIntManager and CIntObj. In the header file of CIntManager, one of the directives #define D3D9 or #define OGL2 should be uncommented in order to compile for Direct3D 9 or OpenGL 2.0 (using GLEW). Simply compile and link your project with the source files. The set of SM 3.0 shaders (in FX or GLSL format depending on the API used) are used by the library during runtime. LicenseThe library and sample code are released under the LGPL license: Copyright (C) 2007 Harlen Costa Batagelo AcknowledgmentsThis project was supported by the National Research Council (CNPq) under the grant number 141685/2002-6 and The State of São Paulo Research Support Foundation (FAPESP) under the grant numbers 1996/0962-0 and 03/13090-6. |
|||||||||||||||||||