Giter Site home page Giter Site logo

lazy-tree's Introduction

Lazy Tree Generator

A ground-up approach to a 3D-printer-friendly tree generator, as a Blender addon. TreeBanner

Introduction

Unlike most of the other (excellent) tree generators, LTG focuses on generating 3D-printable models using a combination of watertight meshes with additional attention to minimum thicknesses and branches directions. Currently the addon doesn't create a fully-functional tree: roots must be cropped manually and I'd recommend a general tree remeshing. The initial design of this generator aimed to a true bottom-up simulation, keeping all the design parameters as little emulative as possible, but currently the generation follows something in between: .ost of the rules are "local", there is no "tree shape" parameter and each branch is (almost) not aware of its position on the tree, but at the same time there are some global filters to keep the shapes printable.

Installation

As of the latest update the content of the plugin is not in a single .py file anymore. Download all the .py files, zip them and load that zip in Blender.

Getting started

Once the plugin is installed, you should find yourself a tab "Create" on the properties panel on the right. You will likely be overwhelmed by the amount of parameters, which yet need to be organized in sections with brief tooltips or labels. Till then, keep the following pointers in mind:

  • The plugin updates the tree every time a parameter change. This means that dragging a value causes multiple generations, resulting in a real-time movement.
  • If the "Generate Mesh" is ticked, the tree will be generated with the whole mesh; otherwise, only the "graph" of the tree armature is shown. I'd recommend using the latter if you want to experiment with real-time parameters changes.
  • The resulting mesh is composed of a separated watertight mesh for each branch section. Remeshing is always an option.
  • The roots are programmed to grow until they get fully under Z = 0.
  • The "Create Tree" button allows to recreate the tree even if no parameters have changed. It's wonky, and a better UX will be implemented.
image

TO-DOs

Future versions of the script should implement several more features:

  • Roots are not enough to justify the widening of the bottom of the trunk.
  • Cropping the roots under the 0 axis should be done automatically, with special care to the potentially oerlapping vertices that this generates.
  • Add general presets
  • Group parameters in different sections each with a preset
  • Implement a pruning logic, that adds a chance for thin branches to break over time depending on the weight on them and the number of iterations (If a branch is broken, the child branches won't be displayed)
  • Implement a light searching logic. Without having to create specific leaves, it's reasonable to calculate a value of ambient occlusion for each branch and possibly a direction of maximum light to grow towards. If the parameter regulating that is set to maximum you'll end up with a more even distribution of branches. Also it should prevent branches touching or intersecting each other too much.
  • [Major] Re-write the core logic in Rust for faster generation times. The speed for the Rust-Python interface might be an unacceptable overhead.

Licensing

Check out the LICENSE.txt file. The TL;DR would be "use it for whatever, but not to sell models, please".

lazy-tree's People

Contributors

thelazyone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zelmor kpj973

lazy-tree's Issues

Light searching and ambient occlusion vector field

By calculating the light that existing branches (with generic probabilistic leaves) block it's possible to direct the growing branches in different directions. This allows for more even trees, where the canopy is more on a uniform surface.

Split code in multiple files

The problem is that updating and testing on Blender becomes objectively less practical if that happens. Or not. It's worth testing, in any case a smooth development workflow in Blender is the priority..

In any case, when this is implemented the Installation instructions will have to be updated.

Better orientation of radial noise on branches

Currently the radial noise on branches starts from an arbitrary X versor.
This works fine with the trunk: all the rings are somehow oriented towards Z and therefore the noise remains costant. However, if a branch is directed towards X, slight variations of the branch direction might cause a 180° twist of the noise, which could be very visible in the surface.

The solution would be to use as starting point for the radial noise the position (or the versor) of the starting point in the previous ring instead.

Port everything in Rust (Major change)

The only very useful parts of the Blender APIs I'm using right now are the creation of faces and, most importantly, the Bridge Edge Loop.

However, since I have more information about the ordering of the points of each ring in the trunk, I can easily fill te faces manually.

This could be a major rework, but might also be the right chance to refactor parts that were added layers after layer.

Generated tree is not printable

The tree generate in Blender looks amazing but when added to Chitubox... it looks like this. It appears the sections are not complete?

image

Error when loading the add-on in Blender

Hi,

I seems to have an issue when loading the add-on in Blender, here's the trace:

Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/3.3/scripts/modules/addon_utils.py", line 333, in enable
    mod = __import__(module_name)
  File "/Users/pyt/Library/Application Support/Blender/3.3/scripts/addons/lazy-tree.py", line 28, in <module>
    current_script_dir = bpy.context.space_data.text.filepath
AttributeError: '_RestrictContext' object has no attribute 'space_data'

Great job anyway, I'm looking forward to give it a try.

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.