Albam is a Blender 3.6+ addon for importing and exporting 3d models, textures and animations from game engines.
This repository is going through a refactor. Refer to Albam Reloaded for the stable version.
Game modding tool
License: MIT License
Albam is a Blender 3.6+ addon for importing and exporting 3d models, textures and animations from game engines.
This repository is going through a refactor. Refer to Albam Reloaded for the stable version.
Resident evil 5 Gold Edition
s100.arc
s101.arc
s103.arc
s104.arc
s105.arc
s106.arc
s108.arc
s109.arc
s113.arc
s114.arc
s115.arc
s116.arc
s117.arc
s118.arc
s119.arc
2.76
0.2.0
s100 -error exporting
s101 -error importing
s103 - working*
s104 - game error "inflate unknown compression metod: -3"
s105 - game error "inflate unknown compression metod: -3"
s106 - working*
s108 - working*
s109 - error importing
s113 - error exporting
s114 - game error "inflate unknown compression metod: -3"
s115 - game error "inflate unknown compression metod: -3"
s116 - error exporting
s117 - working*
s118 - working*
s119 - error exporting
*means that game run it with lightmap and transperancy glitches
import and export without errors and working without gliches
import-export level without changes
This character issue doesn't persist to 0.3.0 therefore the issue has been closed.
Other characters well be tested and any issues will be reported if issues come using 0.3.0
Also tried desperate escape model and got a different set of issues such as much more blatant deformed mesh and much less present inverted normals.
Even with no edits to the character model/mesh, exporting this imported model brings about numerous issues. These issues seem to be consistent though as this has been tried 4 times and the export issues seem to be the exact same for each time.
With an unedited model it is expected to have no issues but even leaving the model completely untouched, exporting it as an .arc messes the model up ingame. In blender, there are no noticeable problems.
Currently, before exporting a model, transforms on each objects must be applied. If not, the model would look terrible in-game, leaving the poor user clueless on what went wrong, since the model would look perfectly fine in Blender.
Now, I don't know if transforms should be applied to the model directly, since exporting must be a non disruptive function. An option would be to make a copy of the mesh, apply transforms and export.
Armatures being imported might include bones with no weights, e.g. IK bones.
Currently the importer checks the box 'deform' for every bone, regardless of them having weights or not.
When modding with a base skeleton this is an inconvenience since applying automatic weights will make those bone influence when originally they were not designed to do so.
The importer must have post-processing of models to find these bones and unckeck the 'deform' box if they are not being influence. This must be generic for all models.
Resident Evil 5
Any
2.76
develop at commit 913b03e (probably reproducible in 0.1)
Exception thrown when trying to export a model
Traceback (most recent call last):
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/blender.py", line 188, in execute
bpy.ops.object.mode_set(mode='OBJECT')
File "/opt/blender-2.76b/2.76/scripts/modules/bpy/ops.py", line 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.mode_set.poll() failed, context is incorrect
location: <unknown location>:-1
No exceptions, of course.
Resident Evil 5
Any .arc
2.79
0.3.0-testing (albam-bugfix-ISSUE-47-original-model-deformed-after-export)
Model should appear normally.
Export a model that's taller than the original model.
Resident Evil 5
Resident Evil 5/nativePC_MT/Image/Archive/uPl03WeskerCos1.arc
2.77
0.0.1
The example file that has 2 mod files, and the meshes of one of them have no parents.
E.g.:
--uPl03WeskerCos1.arc
--md0058.mod --> No children, meshes should go here
--pl1500.mod --> has children, works ok
--mesh_from_md0058_1 --> this should go as a child of md0058.mod
--mesh_from_md0058_2
-- ...
All meshes have a parent
Import the example file
Resident Evil 5
uPl00ChrisNormal.arc
uPl00ChrisCos1.arc
2.78
0.3-testing
Model is deformed, finger and eye placement doesn't match, neck is streched after export.
Model should be the same as the original.
Import a model and export without changes.
A behavior I noticed when applying armature parent with automatic weights to models is that all bones create an entry in the vertex groups for every mesh, even if the mesh is not influenced for the vertex group of the bone. When exporting RE5 models, it seems all vertex groups are used and hence the 32 bone limit per mesh is reached. When exporing, only the vertex groups that have a weight > 0 should be exported only.
Resident Evil 5
Any
2.78c
0.2.0
Looking at the code in albam.engines.mtframework.blender_export._export_vertices
, clearly there's a case where a ZeroDivisionError
might happen. More specifically, a vertex with no weights.
No ZeroDivisionError exceptions thrown, handle the case and print a warning if necessary
Should upload a file.
Currently, modding the only game available, Resident Evil 5, sucks.
The process of importing a model, deleting all meshes and skin meshes from another model could use a lot of improvements.
The process should be simple for a modder and all conversions should be done automatically while possible, or at least provide some tools to do so.
Albam Mesh Tools When selecting a mesh, show info and buttons to change:
Default unk values with a new mesh (selector for type of game?)
Sanity checker before export:
After doing any edit to Wesker his body appears invisible in the 5-3 cutscene. In gameplay it's fine.
Additionally, the originally intended model appears for a split second, possibly suggesting is a LOD issue.
The body should show.
Currently materials files are loaded automatically using a very simple heuristic that searches for the file based on the path of the model file.
For example, pl00.mod
will look for the file pl00.mrl
in the same path as the model, and load it if it's found; pl00.mesh.<app-mesh-version>
will look for pl00.mdf2.<app-mdf-version>
or pl00_mat.mdf2.<app-mdf-version>
.
The problem is that some games, notably RE6, don't follow this pattern exactly: the main characters' mrl files are empty. The "real" mrl files are scattered around different paths, with unpredictable names. This causes that by default most interesting models are imported without materials.
One option would be to hard-code those paths after careful research, but it doesn't scale well.
To solve this and allow for better modding, an mrl file can be made importable, with the optional requirement to select a model to apply it to. Materials will be applied only if the custom attributes in the mesh match the hash_id of the material.
If not matches are found, warning must be shown, but materials and textures should be created anyway.
Resident Evil 5
ChrisCos4.arc
2.76b
0.3.0-testing
The model, even clean, cannot be exported
The model could be exported
Import ChrisCos4.arc , even if you dont do any modification, try to re-export it, the program will not let you do it
Resident Evil 5
Any
2.77
0.0.1
When scaling all the meshes of a model after a certain point makes the model look terribly.
The bounding box values of a model are calculated dynamically instead of using the ones from the saved/imported model.
Import a model and scale the mesh (edit mode) 20 times.
When exporting a custom made model, I've noticed some vertices appearing in-game like they have no weights, but in Blender they look OK.
Turns out that MTFramework will ignore the weights completely if one vertex has no weights, even when the others sum up to 255.
Simple example to reproduce:
# bone_index/weight value pairs from Blender
[(47, 0.0021963752806186676), (53, 0.5013832449913025), (57, 0.0008065812289714813), (58, 0.36875882744789124)]
# After processing them for export, bone_index 57 has no influence
[(47, 1), (53, 146), (57, 0), (58, 108)]
So, weights exported have to:
In some cases while exporting a new model for RE5, the precision will make some vertices be larger than 1.0, making the number go above 32767.
See albam.engines.mtframework.utils.vertices_export_locations
Mod156 has a field called unk_13
that is a fixed array of 256 bytes. It turns out it's actually a mapping used for animations. Apparently, every index represents a hard-coded bone type.
For example, based on uPl00ChrisNormal.arc->pl0000.mod
and uPl01ShebaNormal.arc->pl0100.mod
, indices 16 and 20 represent the upper left and right leg respectively. This can be confirmed parsing both mod files and taking the bone indices visually when they were imported:
>>> from albam.engines.mtframework import Mod156
>>> mod = Mod156('pl0000.mod')
>>> mod2 = Mod156('pl0100.mod')
>>> chris_right_leg = 112 # taken from blender
>>> chris_left_leg = 117
>>> sheva_right_leg = 2
>>> sheva_left_leg = 8
>>> assert list(mod.unk_13).index(chris_right_leg) == list(mod2.unk_13).index(sheva_right_leg)
>>> assert list(mod.unk_13).index(chris_left_leg) == list(mod2.unk_13).index(sheva_left_leg)
Knowing this, it would be useful for modding to classify them all and create bone groups and layers.
For example, the first layer should include the most important bone: spine, legs, arms, head bone, etc.
This way, automatic weighting can also be done in layers, refining or omitting more detailed bones.
Resident Evil 5
uPl02JillCos2.arc
2.79
0.3.0-testing
Blender crashes when exporting.
Error message should come up.
Download:
crash.zip
then click export.
At least shader node gropus need to be updated to manage API changes in 4.0:
https://developer.blender.org/docs/release_notes/4.0/python_api/#node-groups
Current behavior:
Traceback (most recent call last):
File "/blender/4.0/scripts/addons/albam/blender_ui/import_panel.py", line 47, in execute
self._execute(item, context)
File "/blender/4.0/scripts/addons/albam/blender_ui/import_panel.py", line 54, in _execute
bl_container = import_function(item, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/blender/4.0/scripts/addons/albam/engines/mtfw/mesh.py", line 266, in build_blender_model
materials = build_blender_materials(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/blender/4.0/scripts/addons/albam/engines/mtfw/material.py", line 92, in build_blender_materials
_create_mtfw_shader()
File "/blender/4.0/scripts/addons/albam/engines/mtfw/material.py", line 553, in _create_mtfw_shader
shader_group.inputs.new("NodeSocketColor", "Diffuse BM")
^^^^^^^^^^^^^^^^^^^
AttributeError: 'ShaderNodeTree' object has no attribute 'inputs'
Users found an issue with imported heads for Revelation 2 but it can be elsewhere too. The addon fails to import weighs for a bone with the index 0, probably because of this code in mesh.py
# TODO: verify in parsing tests that bone_index = 0 is never taken into account for bi, bone_index in enumerate(bone_indices): if bone_index == 0 and ( (mesh.vertex_format not in (0xC31F201C,) and mod.header.num_bones != 1) ): # no root bone, 0 is acceptable continue
Example of problematic vertices in pl2203.mod_0083
Resident Evil 5
There's a flag for a mesh to cast shadows that is not being used.
The problem with Blender is that the option to cast shadow is per material and not per mesh. It's unknown if there's any case where 2 meshes share the same material but they have different cast shadows options. However, it shouldn't be a big issue.
Steps to reproduce
Expected behavior: the exported model contains valid reference to textures
Observed behavior: the exported model points to non-existent texture paths, making them not visible.
Some issues from a conversation with knabsi. This is a draft issue that needs to be split when each issue is confirmed and reproducible.
Knabsi writes:
the weight one was a problem, the UV Mesh was the biggest problem, exporting with mote than ** textures problem. (idk the exact number) the disapearing problem when aiming (is being looked at, awesome). importing DLC characters does not seem to work, test it yourself. Exporting with more than 1 material on a mesh causes blender to crash for me
cant think of anything else as of yet
Resident Evil 5
Any
2.78
0.2.0
All normals are having the same value, making the models look weird in any lighting condition
Normals are exported fine.
Import and export a model without touching it, see them in game or in the Figures section.
When trying to export a model that has a texture with an image that is other type than dds, the add-on throws an exception. It should show a warning message and skip importing the model indicating all the materials that have non dds textures.
If there's a single empty vertex group, e.g., a vertex group with no weights assigned the export will fail with an obscure traceback.
Error: Python: Traceback (most recent call last):
File "/blender/3.6/scripts/addons/albam/blender_ui/export_panel.py", line 224, in execute
self._execute(item)
File "/blender/3.6/scripts/addons/albam/blender_ui/export_panel.py", line 234, in _execute
vfiles = export_function(item.bl_object)
File "/blender/3.6/scripts/addons/albam/engines/mtfw/mesh.py", line 733, in export_mod
_serialize_meshes_data(bl_obj, bl_meshes, src_mod, dst_mod, materials_map, bone_palettes))
File "/blender/3.6/scripts/addons/albam/engines/mtfw/mesh.py", line 1164, in _serialize_meshes_data
mesh_weight_bounds = _calculate_weight_bounds(
File "/blender/3.6/scripts/addons/albam/engines/mtfw/mesh.py", line 1486, in _calculate_weight_bounds
weight_bound = _calculate_vertex_group_weight_bound(
File "/blender/3.6/scripts/addons/albam/engines/mtfw/mesh.py", line 1602, in _calculate_vertex_group_weight_bound
min_x = min((v[0] for v in vertices_in_group_bone_space))
ValueError: min() arg is an empty sequence
It won´t tell you which mesh, and it will keep failing until all are fixed.
The albam_reloaded tool "Remove empty vertex groups" is almost mandatory then, providing a terrible user experience for first-time users . Empty weight groups can be safely ignored.
Resident Evil 5,
Errors when trying to export meshes:
Vertices by itself use 'degenerate' triangles (e.g. invisible, see pl00ChrisNormal.arc, in mesh 0). However, it might be also a good idea to just skip exporting those kind of meshes.
For 3, it seems that the algorithm for converting triangle lists to triangle strips expects all vertices to be referenced by an index.
For 1, 2, the exception is:
Traceback (most recent call last):
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/blender.py", line 189, in execute
func(obj, self.filepath)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 78, in export_arc
exported_mod = export_mod156(child)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 168, in export_mod156
exported_meshes = _export_meshes(blender_meshes, bounding_box, bone_palettes, exported_materials)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 424, in _export_meshes
vertices_array = _export_vertices(blender_mesh_ob, bounding_box, mesh_index, bone_palette)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 306, in _export_vertices
tangents = _get_tangents_per_vertex(blender_mesh)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 292, in _get_tangents_per_vertex
blender_mesh.calc_tangents(uv_name)
RuntimeError: Error: Tangent space computation needs an UVMap, "UVMap" not found, aborting
Resident Evil 5
Any .arc
2.79
0.3.0-testing (albam-bugfix-ISSUE-47-original-model-deformed-after-export)
UV map is broken after export.
UV map should be the same as it is in Blender.
Export a custom model with textures and UV map.
Resident Evil 5
The meshes become invisible. This requires more research or a workaround to discard the the bones that influence the vertex the least, up to 4. The latter option is not ideal, but might be acceptable. The question is how much the quality might change in the exported mesh and what kind of vertex really needs to be influenced by more than 4 bones.
Resident Evil 5
Every Upl ARC file.
Below 2.78 and Blender 2.8
0.3.0
I think the description should say 2.78 and above because I tried with 2.70 and below 2.78 and all of them had issues which make the plugin unusable on these versions, later versions told me the plugin is made for 2.78 - which the plugin works fine on.
Trying it on the upcoming Blender 2.8 (experimental builds) and there seems no issue on import at all but an error is given on export.
It should export fine without errors (but I don't expect it to import/export on versions below 2.78).
But export bug should be fixed for future Blender (2.8) releases perhaps.
Traceback (most recent call last):
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/blender.py", line 103, in execute
func(obj, self.filepath)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 75, in export_arc
mod, textures = export_mod156(child)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 144, in export_mod156
materials_mapping)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 377, in _export_meshes
vertices_array = _export_vertices(blender_mesh_ob, bounding_box, mesh_index, bone_palette)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 220, in _export_vertices
uvs_per_vertex = get_uvs_per_vertex(blender_mesh_object.data, blender_mesh_object.data.uv_layers[0])
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
When attempting to export a model, if any mesh is in edit mode, the addon will fail
Traceback (most recent call last):
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/blender.py", line 103, in execute
func(obj, self.filepath)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 75, in export_arc
mod, textures = export_mod156(child)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 144, in export_mod156
materials_mapping)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 377, in _export_meshes
vertices_array = _export_vertices(blender_mesh_ob, bounding_box, mesh_index, bone_palette)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/mtframework/blender_export.py", line 220, in _export_vertices
uvs_per_vertex = get_uvs_per_vertex(blender_mesh_object.data, blender_mesh_object.data.uv_layers[0])
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/utils.py", line 368, in get_uvs_per_vertex
uvs = uvs_per_loop[i].uv
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
Resident Evil 5
uPl00ChrisCos1.arc
uPl03WeskerCos1.arc
2.78
0.2.0
When aiming (camera too close) the model disappears.
Model behaves like the original.
Import and export a model without touching it, play in game and aim.
Resident Evil 5 Gold Edition
uPl07RebeccaNormal.arc
2.78c
0.2.0
Modded model is not show up and show up the original model instead.
http://i.imgur.com/kn6kgYA.png
(vertex array length is -58 wow)
should at least show the skirt of cheerleader?
http://i.imgur.com/mU8HnZG.png
Get the mod here:
http://residentevilmodding.boards.net/thread/5839/rebecca-chambers-sports-outfit
Then just import the only arc file in that rar.
Resident Evil 5
When exporting a mesh created from scratch (i.e. one that was not imported with Albam), the mesh doesn't show in game because the material settings are all empty.
Default settings for the materials must be created. Until research is done to figure out all the unknowns in the MaterialData
structure, this seems like a good approach.
Resident Evil 5
Any
2.76, 2.77, 2.78
develop 0.3 alpha at commit 913b03e
When exporting importing and then exporting a game character without any modifications, weird artifacts appear in some parts, probably caused by bad normals.
Normals should be exported fine
Import and export ShebaNormal and check some in game cut-scenes. Her chin has a clear glitch, as well as some other parts of her body.
Currently only packed files can be imported[1]. However, many games can be modded using unpacked assets as well. This is very useful when games are distributed in single huge packed file instead of many small ones. It allows to leave the main packed file untouched. See for example the "first natives" tool. Additionally, not all final files are actually packed in games[2].
The only requirement to implement this is for the user to provide the "root" folder to search for references in the files imported. For example, texture paths in a materials file.
[1] Actually, mod files can be imported, but are currently filtered out by the glob pattern of "*.arc". They will be imported without materials though, since the virtual file system won't be constructed without a packed file (.arc).
[2] Note that many mods are meant to be installed unpacked, but they are distributed packed, for example, in a rar file. Providing support for packing/unpacking common archives could actually make this feature less useful.
Resident Evil 5
Resident Evil 5/nativePC_MT/Image/Archive/uPl00ChrisNormal.arc
2.77
0.0.1
When exporting the model back to the game, the materials look different:
No shadows are are casted, specularity and roughness seems off.
Shadows should show always if the original model had them, as well as the materials should look fine when just importing//exporting.
Import and export the example file and play the game.
Resident Evil 5
When importing/exporting any character that appears in a cut-scene, two heads appear: the in-game head and the more detailed/high poly head for cut-scenes. Only the latter should should.
It was observed that this is a setting apparently controlled by' Mod156.group_data_array
; every mesh has an index to a member then, in Mesh156.group_index
, which could be renamed to 'RenderOptions', probably.
Resident Evil 5
If for some reason a DDS texture with no mipmap is used, the exporter raises an exception.
I don't know if MTFramework supports DDS with no mipmaps, but if it does, they should be supported. If not, all textures should be pre-checked and a clear error message and how to fix it should be displayed.
Traceback (most recent call last):
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/blender.py", line 189, in execute
func(obj, self.filepath)
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/blender_export.py", line 109, in export_arc
tex = Tex112.from_dds(file_path=bpy.path.abspath(blender_texture.image.filepath))
File "/home/sysop/.config/blender/2.76/scripts/addons/albam/engines/mtframework/tex.py", line 54, in from_dds
assert len(mipmap_offsets) == mipmap_count
AssertionError
location: <unknown location>:-1
Vertices are not exported correctly, causing visual artifacts in-game around UV seams.
The work-around is to use the "Fix leaked textures" tool from Albam Reloaded that essentially splits vertices in the UV edges.
This shouldn't be necessary if the exporter would generate the extra vertices at export time. Touching the original mesh or a copy of it shouldn't be necessary
This happens because GPUs expect that each new vertex attribute be a different item in in the vertices array. That's why an imported model always has duplicate vertices that can be removed with the "Merge by distance" operator.
See the official Blender glTF importer/explanation in the "Merge vertices" tooltip for import:
the glTF format requires discontinuous normals, UVs, and other vertex attributes to be stored as separate vertices, as required for rendering on typical graphics hardware. This option attempts to combine co-located vertices where possible.
The glTF exporter splits the vertices automatically, so it can be used as a reference. Handling triangle strips (RE5) when performing the split seems like a challenge and prevented this to be implemented so far.
Add initial support for animations in MTFramework (Resident Evil 5 at first)
Initial patch based on discussions in a xentax topic attached.
When something goes wrong at any time during loading, importing or exporting a model, the user is presented with a code traceback. Maybe the exception has a useful message, but most of the time it doesn't.
Refactor entrypoints so all exceptions are handled globally, with a useful pop-up that not only states the problem but recommends a solution. If the error is unexpected (e.g. no solution is recorded), the traceback must be shown with the pop-up.
The pop-up should include a link to github issues and discord support channel.
Resident Evil 5
Any
2.77
v0.2.0-dev-alpha
When the texture name and filename don't match, the textures are not exported
Textures are exported regardless of texture names
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.