Git Product home page Git Product logo

aldergames / landon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chinedufn/landon

0.0 0.0 0.0 12.22 MB

A collection of tools, data structures and methods for exporting Blender data (such as meshes and armatures) and preparing it for your rendering pipeline.

Home Page: https://chinedufn.github.io/landon/

Shell 0.13% Python 11.13% Rust 84.67% HTML 0.42% GLSL 3.14% JavaScript 0.51%

landon's Introduction

Landon Build Status Build Status docs

A collection of tools, data structures and methods for exporting Blender data (such as meshes and armatures) and preparing it for your rendering pipeline.

The Landon Book

Initial Background / Motivation

Before this module I would export blender mesh / armature data to COLLADA using blender's collada exporter, and then parse that COLLADA into JSON.

This worked mostly well - but here and there I'd run into a model that didn't export quite right and I'd have to dig around to figure out why.

After a year or two of this occasionally happening.. I finally decided to invest some time in writing something myself, knowing that I'd still run into issues here and there, but they'd be issues that I'd know how to address.

The goal of landon is to be a minimal suite of heavily tested, well documented tooling for getting data out of Blender and a set of functions for pre-processing that data so that you can make use of it in your rendering pipeline.

From the beginning landon will be targeted towards my needs for my game Akigi, but please feel very free to open issues / PRs with questions / thoughts / functionality that you think might fit into landon.

The goal is that getting data out of Blender and into your rendering pipeline becomes easy as pie.

Getting Started

The Landon Book is a work in progress guide with examples on how to use the libraries in landon.

Take a look at the mesh-visualizer directory to see a full working example of implementing skeletal animation with models that were exported using landon.

Quick Start

Here's an example where we'll download a Blender file, export the meshes to JSON and then extract each bounding box from the JSON using the jq CLI.

# Install landon
cargo install -f landon
landon install --mesh-to-json --armature-to-json

# 
BLEND_FILE='https://github.com/chinedufn/landon/blob/master/crates/blender-export-test/src/tests/multiple_meshes.blend?raw=true'
curl -L $BLEND_FILE > /tmp/multiple-meshes.blend

# Write every meshname along with that meshes bounding box to stdout
landon export -f /tmp/multiple-meshes.blend | landon parse | jq -r '.meshes | to_entries[] | .value | to_entries[] | "\(.key), \(.value | .bounding_box)"'

# Second_Mesh, {"min_corner":[-1.3121787,0.44901967,0.67399526],"max_corner":[0.7619256,2.523124,2.7480996]}
# AMesh, {"min_corner":[-3.2487504,-3.3098261,1.2566323],"max_corner":[-1.2487504,-1.3098261,3.2566323]}
# Mesh3, {"min_corner":[-1.2058887,-2.4149196,-1.8447866],"max_corner":[0.86821556,-0.3408153,0.22931767]}

To Install

We currently support Blender 2.80

cargo install -f landon

landon install --mesh-to-json --armature-to-json
# FIXME: landon install --ik-to-fk
npm install -g ik2fk && ik2fk --install

# More info
landon install --help

API

Landon provides a Rust API for exporting data programatically.

landon

In the future we will also provide C and Wasm APIs as light wrappers around the Rust API in order to enable interop with other languages.

CLI Usage

# Help on all of the subcommands
landon --help

Running the mesh visualizer locally

TODO: Rewrite this example and remove watchexec as a dependency.

# Install a static server that sets the application/wasm mime type
npm install -g http-server
# Watcher
cargo install watchexec

git clone https://github.com/chinedufn/landon

watchexec -r -w mesh-visualizer --ignore mesh-visualizer/out ./mesh-visualizer/build.sh

http-server ./mesh-visualizer/out --open

Your web browser should open up with an application that allows you to visualize all of the model's in our test suite.

Mesh visualizer demo site

Contributing

Please open issues explaining your intended use case and let's see if we should or shouldn't make landon support it.

Also feel free to open issues with any questions / thoughts that you have!

To test

cargo test --all

TODO

  • BlenderMesh's triangulate function can deal with ngons. Right now only handles 3 or 4 faces

See Also

License

MIT

landon's People

Contributors

chinedufn avatar burtonageo avatar aldergames avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.