def generate_coral_config(tree_genome=None):
    """
    Main latent params that we might want to control:
    - overall size/"age"
    - trunk straightness
    - additional "trunks"
    - starting height of branches
    - outgoing branch angle (parallel to ground vs angled up vs angled proporitionally to height)
    - branch density
    - branch length (fn of height)
    - branch straightness
    - pull direction (up/down/to the side)
    - outgrowth (space filling) / "density"
    - branch thickness (ideally this behaves reasonably based on everything else)
    """
    if tree_genome is None:
        tree_genome = np.random.rand(32)

    cfg = parse_genome(tree_genome)
    sz = calc_height(cfg["size"])
    n_tree_pts = int(sz)
    n_trunks = np.random.randint(5, 20)  # int(10 ** (cfg['n_trunks']**1.6))
    ex = np.exp((6 - (5 if n_trunks > 1 else 0)) * (cfg["trunk_warp"] - 0.1))
    trunk_std = ((1 - (ex / (1 + ex))) * 4) ** 2
    trunk_mtm = max(0.2, min(0.95, (1 / (trunk_std + 1)) + np.random.randn() * 0.2))
    radial_out = False  # np.random.rand() < .3
    avail_idxs = np.arange(n_tree_pts)
    start_idx = 1 + int(n_tree_pts * np.random.uniform(0, 0.7))
    sample_density = np.random.choice(
        np.arange(np.ceil(np.sqrt(n_tree_pts)), dtype=int) + 1
    )
    avail_idxs = avail_idxs[start_idx::sample_density]
    multi_branch = int(5 ** (cfg["multi_branch"] ** 1.6))
    avail_idxs = np.repeat(avail_idxs, multi_branch).flatten()

    n = 0  # len(avail_idxs)

    start_ht = sz * (start_idx / sz) + 1
    box_ht = (sz - start_ht) * 0.6

    def tmp_att_fn(nodes):
        branch_pts = mesh.get_pts_from_shape(
            bpy.ops.mesh.primitive_cube_add,
            n=500,
            scaling=[sz / 2, sz / 2, box_ht],
            pt_offset=[0, 0, start_ht + sz * 0.4],
        )
        return branch_pts

    max_sz = 1

    branch_config = {
        "n": n,
        "path_kargs": lambda idx: {
            "n_pts": int(n_tree_pts * np.random.uniform(0.4, 0.6)),
            "sz": 1,
            "std": 0.4,
            "momentum": 0.8,
            "pull_dir": [0, 0, np.random.rand()],
            "pull_factor": np.random.rand(),
        },
        "spawn_kargs": lambda idx: {"rnd_idx": avail_idxs[idx]},
    }

    tree_config = {
        "n": n_trunks,
        "path_kargs": lambda idx: (
            {
                "n_pts": n_tree_pts,
                "sz": 1,
                "std": trunk_std,
                "momentum": trunk_mtm,
                "pull_dir": [0, 0, 1],
            }
        ),
        "spawn_kargs": lambda idx: {"init_vec": [0, 0, 1]},
        "children": [branch_config],
    }

    tmp_D = 0.3 + 0.2 * (sz / 30)  # .3 * sz / 8
    tmp_s = tmp_D * 1.3
    if n < 5:
        n_updates = np.random.choice([2, 3, int(1 + sz // 2)])
    else:
        n_updates = np.random.choice([2, 2, 2, 3, 4, 5])
    # print(sz, n_updates)
    n_updates = 3
    max_radius = 0.3  # 00
    merge_size = np.random.uniform(0.2, 0.7)
    growth_amt = 1.01

    return {
        "config": tree_config,
        "D_": tmp_D,
        "s": tmp_s,
        "d": 10,
        "pull_dir": [0, 0, np.random.randn() * 0.3],
        # np.random.randint(15) + 3,
        "init_att_fn": tmp_att_fn,
        "n_updates": n_updates,
        "radii_kargs": {
            "max_radius": max_radius,
            "merge_size": merge_size,
            "min_radius": 0.2,
            "growth_amt": growth_amt,
        },
        "leaf_kargs": {
            "max_density": 0 if np.random.rand() < 0.1 else np.random.uniform(5, 20),
            "scale": np.random.uniform(0.5, 1),
        },
    }

    Main latent params that we might want to control:
    - overall size/"age"
    - trunk straightness
    - additional "trunks"
    - starting height of branches
    - outgoing branch angle (parallel to ground vs angled up vs angled proporitionally to height)
    - branch density
    - branch length (fn of height)
    - branch straightness
    - pull direction (up/down/to the side)
    - outgrowth (space filling) / "density"
    - branch thickness (ideally this behaves reasonably based on everything else)
    
infinigen/assets/objects/trees/treeconfigs.py