https://github.com/alexferl/3d-to-2d
Convert 3D characters/animations to 2D sprite sheets
https://github.com/alexferl/3d-to-2d
3d-to-2d blender blender-python mixamo sprite-sheets spritesheets
Last synced: about 2 months ago
JSON representation
Convert 3D characters/animations to 2D sprite sheets
- Host: GitHub
- URL: https://github.com/alexferl/3d-to-2d
- Owner: alexferl
- License: mit
- Created: 2024-07-19T20:45:05.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-12-26T01:49:18.000Z (4 months ago)
- Last Synced: 2024-12-26T02:37:42.056Z (4 months ago)
- Topics: 3d-to-2d, blender, blender-python, mixamo, sprite-sheets, spritesheets
- Language: Python
- Homepage:
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 3d-to-2d
A Python script to convert [Mixamo](https://www.mixamo.com) (and others) 3D characters/animations to 2D sprite sheets using [Blender](https://docs.blender.org/api/current/info_quickstart.html) (tested with 3.6.x) and [Pillow](https://python-pillow.org/).
It contains a basic .blend file with a camera (name: `Camera`) and a light (name: `Light`).> NOTE: This is more an example that should be customized for one's needs versus a ready-to-use tool that just works for many different use cases.
> It works for my needs, but may not work for yours.## Using
```shell
git clone https://github.com/alexferl/3d-to-2d.git
cd 3d-to-2d
make dev
python convert.py --model-file-path=/path/to/model.fbx --animation-file-path=/path/to/anim.fbx
```It's possible the default armature and action names won't work for you or if you want to use the script for non-Mixamo models/animations. You can modify them with:
```shell
python convert.py \
--model-file-path=/path/to/model.fbx \
--model-armature-name=SomeArmature \
--animation-file-path=/path/to/anim.fbx \
--animation-armature-name=AnotherArmature \
--animation-action-name=SomeAction
```You can see what objects are present in the scene with:
```shell
python convert.py \
--model-file-path=/path/to/model.fbx \
--animation-file-path=/path/to/anim.fbx \
--print-objects
```Or actions:
```shell
python convert.py \
--model-file-path=/path/to/model.fbx \
--animation-file-path=/path/to/anim.fbx \
--print-actions
```### Using with animation(s) included with model
```shell
python convert.py \
--model-file-path=/path/to/model.fbx \
--model-armature-name=Rig \
--model-action-name=Idle
```### Excluding meshes
```shell
python convert.py \
--model-excluded-meshes=1H_Axe,2H_Axe
```### Including meshes
```shell
python convert.py \
--model-included-meshes=1H_Axe,2H_Axe
```See which other settings are available with:
```shell
python convert.py --help
```python convert.py \
--model-file-path=files/Barbarian.fbx \
--model-armature-name=Rig \
--model-action-name=1H_Melee_Attack_Chop \
--model-excluded-meshes=1H_Axe_Offhand,2H_Axe,Barbarian_Cape,Mug
--output-suffix=Bodypython convert.py \
--model-file-path=files/Barbarian.fbx \
--model-armature-name=Rig \
--model-action-name=Idle \
--model-included-meshes=Barbarian_ArmLeft \
--output-suffix=ArmLeftpython convert.py \
--model-file-path=files/Barbarian.fbx \
--model-armature-name=Rig \
--model-action-name=Idle \
--model-included-meshes=1H_Axe,Barbarian_ArmRight \
--output-suffix=ArmRightpython convert.py \
--model-file-path=files/Barbarian.fbx \
--model-armature-name=Rig \
--model-action-name=1H_Melee_Attack_Chop \
--model-included-meshes=1H_Axe \
--output-suffix=1H_Axepython convert.py \
--model-file-path=files/Barbarian.fbx \
--model-armature-name=Rig \
--model-action-name=1H_Melee_Attack_Chop \
--model-included-meshes=Barbarian_Round_Shield \
--output-suffix=Shield