7

For a hobby project of mine involving a 3d printer I would like to capture 3d models from various computer games. The games are running on Windows and are usually using DirectX9 but there is also one which can be configured to use OpenGL.

Is there any tool / software which allows me to grab an entire scene from a running application and dump it into a file that can be converted into some popular 3d format like OBJ?

What I need is the geometry only; points, edges, polygons. I do not need textures or shader data. Is this possible at all?

CodeTwice
  • 2,756
  • 3
  • 15
  • 17

3 Answers3

4

Is there any tool / software which allows me to grab an entire scene from a running application and dump it into a file that can be converted into some popular 3d format like OBJ?

Yes, and no. It is perfectly possible to intercept the data sent to OpenGL or Direct3D. The problem is, that neither OpenGL nor Direct3D are scene graphs. They're drawing APIs, so what you end up, are bunches of drawing commands.

And those bunches are not necessarily per object or whole objects. For example drawing the character in modern games happens in multiple passes and chunks (facial animation requires much more complex shaders than the rest of the body).

Technically you can assume vertex arrays or vertex buffer objects to contain at least whole objects, so dumping objects based on glDrawElements or glDrawArrays calls and the used vertex array pointers or VBO offsets is reasonable.

Immediate mode is a showstopper though: You don't have the slightest bit of information, what's rendered when. Technically you could try some heuristics using the timing and order of the calls. But that's futile.

Is there any tool / software which allows me to grab an entire scene from a running application and dump it into a file that can be converted into some popular 3d format like OBJ?

At my local hackerspace a very rudimentary OpenGL interceptor was written for just that task. And we ran in all the problems I mentioned.

Marco A.
  • 41,192
  • 25
  • 117
  • 233
datenwolf
  • 149,702
  • 12
  • 167
  • 273
  • I do not necessarily need the data on a per-object basis, having a dump of the entire scene would be enough. But as far as I understand, the only way to do is to reconstruct the scene from historical glDrawArrays? Can I at least assume that only the current OpenGL matters? – CodeTwice Jan 04 '12 at 13:45
  • The problem is, that what you see on screen is not necessarily a coherent triangle soup (a triangle soup is just a collection of triangles sharing the same space). For example the background may use the same dimensions like the regular scene, just that it's rendered first, then the depth buffer cleared. And what I totally forgot is, that the tesselation, geometry and vertex shaders may completely alter the outcome. And if you're facing a OpenGL-3 core program you don't know what attribute is what. You'll need to tailor your dumper to the program in question to be able to extract things. – datenwolf Jan 04 '12 at 13:58
1

Direct3D 9 API Interceptor It captures textures and vertex. And handles shaders.

Echeg
  • 1,934
  • 2
  • 19
  • 25
1

glintercept and/or apitrace.

genpfault
  • 47,669
  • 9
  • 68
  • 119