Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ABC v6 export #25

Merged
merged 24 commits into from
Mar 14, 2021
Merged

ABC v6 export #25

merged 24 commits into from
Mar 14, 2021

Conversation

Five-Damned-Dollarz
Copy link

@Five-Damned-Dollarz Five-Damned-Dollarz commented Feb 14, 2021

Could use some optimization on the export still, but should be 100% functional right now.
Your armature needs to be rotated [90, 0, 0], and scaled [-1, 1, -1] for the export to look correct.
You need to "calculate inside" in Blender to wind the triangles correctly (at least that's what has worked reliably for me).

Known Issues

  • Using scaling will export incorrect bounding boxes.

Complete

  • Geometry, normals, UV map
  • Skeletal animation
  • Vertex animation
  • Bounding boxes

In Progress

Not Started

  • Lithtech 1.5 TransformInfo

Added frame timing fix for vertex animations, but Blender is not equipped to separate them into actions, so they just get all mixed together in the same lane.
…t works and we can separate actions.

Has a small issue where the first frames of each animation can kind of merge.
…erging of first frames.

Following the convention in the original tools, exporter now ignores d_ prefixed actions. These will be reserved for vertex animations.
Added get_framerate() to utils, so there's a single place to get the framerate constant.
Spelling correction for is_vertex_animation.
…rt->export tends to create garbled triangle messes. Shouldn't interfere with skeletal-only exports.
…one on export, but are still body horror.

Added a lame hack to preserve neutral pose of the mesh.
With that, we're feature complete - on to optimizing, bug finding/fixing, etc.
@Five-Damned-Dollarz
Copy link
Author

Five-Damned-Dollarz commented Mar 4, 2021

This should be complete now, unless I've somehow missed a huge bug except for a small bug that affects some vertex animated nodes that puts them a little off. Seems to be consistent, but I don't have a method to replicate it in a fresh .blend yet.
There's at least one derpy workaround in there, and the export process could probably be optimized, but as far as I can see it works great. Importing then exporting an original game file looks virtually identical (except for bounding boxes, which I try to create as best I can from the geometry).
The one thing I'm concerned about is node bounding boxes, since I haven't found any debug commands in Blood 2 to display them on models, I can't be sure they're correct. We can make changes easily enough in the future if it becomes clear they need fixing.

Edit (21/08/17): just for reference for myself/anyone later, the node bounding boxes do not matter! The engine doesn't use them, or expose them to the server/client code at all. They can be ignored entirely for LithTech 1 use.

Copy link
Owner

@haekb haekb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point github jammed up because I was adding too many suggestions. Please use spaces (and fix the ones I didn't suggest toooo!)

Aside from that, I didn't notice any breakage from abc v12 -> lta export. So it's good to go.

src/abc.py Outdated
@@ -71,6 +71,9 @@ class Face(object):
def __init__(self):
self.vertices = []

# ABCv6 specific
self.normal=Vector()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.normal=Vector()
self.normal = Vector()

src/abc.py Outdated
@@ -138,9 +141,12 @@ def __init__(self):
self.child_count = 0

# Version 6 specific
self.bounds_min=Vector()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.bounds_min=Vector()
self.bounds_min = Vector()

src/abc.py Outdated
@@ -138,9 +141,12 @@ def __init__(self):
self.child_count = 0

# Version 6 specific
self.bounds_min=Vector()
self.bounds_max=Vector()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.bounds_max=Vector()
self.bounds_max = Vector()

src/abc.py Outdated
@@ -197,17 +203,19 @@ def __init__(self):
self.node_keyframe_transforms = []

# Version 6 specific

self.bounds_min=Vector()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.bounds_min=Vector()
self.bounds_min = Vector()

src/abc.py Outdated
@@ -197,17 +203,19 @@ def __init__(self):
self.node_keyframe_transforms = []

# Version 6 specific

self.bounds_min=Vector()
self.bounds_max=Vector()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.bounds_max=Vector()
self.bounds_max = Vector()

src/builder.py Outdated
animation.vertex_deformations[node]=[]

# get all vertices for this node
node_vertices=[vertex_index for vertex_index, vertex in enumerate(model.pieces[0].lods[0].vertices) if vertex.weights[0].node_index==node_index]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_vertices=[vertex_index for vertex_index, vertex in enumerate(model.pieces[0].lods[0].vertices) if vertex.weights[0].node_index==node_index]
node_vertices = [vertex_index for vertex_index, vertex in enumerate(model.pieces[0].lods[0].vertices) if vertex.weights[0].node_index == node_index]

src/builder.py Outdated
# get all vertices for this node
node_vertices=[vertex_index for vertex_index, vertex in enumerate(model.pieces[0].lods[0].vertices) if vertex.weights[0].node_index==node_index]

node.bounds_min=Vector((float("inf"), float("inf"), float("inf")))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node.bounds_min=Vector((float("inf"), float("inf"), float("inf")))
node.bounds_min = Vector((float("inf"), float("inf"), float("inf")))

src/builder.py Outdated
node_vertices=[vertex_index for vertex_index, vertex in enumerate(model.pieces[0].lods[0].vertices) if vertex.weights[0].node_index==node_index]

node.bounds_min=Vector((float("inf"), float("inf"), float("inf")))
node.bounds_max=Vector((float("-inf"), float("-inf"), float("-inf")))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node.bounds_max=Vector((float("-inf"), float("-inf"), float("-inf")))
node.bounds_max = Vector((float("-inf"), float("-inf"), float("-inf")))

src/builder.py Outdated
for vertex_index in node_vertices:
temp_vert=shape_keys[keyframe_index].data[vertex_index]

#if not temp_vert.co==mesh.shape_keys.key_blocks[0].data[vertex_index].co:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably remove this now


''' AnimBindings '''
anim_binding = AnimBinding()
anim_binding.name = 'base'
animation.extents = Vector((10, 10, 10))
anim_binding.extents = Vector((10, 10, 10))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Some minor documentation changes, added more model/engine link information.
@Five-Damned-Dollarz
Copy link
Author

At some point github jammed up because I was adding too many suggestions. Please use spaces (and fix the ones I didn't suggest toooo!)

Aside from that, I didn't notice any breakage from abc v12 -> lta export. So it's good to go.

I fixed as many as I could find, hopefully that's everything.

There is still one bug with the vertex animated node exporting with a slightly off rotation in rare animations, but it happens so infrequently in my experience that we could just make an issue for it, and hunt it later (with more information, hopefully, I have no idea where it comes from yet)

@haekb
Copy link
Owner

haekb commented Mar 14, 2021

Cool beans, thanks. If you could just open a github issue about that, so we don't forget, that'll be greeeeat.

@haekb haekb changed the title [WIP] ABC v6 export ABC v6 export Mar 14, 2021
@haekb haekb merged commit f534b02 into haekb:master Mar 14, 2021
This was referenced Mar 14, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants