You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#1 2010-08-15 13:51:06

Burr_
Member
Registered: 2010-08-15
Posts: 2

Dumping Geometry

I wrote some code to dump the geometry being rendered by the ogl renderer.

1. Get the textures being rendered by the polys and dump them
2. go through each poly for that texture
3. get the vertices, multiply with the inverse of the projection matrix
4. get the indexes for the polys
5. get the texture coordinates, multiply by invSizeX/Y, negate the one for Y

For most models this seems to work just fine, but for some cases the texturing looks mucked up, the models render just fine in the emulator, so I can only guess that it's either something i've missed that may or may not be exportable.

Just to make it clear what I'm exporting
vertices, texture coordinates, vertex indices which make up the polygons and the textures themselves and the polygons they're being drawn on.

Offline

#2 2010-08-15 17:50:09

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Dumping Geometry

where did you get the projection matrix from? that's a neat trick, since it isn't available to you when the ogl renderer does its work. i'm not sure how inverting Y helps you. keep in mind that unless you export the wrapping/clamping edge modes, some textures may be rendering wrong in your viewer.

I was going to make an exporter for our 3d viewer which isn't done yet. That would have the advantage of letting you snip out the parts of the scene which arent the model you want, and to be able to export it with the material parameters intact (rather than with the lighting baked in as your approach does). But I dunno if I'll ever finish it.

Offline

#3 2010-08-17 16:56:03

Burr_
Member
Registered: 2010-08-15
Posts: 2

Re: Dumping Geometry

I used gfx3d_glGetMatrix to get it.  When I dumped it originally, the textures turned out to be upside down, inverting the Y seemed to solve it.  The wrapping/clamping is probably the issue as some of the ones where the texturing has gone wrong it's clear that the textures have been mirrored ingame.  Would be nice if I could export those too, but I don't actually know of a format that supports it.

Offline

#4 2010-08-17 17:52:59

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Dumping Geometry

Ehh I guess that will work in some cases.  Maybe many cases.

There should be some model formats which support wrapped textures. Maybe not a convenient one.

Offline

#5 2010-12-06 08:36:49

Toasty
Member
Registered: 2010-12-06
Posts: 1

Re: Dumping Geometry

Any chance I could get a look at that code? I'd like to rip some 3D maps from a game for a database. This would be a big help.

Offline

Board footer

Powered by FluxBB