Skip to content

Webber penn shape envelope#11

Merged
GoodPie merged 26 commits intomasterfrom
webber-penn-shape-envelope
Jan 31, 2026
Merged

Webber penn shape envelope#11
GoodPie merged 26 commits intomasterfrom
webber-penn-shape-envelope

Conversation

@GoodPie
Copy link
Owner

@GoodPie GoodPie commented Jan 31, 2026

Description

Implementation of the crown shape from the paper by Webber and Penn paper (https://courses.cs.duke.edu/cps124/fall01/resources/p119-weber.pdf) on tree generation.

  • Added crown shape to branch (implementation looks correct but not 100% confident)
  • Added visualiser for crown shape (experimenting more with Blender API)

This pull request introduces a major new feature: customizable crown shapes for tree generation, based on botanical research, allowing users to create more realistic and varied tree silhouettes. The changes include both user-facing documentation and significant refactoring of the codebase to group branch parameters and support the new crown shape functionality.

Crown Shape Feature:

  • Added support for 8 botanical crown shapes (e.g., conical, spherical, flame) to control tree silhouettes, based on the Weber & Penn model. This includes a new CrownShape enum, CrownParams struct, and integration into the BranchFunction workflow. [1] [2] [3] [4] [5]
  • Updated user documentation: README and a new crown_shape_guide.md explaining how to use crown shapes, available options, formulas, and tips for realistic results. [1] [2]

Parameter Refactoring:

  • Refactored BranchFunction parameters: grouped related parameters into structs (SplitParams, GravityParams, DistributionParams, CrownParams) and updated Python bindings and C++ code to use these groupings for clarity and extensibility. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Version Updates:

  • Bumped version numbers to 5.3.0 in VERSION, blender_manifest.toml, and m_tree/pyproject.toml to reflect the new feature release. [1] [2] [3]

Technical Improvements:

  • Improved crown zone calculations and height-based branch modifications for more accurate envelope effects, including angle variation and branch length scaling.
  • Added missing virtual destructor to TreeMesher for proper cleanup in derived classes.

These changes make it easier for users to generate a wide variety of realistic tree forms and for developers to extend the codebase with additional biologically-inspired features in the future.

Will investigate this later
@GoodPie GoodPie self-assigned this Jan 31, 2026
Copilot AI review requested due to automatic review settings January 31, 2026 22:20
@GoodPie GoodPie added the enhancement New feature or request label Jan 31, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements crown shape envelopes based on the Weber and Penn paper on tree generation, adding parametric control over branch length and angles based on tree height.

Changes:

  • Added crown shape functionality with 8 shape types (Conical, Spherical, Hemispherical, Cylindrical, Tapered Cylindrical, Flame, Inverse Conical, Tend Flame)
  • Implemented viewport visualization of crown shape envelopes using Blender's GPU drawing API
  • Refactored BranchFunction to use parameter groupings (SplitParams, GravityParams, DistributionParams, CrownParams) instead of flat member variables

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
python_classes/viewport/shape_formulas.py Core math implementation for crown shape calculations, ported from C++
python_classes/viewport/crown_shape_drawer.py Blender viewport drawing handler for visualizing crown envelopes
python_classes/viewport/init.py Module initialization for viewport functionality
python_classes/nodes/tree_function_nodes/branch_node.py Added crown shape UI controls and nested parameter mapping
python_classes/init.py Registered viewport module in plugin lifecycle
m_tree/source/tree_functions/CrownShape.hpp C++ implementation of crown shape math and parameter structures
m_tree/source/tree_functions/BranchFunction.hpp Refactored to use parameter groupings and added crown support
m_tree/source/tree_functions/BranchFunction.cpp Applied crown shape modifiers to branch generation logic
m_tree/source/tree_functions/base_types/TreeFunction.hpp Added virtual destructor
m_tree/source/meshers/base_types/TreeMesher.hpp Added virtual destructor
m_tree/python_bindings/main.cpp Exposed crown shape enums and parameter structs to Python
pyproject.toml, m_tree/pyproject.toml, blender_manifest.toml, VERSION Version bumped from 5.2.0 to 5.3.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GoodPie GoodPie merged commit be2ec0c into master Jan 31, 2026
13 checks passed
@GoodPie GoodPie deleted the webber-penn-shape-envelope branch January 31, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant