Talk:Oni Model Extractor: Difference between revisions

ported offtop discussion from forum
(collada indeed)
(ported offtop discussion from forum)
Line 235: Line 235:
:still i think i'll implement single animation extraction just to "finish the event chain" (like they say it in esoterics - unfinished business may take your powers; actually tonight i woke up, and there was a mess in my head about extracting animations to 3ds - it was like if i was insane; actually it happens sometimes - i create different insane theories, create new dimensions, new numbers, new figures, as if i took lsd before going to bed)
:still i think i'll implement single animation extraction just to "finish the event chain" (like they say it in esoterics - unfinished business may take your powers; actually tonight i woke up, and there was a mess in my head about extracting animations to 3ds - it was like if i was insane; actually it happens sometimes - i create different insane theories, create new dimensions, new numbers, new figures, as if i took lsd before going to bed)
::[[User:Kuchumovn|Kuchumovn]] 10:10, 8 January 2008 (CET)
::[[User:Kuchumovn|Kuchumovn]] 10:10, 8 January 2008 (CET)
----
:"then you can import it to a 3d-editor and maybe flip normals for some bodyparts" It's up to you, ku4um, to detect the polygons that need to be flipped, and export them properly ;)
::[[User:Geyser|geyser]]
:i guess that face reverting can be done like this:
:[[Image:Vectors.png]]
:maybe i'll try it today
::[[User:Kuchumovn|Kuchumovn]]
:The issue is only with Oni's meshes and the way they're rendered in Oni. Basically, they're mostly using the face normals for backface culling, rather than the vertex order.
:That is what happens for character meshes and animated cutscene objects. Certain body parts are obtained by flipping existing ones, which preserves correct face normals, but flips the polygons. Same for "cloned-and-mirrored" parts of a single mesh (e.g., wheels of a car). Therefore, if you export ONCC or OBAN meshes and preserve the triangles listed in the IDXA as strips, some of them will be culled incorrectly by 3D programs. Because 3D tools typically use the vertex order for backface culling. And because Oni does not use the vertex order at all for character and "object" M3GM - it uses face normals instead. The reason why these meshes have inconsistent vertex ordering is because that order is irrelevant to Oni. The only way to fix the order is to check face normals against triangle orientation. For character M3GM, the mesh is usually flipped as a whole, but for car wheels, you have to check every triangle, because the flipping may be limited to a part of the mesh (e.g., left wheel is not flipped, and right wheel is a flipped clone).
:For powerups (and probably weapons, turrets, consoles, particles etc as well), they'not culling the backfaces, at least not according to the face normals. We know that because some face normals are just plain wrong for, e.g., powerup_shield, for example, has some messy normals, inconsistent with the layout of the polygons for some reason. There are normals pointing inwards for that one, so there is no way it can be culled based on those. Either it's not culled at all, or it's culled based on the usual vertex order (which, for powerups and weapons, is consistent). This basically means that you can export all these "minor" meshes without flipping the triangles at all. Since the normals can be wrong, just ignore them for these meshes (powerups, weapons, turrets, consoles, particles etc) and do not check them again triangle orientations.
:Other than that, your algorithm for checking normals and flipping polygons is correct. If for the "interpolated" normal you use not the (possibly wrong) normals from VCRA but your own interpolation (and preferably evaluate the vertex normals as well), then you can apply that algorithm to every face of every mesh in Oni. You can, however, spare yourself that trouble and use the above rules. For character meshes, you only have to do the checking for one face, then flip the triangles for the whole mesh if necessary. For powerups etc, never flip the triangles. For cutscene objects, do an extensive check and flip every face individually, as needed.
:The problem is just that, e.g., powerup_shield (and powerup_cell IIRC) has wrong normals (even pointing inwards), so I wouldn't recommend to handle these in the same systematic way as cutscene objects. As for the lack of a flag, you're correct, but the cutscene objects belong to the OBOA hierarchy, so you can detect them that way.
::[[User:Geyser|geyser]]
:i.e. one can check all the OBOAs in the level, and if some M3GM is not part of those OBOA M3GAs, then it is not a cutscene object?
::[[User:Kuchumovn|Kuchumovn]]
:For example, yeah. Rather than backtracking the hierarchy, you can also list the cutscene M3GM directly through the ONLV tree.
:I think the easiest way to handle this is to NOT bother detecting whether a mesh "is not a cutscene object". Here's my suggestion.
:Unnamed meshes should only be listed and exported through their respective parents (ONCC/TRBS, ONWC, TURR, CONS, etc).
:Named ones can be listed without any distinction, and viewed/exported in a silly way (no normals checking or triangle flipping).
:However, you should also allow the user to list OFGA and M3GA meshes through their respective parents (i.e., additional trees).
:When the user lists furniture/cutscene M3GM through that tree, THEN the normals will be checked before viewing or exporting.
:So you have a lazy default behaviour for standalone named meshes, and an optional, more zealous checking for "array meshes".
::[[User:Geyser|geyser]]
:i've just implemented normal flipping for ONCC - it appeared to be a 15-minute job (shorter than pating this discussion here)
:i think then i'll make normal flipping also for powerup_shield today
::[[User:Kuchumovn|Kuchumovn]] 18:25, 15 January 2008 (CET)
70

edits