Perf (.perf)

Contents

Perf (.perf)#

Assets (.perf.assets)#

Materials (.perf.assets.materials)#

Plant (.perf.assets.materials.plant)#

bark_random#
class infinigen.perf.assets.materials.plant.bark_random.BarkRandom[source]#

Bases: object

The method of the default BarkRandom that differs.

apply(obj, selection=None, **kwargs)[source]#

Defer a natively meshed tree’s bark displacement to the native kernel, run once the stems are retessellated, instead of displacing the tubes with geometry nodes. Trees call this unbound with the tree factory as self; any other call runs the default.

Parameters:
  • obj

  • selection -- (default: None)

Module contents#

Module contents#

Objects (.perf.assets.objects)#

Corals (.perf.assets.objects.corals)#

laplacian#

Cauliflower coral subdivided on arrays in place of the Subdivision Surface modifier.

The modifier is slow on the coral’s marching-cubes surface, where every vertex is extraordinary for its adaptive patch tables.

infinigen.perf.assets.objects.corals.laplacian.subdivide_limit(obj)[source]#

Subdivide obj one level onto the limit surface, like the Subdivision Surface modifier, which still runs for meshes that are not closed triangle manifolds.

Parameters:

obj

class infinigen.perf.assets.objects.corals.laplacian.CauliflowerBaseCoralFactory[source]#

Bases: object

Counterpart of the default factory, defining only the method that differs.

create_asset(face_size=0.01, **params)[source]#
Parameters:

face_size -- (default: 0.01)

star#

The default star coral’s flowers, built on arrays from the loop table.

The default’s bridges fail when the scene’s mesh select mode is face or edge, leaving the coral without flowers; these are always built.

infinigen.perf.assets.objects.corals.star.build_flowers(rings)[source]#

Flowers on every face of rings as one mesh object, deleting rings. Level i of a ring with centre c is c + s^i (p - c), lifted along the ring’s stored normal by the default’s flower profile at t = i / 16. Rings draw in the default’s loose-part order, so the random draws pair with the default’s.

Parameters:

rings

class infinigen.perf.assets.objects.corals.star.StarBaseCoralFactory[source]#

Bases: object

Counterpart of the default factory, defining only the method that differs.

create_asset(face_size=0.01, **params)[source]#
Parameters:

face_size -- (default: 0.01)

subdivide#
infinigen.perf.assets.objects.corals.subdivide.catmull_clark_limit(co, faces, edges)[source]#

Level-1 Catmull-Clark limit mesh (positions, quads) of a closed manifold of triangles or quads. Matches the Subdivision Surface modifier with limit surface on to float32 rounding, in its order: coarse vertices, a point per edge of edges, a point per face, and quad (v_k, e_k, F, e_{k-1}) for corner k of each face.

Parameters:
  • co

  • faces

  • edges

Module contents#

Creatures (.perf.assets.objects.creatures)#

Util (.perf.assets.objects.creatures.util)#
mesh_join#

Data-level stand-ins for two Blender operators used while assembling creatures.

origin_to_geometry and join_objects_exact match origin_set and join bit for bit, without their dependency-graph updates and datablock scans. Inputs they do not cover, such as shape keys or vertex groups, go through the operator.

infinigen.perf.assets.objects.creatures.util.mesh_join.origin_to_geometry(obj, no_children=False)[source]#

origin_set(type=”ORIGIN_GEOMETRY”) (median center) for one mesh object, with the operator’s float32 arithmetic and no dependency-graph updates. no_children skips the children scan when the caller knows there are none.

Parameters:
  • obj

  • no_children -- (default: False)

infinigen.perf.assets.objects.creatures.util.mesh_join.join_objects_exact(objs, check_attributes=False)[source]#

butil.join_objects with the join done at the data level and the same result: objs[0] gets the others’ geometry in the view layer’s base order, the others are removed, and it is returned selected and active.

Parameters:
  • objs

  • check_attributes -- (default: False)

part_util#
infinigen.perf.assets.objects.creatures.util.part_util.nodegroup_to_part(...)[source]#
Parameters:
  • nodegroup_func

  • params

  • kwargs -- (default: None)

  • base_obj -- (default: None)

  • split_extras -- (default: False)

Module contents#
bird#
class infinigen.perf.assets.objects.creatures.bird.BirdFactory(factory_seed=None, coarse=False, bvh=None, animation_mode=None, **kwargs)[source]#

Bases: BirdFactory

create_asset(...)[source]#
Parameters:
  • i

  • placeholder

  • hair -- (default: True)

class infinigen.perf.assets.objects.creatures.bird.FlyingBirdFactory(
factory_seed=None,
coarse=False,
bvh=None,
animation_mode=None,
altitude=('uniform', 15, 30),
)[source]#

Bases: FlyingBirdFactory

max_expected_radius = 1#
max_distance = 40#
create_asset(...)[source]#
Parameters:
  • i

  • placeholder

  • hair -- (default: True)

  • animate -- (default: False)

Module contents#

Leaves (.perf.assets.objects.leaves)#

broadleaf_native#

Broadleaf fields evaluated natively from curve tables sampled once in Blender.

class infinigen.perf.assets.objects.leaves.broadleaf_native.PreparedBroadleaf(
parameters: ndarray,
tables: ndarray,
ranges: ndarray,
)[source]#

Bases: object

Parameters:
infinigen.perf.assets.objects.leaves.broadleaf_native.prepare_broadleaf(params)[source]#
Parameters:

params

infinigen.perf.assets.objects.leaves.broadleaf_native.evaluate_broadleaf(prepared, xy, *, coverage_mask=None)[source]#
Parameters:
  • prepared

  • xy

  • coverage_mask -- (default: None)

infinigen.perf.assets.objects.leaves.broadleaf_native.broadleaf_coverage_mask(size, params, prepared=None)[source]#

Conservative mask of the blade and the full noisy midrib, bounded by the curve lookup tables. The midrib test uses abs(y), so it reaches past both ends of the blade’s [-0.6, 0.6].

Parameters:
  • size

  • params

  • prepared -- (default: None)

infinigen.perf.assets.objects.leaves.broadleaf_native.rasterize_broadleaf_native_fields(size, params)[source]#

Every broadleaf field on the coverage box, rounded through ENCODING.

Parameters:
  • size

  • params

leaf_broadleaf#
infinigen.perf.assets.objects.leaves.leaf_broadleaf.apply_deferred_wave(obj)[source]#

Apply the broadleaf wave that the native field route defers to the final mesh.

Parameters:

obj

class infinigen.perf.assets.objects.leaves.leaf_broadleaf.LeafFactoryBroadleaf(factory_seed, season='autumn', coarse=False)[source]#

Bases: LeafFactoryBroadleaf

create_asset(**params)[source]#
leaf_ginko#
class infinigen.perf.assets.objects.leaves.leaf_ginko.LeafFactoryGinko(factory_seed, season='autumn', coarse=False)[source]#

Bases: LeafFactoryGinko

create_asset(**params)[source]#
leaf_maple#
class infinigen.perf.assets.objects.leaves.leaf_maple.LeafFactoryMaple(factory_seed, season='autumn', coarse=False)[source]#

Bases: LeafFactoryMaple

create_asset(**params)[source]#
leaf_v2#
class infinigen.perf.assets.objects.leaves.leaf_v2.LeafFactoryV2(factory_seed, coarse=False)[source]#

Bases: LeafFactoryV2

create_asset(**params)[source]#
leaf_wrapped#
class infinigen.perf.assets.objects.leaves.leaf_wrapped.LeafFactoryWrapped(factory_seed, season='autumn', coarse=False)[source]#

Bases: LeafFactoryWrapped

create_asset(**params)[source]#
planar_native#

Native v2, ginko and maple leaf fields, from curve tables sampled in Blender.

infinigen.perf.assets.objects.leaves.planar_native.curve_tables(specifications)[source]#
Parameters:

specifications

infinigen.perf.assets.objects.leaves.planar_native.prepare(kind, p)[source]#
Parameters:
  • kind

  • p

infinigen.perf.assets.objects.leaves.planar_native.coarse_coverage_mask(...)[source]#

Coarse coverage mask whose nearest-neighbour upsample is conservative.

Parameters:
  • kind

  • shape

  • prepared

  • stride

infinigen.perf.assets.objects.leaves.planar_native.rasterize(...)[source]#
Parameters:
  • kind

  • p

  • shape

  • defer_bend -- (default: False)

  • use_coverage -- (default: True)

infinigen.perf.assets.objects.leaves.planar_native.create_mesh(obj, kind, params)[source]#
Parameters:
  • obj

  • kind

  • params

Module contents#

Monocot (.perf.assets.objects.monocot)#

agave#
class infinigen.perf.assets.objects.monocot.agave.AgaveMonocotFactory(factory_seed, coarse=False)[source]#

Bases: AgaveMonocotFactory

use_distance = True#
static double_leaf(...)[source]#

Two-sheet agave leaf built on arrays, sharing the lower-sheet vertices that move at most weld (the outline) in place of the default’s join and weld.

Parameters:
  • obj

  • distance

  • z_offset

  • z_ratio

  • weld -- (default: 0.0002)

build_leaf(face_size)[source]#
Parameters:

face_size

growth#
infinigen.perf.assets.objects.monocot.growth.translate_to_leftmost(obj, offset=(0, 0, 0))[source]#

Shift the vertices so the leftmost one sits at offset, like origin2leftmost followed by applying the location.

Parameters:
  • obj

  • offset -- (default: (0, 0, 0))

class infinigen.perf.assets.objects.monocot.growth.MonocotGrowthFactory(factory_seed, coarse=False)[source]#

Bases: MonocotGrowthFactory

use_distance = False#
static decorate_leaf(...)[source]#

Bend, cup and roughen the leaf on its vertex array and put its leftmost vertex at the origin, drawing the default’s random numbers. The default runs instead when direct_monocot_leaves is off.

Parameters:
  • obj

  • y_ratio -- (default: 4)

  • y_bend_angle -- (default: 0.524)

  • z_bend_angle -- (default: 0.524)

  • noise_scale -- (default: 0.1)

  • strength -- (default: 0.02)

  • leftmost -- (default: True)

build_instance(i, face_size)[source]#
Parameters:
  • i

  • face_size

leaf_direct#

Leaf sheet built from arrays instead of by operators.

The optimized draw.leaf uses it unless direct_monocot_leaves is off. Its lattice matches the default operator chain’s; its faces differ.

infinigen.perf.assets.objects.monocot.leaf_direct.mesh_from_polygons(...)[source]#

Mesh datablock of polygons given as flat loop vertices and per-polygon counts.

Parameters:
  • verts

  • loop_verts

  • loop_totals

  • name -- (default: '')

infinigen.perf.assets.objects.monocot.leaf_direct.mesh_from_arrays(...)[source]#

Mesh datablock of quads followed by tris.

Parameters:
  • verts

  • quads

  • tris -- (default: None)

  • name -- (default: '')

infinigen.perf.assets.objects.monocot.leaf_direct.leaf_direct(...)[source]#
Parameters:
  • x_anchors

  • y_anchors

  • vector_locations

  • face_size

leaf_grid#

The planar sheet of the default draw.leaf, built in numpy without bpy.

It sits on the remesh’s lattice, but its outline vertices and face counts differ from the operator chain’s.

infinigen.perf.assets.objects.monocot.leaf_grid.blender_handles(points, vector)[source]#

Left and right handles of an open Bezier spline by Blender’s auto rule: the ends mirror their neighbour and each chord is clamped to five times the other. vector handles sit a third of the way to their neighbour.

Parameters:
  • points

  • vector

infinigen.perf.assets.objects.monocot.leaf_grid.weld_chain(poly, threshold)[source]#

Weld modifier on a polyline: runs of points closer than threshold merge.

Parameters:
  • poly

  • threshold

infinigen.perf.assets.objects.monocot.leaf_grid.bezier_polyline(...)[source]#

Polyline of draw.bezier_curve(anchors, vector_locations). Segments are cut last to first at equal Bezier parameter, and recomputing the handles after each cut reshapes the segments still to come. Consecutive points within weld then merge.

Parameters:
  • anchors

  • vector_locations -- (default: ())

  • min_length -- (default: 0.005)

  • max_cuts -- (default: 64)

  • weld -- (default: 0.001)

infinigen.perf.assets.objects.monocot.leaf_grid.leaf_outline(x_anchors, y_anchors, vector_locations=())[source]#

Closed 2-D outline draw.leaf fills: the lower (-y) polyline forward, then the upper (+y) one back, with the shared ends welded.

Parameters:
  • x_anchors

  • y_anchors

  • vector_locations -- (default: ())

infinigen.perf.assets.objects.monocot.leaf_grid.remesh_lattice(poly, resolution=0.005, thickness=0.1)[source]#

Cell size and origin of the sharp remesh lattice in draw.remesh_fill, sized as the remesh modifier sizes its octree over the solidified slab’s bounding box, whose centre is a lattice corner.

Parameters:
  • poly

  • resolution -- (default: 0.005)

  • thickness -- (default: 0.1)

infinigen.perf.assets.objects.monocot.leaf_grid.sheet_from_outline(...)[source]#

Planar (verts, (quads, tris), boundary) sheet of poly on the lattice. Each cell with a corner inside gets a vertex at its centre, or at the mean of its outline samples where the outline crosses it, and each inside corner a quad. The sheet is welded at weld and cut down to its largest connected piece.

Parameters:
  • poly

  • cell

  • origin

  • weld -- (default: 0.0)

  • boundary_samples -- (default: 4)

infinigen.perf.assets.objects.monocot.leaf_grid.weld_groups(verts, threshold, tree=None)[source]#

Each vertex’s group under BLI_kdtree_3d_calc_duplicates_fast, Blender’s merge by distance: in index order, each untouched vertex absorbs the untouched ones within threshold, so merges never chain. Each label is the absorber’s index or the vertex’s own.

Parameters:
  • verts

  • threshold

  • tree -- (default: None)

infinigen.perf.assets.objects.monocot.leaf_grid.leaf_sheet(...)[source]#

(verts, (quads, tris), boundary) of the sheet draw.leaf builds for the anchors, welded at weld (face_size / 2 in draw.leaf, 0 for none).

Parameters:
  • x_anchors

  • y_anchors

  • vector_locations -- (default: ())

  • weld -- (default: 0.0)

pinecone#
class infinigen.perf.assets.objects.monocot.pinecone.PineconeFactory(*args, **kwargs)[source]#

Bases: PineconeFactory

create_asset(*args, **kwargs)[source]#
create_raw(*args, **kwargs)[source]#
build_stem(*args, **kwargs)[source]#
decorate_monocot(*args, **kwargs)[source]#
build_instance(*args, **kwargs)[source]#
make_collection(*args, **kwargs)[source]#
Module contents#

Mushroom (.perf.assets.objects.mushroom)#

adaptive#

Mushroom placement with a lazy surface tree per mushroom.

infinigen.perf.assets.objects.mushroom.adaptive.mesh_buffers(obj)[source]#
Parameters:

obj

infinigen.perf.assets.objects.mushroom.adaptive.find_locations(...)[source]#
Parameters:
  • keys

  • rotations

  • start_locs

  • directions

  • radius

  • tolerance

meshing#
infinigen.perf.assets.objects.mushroom.meshing.triangle_budget(profile, face_size)[source]#
Parameters:
  • profile

  • face_size

infinigen.perf.assets.objects.mushroom.meshing.spin(...)[source]#
Parameters:
  • anchors

  • vector_locations -- (default: ())

  • face_size -- (default: None)

infinigen.perf.assets.objects.mushroom.meshing.remesh_with_attrs(obj, face_size, **kwargs)[source]#
Parameters:
  • obj

  • face_size

infinigen.perf.assets.objects.mushroom.meshing.cap_attributes(obj, factory)[source]#
Parameters:
  • obj

  • factory

infinigen.perf.assets.objects.mushroom.meshing.native_fields_enabled()[source]#

True on Blender 4.2, whose texture evaluation the native field kernels match.

infinigen.perf.assets.objects.mushroom.meshing.voronoi_mask(...)[source]#
Parameters:
  • obj

  • scale

  • randomness

  • threshold

infinigen.perf.assets.objects.mushroom.meshing.web_mask(obj, factory)[source]#
Parameters:
  • obj

  • factory

infinigen.perf.assets.objects.mushroom.meshing.texture_displace(obj, texture, strength=0.008)[source]#
Parameters:
  • obj

  • texture

  • strength -- (default: 0.008)

infinigen.perf.assets.objects.mushroom.meshing.extension(obj, noise_strength=0.2)[source]#
Parameters:
  • obj

  • noise_strength -- (default: 0.2)

infinigen.perf.assets.objects.mushroom.meshing.displace_vertices(obj, fn)[source]#
Parameters:
  • obj

  • fn

infinigen.perf.assets.objects.mushroom.meshing.origin2lowest(obj)[source]#
Parameters:

obj

Module contents#

Small Plants (.perf.assets.objects.small_plants)#

fern#
infinigen.perf.assets.objects.small_plants.fern.level1_yaxis_rotation(points)[source]#
Parameters:

points

infinigen.perf.assets.objects.small_plants.fern.level1_zaxis_rotation(points)[source]#
Parameters:

points

infinigen.perf.assets.objects.small_plants.fern.level1_gravity_rotation(points)[source]#
Parameters:

points

infinigen.perf.assets.objects.small_plants.fern.level1_xaxis_rotation()[source]#
infinigen.perf.assets.objects.small_plants.fern.level1_stein()[source]#
infinigen.perf.assets.objects.small_plants.fern.level1_scale(pinnae_contour)[source]#
Parameters:

pinnae_contour

infinigen.perf.assets.objects.small_plants.fern.level1_instance_rotation()[source]#
infinigen.perf.assets.objects.small_plants.fern.level1_rotation(params)[source]#
Parameters:

params

infinigen.perf.assets.objects.small_plants.fern.level1_instance_position(pinnae_contour)[source]#
Parameters:

pinnae_contour

infinigen.perf.assets.objects.small_plants.fern.level2_rotation(z_axis_rotate, y_axis_rotate, x_axis_rotate)[source]#
Parameters:
  • z_axis_rotate

  • y_axis_rotate

  • x_axis_rotate

infinigen.perf.assets.objects.small_plants.fern.level2_set_point(pinna_contour)[source]#
Parameters:

pinna_contour

infinigen.perf.assets.objects.small_plants.fern.level2_instance_on_points(leaf, pinna_contour)[source]#
Parameters:
  • leaf

  • pinna_contour

infinigen.perf.assets.objects.small_plants.fern.level2_stein()[source]#
infinigen.perf.assets.objects.small_plants.fern.geometry_pinnae_nodes(...)[source]#
Parameters:
  • leaf

  • leaf_num_param -- (default: 18)

  • age_param -- (default: 0.4)

  • pinna_num_param -- (default: 40)

  • version_num_param -- (default: 4)

  • gravity_rotation -- (default: 1)

class infinigen.perf.assets.objects.small_plants.fern.FernFactory(factory_seed, coarse=False)[source]#

Bases: FernFactory

Default FernFactory with templated node groups: within one asset, each builder above builds its group once, then copies and re-parametrizes it.

create_asset(**params)[source]#
debug_asset(**params)[source]#
Module contents#

Trees (.perf.assets.objects.trees)#

Native (.perf.assets.objects.trees.native)#
Utils (.perf.assets.objects.trees.utils)#
geometrynodes#
infinigen.perf.assets.objects.trees.utils.geometrynodes.sample_points_and_normals(...)[source]#
Parameters:
  • obj

  • max_density -- (default: 3)

  • surface_dist -- (default: 1)

  • max_points -- (default: 10000)

helper#
infinigen.perf.assets.objects.trees.utils.helper.rodrigues_rot(...)[source]#

Default rotation of one 3-vector written out element-wise, which is cheaper than numpy’s cross and norm on three values.

Parameters:
  • vec

  • axis

  • angle

  • convert_to_rad -- (default: False)

mesh#
infinigen.perf.assets.objects.trees.utils.mesh.init_mesh(...)[source]#
Parameters:
  • name

  • verts -- (default: [])

  • edges -- (default: [])

  • faces -- (default: [])

  • coll -- (default: None)

infinigen.perf.assets.objects.trees.utils.mesh.sample_vtxs(...)[source]#

Sample points on or in a mesh, with the native sampler when the optional GPL extension is built and Blender’s particle system otherwise.

Parameters:
  • obj

  • emit_from -- (default: 'VOLUME')

  • n -- (default: 1000)

  • seed -- (default: 1)

infinigen.perf.assets.objects.trees.utils.mesh.get_pts_from_shape(...)[source]#
Parameters:
  • shape_fn

  • n -- (default: 10)

  • emit_from -- (default: 'VOLUME')

  • loc -- (default: (0, 0, 0))

  • scaling -- (default: 1)

  • pt_offset -- (default: 0)

Module contents#
generate#
infinigen.perf.assets.objects.trees.generate.native_meshing(factory)[source]#

Whether this factory’s trunks are meshed natively, each stem retessellated as its own tube instead of remeshing the whole trunk. Used where the default would remesh unless native_tree_meshing.enabled = False or the cylinder kernel is not built; adapt_mesh_method=”stem_tessellate” forces it.

Parameters:

factory

class infinigen.perf.assets.objects.trees.generate.GenericTreeFactory(
factory_seed,
genome,
child_col,
trunk_surface,
realize=False,
meshing_cameras=None,
cam_meshing_max_dist=10000000.0,
coarse_mesh_placeholder=False,
adapt_mesh_method='remesh',
decimate_placeholder_levels=0,
min_dist=None,
coarse=False,
)[source]#

Bases: GenericTreeFactory

Parameters:

genome (TreeParams)

create_placeholder(i, loc, rot)[source]#
Parameters:
  • i

  • loc

  • rot

finalize_placeholders(placeholders)[source]#
Parameters:

placeholders

create_asset(...) → bpy_types.Object[source]#
Parameters:
  • placeholder

  • face_size

  • distance

infinigen.perf.assets.objects.trees.generate.make_leaf_collection(...)[source]#
Parameters:
  • seed

  • leaf_params

  • n_leaf

  • leaf_types

  • decimate_rate -- (default: 0.0)

  • season -- (default: None)

tessellate#

Retessellation of the independent tubes that Geometry Nodes builds for tree stems.

infinigen.perf.assets.objects.trees.tessellate.retessellate_stems(...) → None[source]#
Parameters:
  • obj (Object)

  • face_size (float)

  • profile_resolution (int) -- (default: 20)

  • edge_length_ceiling_factor (float) -- (default: 1.0)

tree#
class infinigen.perf.assets.objects.trees.tree.TreeVertices(*args, **kwargs)[source]#

Bases: TreeVertices

property vtxs#
get_idxs()[source]#
get_edges()[source]#
append(v, p, l=None)[source]#
Parameters:
  • v

  • p

  • l -- (default: None)

class infinigen.perf.assets.objects.trees.tree.FineTreeVertices(*args, **kwargs)[source]#

Bases: FineTreeVertices, TreeVertices

infinigen.perf.assets.objects.trees.tree.parse_tree_attributes(vtx)[source]#

Linear-time tree attributes when parents precede children; else the default.

Parameters:

vtx

infinigen.perf.assets.objects.trees.tree.space_colonization(...)[source]#
Parameters:
  • tree

  • atts

  • D -- (default: 0.1)

  • d -- (default: 10.0)

  • s -- (default: 0.1)

  • pull_dir -- (default: None)

  • dir_rand -- (default: 0.1)

  • mag_rand -- (default: 0.15)

  • n_steps -- (default: 200)

  • level -- (default: 0)

infinigen.perf.assets.objects.trees.tree.tree_skeleton(...)[source]#
Parameters:
  • skeleton_params (dict)

  • trunk_spacecol (dict)

  • roots_spacecol (dict)

  • init_pos

  • scale

infinigen.perf.assets.objects.trees.tree.skin_tree_unmerged(nw, params)[source]#

tree.skin_tree without welding where nearby stems meet, for native meshing.

Parameters:
  • nw

  • params

infinigen.perf.assets.objects.trees.tree.rand_path(...)[source]#

Default rand_path with the random steps drawn in one call (the same stream as one draw per step) and 3-vector norms taken directly.

Parameters:
  • n_pts

  • sz -- (default: 1)

  • std -- (default: 0.3)

  • momentum -- (default: 0.5)

  • init_vec -- (default: [0, 0, 1])

  • init_pt -- (default: [0, 0, 0])

  • pull_dir -- (default: None)

  • pull_init -- (default: 1)

  • pull_factor -- (default: 0)

  • sz_decay -- (default: 1)

  • decay_mom -- (default: True)

infinigen.perf.assets.objects.trees.tree.recursive_path(...)[source]#

Default recursive_path, numbering new vertices with a range.

Parameters:
  • tree

  • parent_idxs

  • level

  • path_kargs -- (default: None)

  • spawn_kargs -- (default: None)

  • n -- (default: 1)

  • symmetry -- (default: False)

  • children -- (default: None)

Module contents#

Module contents#

Optimized copies of asset packages, each at the path of the one it replaces.

Utils (.perf.assets.utils)#

Geometry (.perf.assets.utils.geometry)#

metaballs#
class infinigen.perf.assets.utils.geometry.metaballs.MBallStructure[source]#

Bases: object

Default to_object, first making the metaball evaluable: the depsgraph skips objects outside the scratch view layer the optimized placement builds in.

to_object()[source]#
Module contents#

Heightfield (.perf.assets.utils.heightfield)#

coverage#
infinigen.perf.assets.utils.heightfield.coverage.coverage_slices(mask, *, padding=1)[source]#

Row and column slices around the true samples of mask, padded and clipped.

Parameters:
  • mask

  • padding -- (default: 1)

infinigen.perf.assets.utils.heightfield.coverage.upsample_mask(mask, full_shape)[source]#

Nearest-neighbor upsample of mask to full_shape, with no padding: the coarse mask must already cover every sample the caller may occupy.

Parameters:
  • mask

  • full_shape

class infinigen.perf.assets.utils.heightfield.coverage.RasterCanvas(full_size, x_start, x_stop, y_start, y_stop)[source]#

Bases: object

Rectangle of an endpoint-aligned square sampling lattice, stops inclusive.

Parameters:
infinigen.perf.assets.utils.heightfield.coverage.canvas_from_coverage_mask(
size,
mask,
) → RasterCanvas[source]#

Smallest canvas of the size x size lattice holding mask.

Parameters:
mesh#
infinigen.perf.assets.utils.heightfield.mesh.precondition_flat_grid_regions(...) → tuple[np.ndarray, int, int][source]#

Fan-triangulate grid blocks planar within tolerance and keep the other cells, returning the faces and the flat cell and block counts. Flat blocks keep every boundary lattice vertex, so they meet their neighbors without cracks.

Parameters:
infinigen.perf.assets.utils.heightfield.mesh.simplify_geometry(...) → tuple[np.ndarray, np.ndarray, np.ndarray, float][source]#

Edge-collapse a triangle mesh with meshoptimizer to face_budget or ratio (give one), stopping early at relative target_error. Returns the kept vertices, remapped faces, their source indices and the relative error. regularize trades error for even triangles, update_positions moves kept vertices to quadric optima, metric_scale scales XYZ only in the error so small height-field relief counts, and features (N, C) weighted by feature_weights (C,) join the error.

Parameters:
  • vertices (ndarray)

  • faces (ndarray)

  • face_budget (int | None) -- (default: None)

  • ratio (float | None) -- (default: None)

  • lock_border (bool) -- (default: False)

  • target_error (float) -- (default: 1e+30)

  • regularize (str) -- (default: 'none')

  • update_positions (bool) -- (default: False)

  • metric_scale (tuple[float, float, float]) -- (default: (1.0, 1.0, 1.0))

  • features (ndarray | None) -- (default: None)

  • feature_weights (ndarray | None) -- (default: None)

infinigen.perf.assets.utils.heightfield.mesh.simplify_geometry_with_fields(
...,
) → tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, float][source]#

simplify_geometry moving vertices to each collapse’s quadric target, with fields (N, C up to 32) interpolated there without affecting the collapse. Returns positions, remapped faces, source indices, fields and the error.

Parameters:
  • vertices (ndarray)

  • faces (ndarray)

  • fields (ndarray)

  • face_budget (int | None) -- (default: None)

  • ratio (float | None) -- (default: None)

  • lock_border (bool) -- (default: False)

  • target_error (float) -- (default: 1e+30)

  • regularize (str) -- (default: 'none')

  • metric_scale (tuple[float, float, float]) -- (default: (1.0, 1.0, 1.0))

infinigen.perf.assets.utils.heightfield.mesh.sample_masked_raster(raster, coordinates, *, mask=None) → np.ndarray[source]#

Bilinearly sample raster at normalized (x, y) coordinates. Corners outside mask get no weight (the nearest one is used if all are), so values outside an asset do not bleed into its contour.

Parameters:
mesh_route#

Leaf meshes simplified straight from dense rasters of the default leaves’ fields.

The default decimates 97% of its fine grid; the raster keeps the grid’s density, as sampling near the final face count aliases narrow veins and the outline.

infinigen.perf.assets.utils.heightfield.mesh_route.raster_shape(asset_type) → tuple[int, int][source]#

Dense (height, width) sampling resolution for asset_type.

Parameters:

asset_type (str)

infinigen.perf.assets.utils.heightfield.mesh_route.leaf_collection_decimation(decimate_rate, *, face_size=None)[source]#

Scale the leaf face budget, set for the default’s 0.97, to decimate_rate instead of decimating again. face_size, when given, takes precedence and asks for a world-space triangle edge length, as tree face_size does.

Parameters:
  • decimate_rate (float)

  • face_size (float | None) -- (default: None)

infinigen.perf.assets.utils.heightfield.mesh_route.requested_leaf_face_size() → float | None[source]#

World-space face size requested by leaf_collection_decimation, if any.

infinigen.perf.assets.utils.heightfield.mesh_route.leaf_asset_scale(scale)[source]#

Set the local-to-world uniform scale that turns face_size into a budget.

Parameters:

scale (float)

infinigen.perf.assets.utils.heightfield.mesh_route.enabled() → bool[source]#

Whether leaves are built through the height-field route.

infinigen.perf.assets.utils.heightfield.mesh_route.mark_final_mesh(obj) → None[source]#

Mark obj as built here, so the leaf collection does not decimate it.

Parameters:

obj

infinigen.perf.assets.utils.heightfield.mesh_route.is_final_mesh(obj) → bool[source]#
Parameters:

obj

infinigen.perf.assets.utils.heightfield.mesh_route.convert_active_to_mesh(obj)[source]#

Convert obj’s evaluated geometry to a mesh, keeping the material slots that a Mesh Grid node’s output drops.

Parameters:

obj

infinigen.perf.assets.utils.heightfield.mesh_route.convert_raster_fields_to_mesh(...)[source]#

Replace obj’s mesh with one simplified from the field rasters, with simplify_features mapping raster field names to their error weights.

Parameters:
  • obj

  • asset_type (str)

  • fields (dict)

  • simplify_features (dict[str, float] | None) -- (default: None)

reconstruction#
infinigen.perf.assets.utils.heightfield.reconstruction.correct_field_residuals(...)[source]#

Move transported vertex values toward the raster sampled at chart (normalized raster coordinates) by one strength per channel, clipped to [0, 1], minimizing the piecewise-linear error over covered pixels. Returns the values and strengths; one scalar per channel avoids the overshoot of a per-vertex fit and keeps each value between its transported and resampled value.

Parameters:
  • raster

  • mask

  • chart

  • triangles

  • transported

Module contents#

Dense field rasterization and simplification for procedural assets.

decorate#

Reads and writes in each property’s own dtype, and deletions outside edit mode.

distance2boundary takes the edges with one face as the boundary, which can differ from what region_to_loop selects, so its selection may differ from the default’s.

infinigen.perf.assets.utils.decorate.mesh_boundary(obj)[source]#

Boolean masks of the boundary edges (one adjacent face) and their vertices.

Parameters:

obj

infinigen.perf.assets.utils.decorate.distance2boundary(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_area(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_base_co(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_center(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_co(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_edges(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_loop_edges(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_loop_starts(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_loop_totals(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_loop_vertices(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_material_index(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_normal(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.read_selected(obj, domain='VERT')[source]#
Parameters:
  • obj

  • domain -- (default: 'VERT')

infinigen.perf.assets.utils.decorate.read_uv(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.decorate.remove_edges(obj, to_delete)[source]#
Parameters:
  • obj

  • to_delete

infinigen.perf.assets.utils.decorate.remove_vertices(obj, to_delete)[source]#
Parameters:
  • obj

  • to_delete

infinigen.perf.assets.utils.decorate.write_co(obj, arr)[source]#
Parameters:
  • obj

  • arr

infinigen.perf.assets.utils.decorate.write_material_index(obj, arr)[source]#
Parameters:
  • obj

  • arr

infinigen.perf.assets.utils.decorate.write_uv(obj, arr)[source]#
Parameters:
  • obj

  • arr

deform#

infinigen.perf.assets.utils.deform.simple_deform(...)[source]#

Blender’s SIMPLE_DEFORM (BEND or TWIST; no origin, vertex group or lock axis) on a copy of the (N, 3) co. The angle spans the limits fraction of the extent along the limit axis (the deform axis for twist; Z for a bend about X or Y, X for a bend about Z); points outside are clamped and their overshoot added back.

Parameters:
  • co

  • mode

  • angle

  • deform_axis -- (default: 'X')

  • limits -- (default: (0.0, 1.0))

infinigen.perf.assets.utils.deform.rotation_y(angle)[source]#
Parameters:

angle

infinigen.perf.assets.utils.deform.rotation_z(angle)[source]#
Parameters:

angle

infinigen.perf.assets.utils.deform.apply_rotation(co, matrix)[source]#

Coordinates after transform_apply(rotation=True) with the 3x3 matrix.

Parameters:
  • co

  • matrix

draw#

curve2mesh and remesh_fill (CORE) skip an operator call and a geometry-nodes pass; leaf (MONOCOT) builds its sheet from arrays for all callers, monocot or not.

infinigen.perf.assets.utils.draw.monocot_legacy()[source]#

True when direct_monocot_leaves.enabled = False asks for the default, operator-based monocot leaf sheets, decoration and agave join.

infinigen.perf.assets.utils.draw.curve2mesh(obj)[source]#
Parameters:

obj

infinigen.perf.assets.utils.draw.remesh_fill(obj, resolution=0.005)[source]#
Parameters:
  • obj

  • resolution -- (default: 0.005)

infinigen.perf.assets.utils.draw.leaf(...)[source]#

Planar leaf sheet in the Bezier outline through the anchors (mirrored in y), on remesh_fill’s lattice, with a “boundary” vertex group. Built from arrays unless direct_monocot_leaves is off, keeping whole outline cells the operators trim, so it has somewhat more faces than the default.

Parameters:
  • x_anchors

  • y_anchors

  • vector_locations -- (default: ())

  • subdivision -- (default: 64)

  • face_size -- (default: None)

mesh_io#

Direct access to Blender 4.2 mesh buffers, checked against RNA, with RNA fallbacks on other versions and layouts.

infinigen.perf.assets.utils.mesh_io.write_faces(mesh, counts)[source]#
Parameters:
  • mesh

  • counts

infinigen.perf.assets.utils.mesh_io.read_triangles(mesh)[source]#
Parameters:

mesh

infinigen.perf.assets.utils.mesh_io.read_normals(mesh)[source]#
Parameters:

mesh

infinigen.perf.assets.utils.mesh_io.write_positions(mesh, values)[source]#
Parameters:
  • mesh

  • values

infinigen.perf.assets.utils.mesh_io.writable_attribute(...)[source]#

Writable view of a new, unshared Blender 4.2 attribute, or None. Call only after allocating all mesh domains and attributes; the caller keeps the mesh alive, does not resize it, and updates it after writing.

Parameters:
  • mesh

  • name

  • width

  • dtype

reaction_diffusion#

Gray-Scott steps as one numba pass each, summing edges in np.bincount’s order and updating in the default’s expression order, so the fields match the default bit for bit. Without numba the default’s array passes run.

infinigen.perf.assets.utils.reaction_diffusion.reaction_diffusion(...)[source]#
Parameters:
  • obj

  • weight_fn

  • steps -- (default: 1000)

  • dt -- (default: 1.0)

  • scale -- (default: 0.5)

  • diff_a -- (default: 0.18)

  • diff_b -- (default: 0.09)

  • feed_rate -- (default: 0.055)

  • kill_rate -- (default: 0.062)

  • perturb -- (default: 0.05)

surface_fields#

class infinigen.perf.assets.utils.surface_fields.PendingScalarDisplacement(
evaluator: 'Callable[[np.ndarray, dict[str, np.ndarray]], np.ndarray]',
material: 'bpy.types.Material | None',
attributes: 'tuple[str, ...]',
capture_position_as: 'str | None',
)[source]#

Bases: object

Parameters:
infinigen.perf.assets.utils.surface_fields.defer_scalar_displacement(...) → None[source]#

Register a scalar normal displacement for obj, applied by apply_pending.

Parameters:
infinigen.perf.assets.utils.surface_fields.has_pending(obj) → bool[source]#
Parameters:

obj (Object)

infinigen.perf.assets.utils.surface_fields.transfer_pending(source, *targets) → None[source]#

Move source’s registered field to targets, the pieces it was split into.

Parameters:
  • source (Object)

  • targets (Object)

infinigen.perf.assets.utils.surface_fields.apply_pending(obj) → bool[source]#

Displace the vertices along their normals by the registered field and assign its material; return whether one was registered.

Parameters:

obj (Object)

Module contents#

Module contents#

Core (.perf.core)#

Nodes (.perf.core.nodes)#

Nodegroups (.perf.core.nodes.nodegroups)#

transfer_attributes#
infinigen.perf.core.nodes.nodegroups.transfer_attributes.uvs_to_attribute(obj, name='uv_map')[source]#
Parameters:
  • obj

  • name -- (default: 'uv_map')

infinigen.perf.core.nodes.nodegroups.transfer_attributes.attribute_to_uvs(obj, attr_name)[source]#
Parameters:
  • obj

  • attr_name

infinigen.perf.core.nodes.nodegroups.transfer_attributes.transfer_all_with_nearest(...)[source]#

transfer_all, copying the POINT attributes in nearest_point_attributes from the nearest source vertex instead of sampling the nearest surface. With none listed it builds the same nodes as transfer_all, which is not gated.

Parameters:
  • source

  • target

  • attributes -- (default: None)

  • uvs -- (default: False)

  • nearest_point_attributes -- (default: None)

Module contents#

Module contents#

Placement (.perf.core.placement)#

animation_policy#

Trajectory search that evaluates only the animated object when setting a frame.

Inside a fast AnimationScope, set_frame updates just the scratch view layer holding the object; the main one catches up at its next evaluation. Keyframes are the default’s.

infinigen.perf.core.placement.animation_policy.reads_depsgraph(fn)[source]#

Whether policy or pose validator fn may read evaluated data of objects other than the animated one; True unless it is None or known to read only that object.

Parameters:

fn

class infinigen.perf.core.placement.animation_policy.AnimationScope(obj, policy_func=None, validate_pose_func=None, tag=None)[source]#

Bases: object

Context evaluating only the animated object while its trajectory is built, in the view layer of an enclosing scope or isolated asset build if there is one.

active = []#
infinigen.perf.core.placement.animation_policy.set_frame(frame)[source]#

frame_set(frame) for just the animated object in a fast AnimationScope.

Parameters:

frame

infinigen.perf.core.placement.animation_policy.validate_keyframe_range(...)[source]#
Parameters:
  • obj

  • start_frame

  • end_frame

  • bvhtree

  • validate_pose_func -- (default: None)

  • stride -- (default: 1)

  • check_straight_line -- (default: True)

  • check_keyframe_straight_line -- (default: True)

infinigen.perf.core.placement.animation_policy.animate_trajectory(...)[source]#
Parameters:
  • obj

  • bvh

  • policy_func

  • validate_pose_func -- (default: None)

  • max_step_tries -- (default: 25)

  • max_full_retries -- (default: 40)

  • retry_rotation -- (default: False)

  • verbose -- (default: True)

  • fatal -- (default: False)

  • reverse_time -- (default: False)

  • bounding_box -- (default: None)

  • path_finding_enabled -- (default: False)

infinigen.perf.core.placement.animation_policy.policy_create_bezier_path(...)[source]#
Parameters:
  • start_pose_obj

  • bvh

  • policy_func

  • to_mesh -- (default: False)

  • eval_offset -- (default: (0, 0, 0))

camera#

infinigen.perf.core.placement.camera.get_sensor_coords(...)[source]#
Parameters:
  • cam

  • H

  • W

  • sparse -- (default: False)

infinigen.perf.core.placement.camera.terrain_camera_query(...)[source]#
Parameters:
  • cam (Object)

  • scene_bvh (BVHTree)

  • terrain_tags_queries

  • vertexwise_min_dist

  • min_dist -- (default: 0)

infinigen.perf.core.placement.camera.prefetch_terrain_sdf(terrain, cams, frames)[source]#

Evaluate the terrain SDF at the positions cams take on frames in one call and keep the values for keep_cam_pose_proposal, which evaluates one point at a time. Positions are read as the validator reads them, after set_frame, and each value is the one a single-point evaluation returns.

Parameters:
  • terrain

  • cams

  • frames

infinigen.perf.core.placement.camera.keep_cam_pose_proposal(...)[source]#
Parameters:
  • cam (Object)

  • terrain (Terrain)

  • scene_bvh (BVHTree)

  • placeholders_kd

  • camera_selection_answers

  • vertexwise_min_dist

  • camera_selection_ratio

  • min_placeholder_dist -- (default: 0)

  • min_terrain_distance -- (default: 0)

  • terrain_coverage_range -- (default: (0.5, 1))

infinigen.perf.core.placement.camera.compute_base_views(...)[source]#
Parameters:
  • camera_rig (Object)

  • n_views (int)

  • terrain

  • scene_bvh (BVHTree)

  • location_sample (Callable)

  • center_coordinate -- (default: None)

  • radius -- (default: None)

  • bbox -- (default: None)

  • placeholders_kd -- (default: None)

  • min_candidates_ratio -- (default: 20)

  • max_tries -- (default: 30000)

  • visualize -- (default: False)

camera_trajectories#

compute_trajectories with its whole search in one AnimationScope, so each frame change evaluates the probe camera alone. Trajectories, scores and keyframes are the default’s.

infinigen.perf.core.placement.camera_trajectories.compute_trajectories(...)[source]#
Parameters:
  • cam_rigs

  • base_views

  • scene_preprocessed (dict)

  • obj_groups -- (default: None)

  • camera_selection_answers -- (default: {})

  • camera_selection_ratio -- (default: None)

  • min_candidates_ratio -- (default: 5)

  • pois -- (default: None)

  • animation_mode (str) -- (default: 'random_walk')

  • validate_pose_func -- (default: None)

detail#

infinigen.perf.core.placement.detail.remesh_with_attrs(...)[source]#
Parameters:
  • obj

  • face_size

  • apply -- (default: True)

  • min_remesh_size -- (default: None)

  • attributes -- (default: None)

  • nearest_point_attributes -- (default: None)

infinigen.perf.core.placement.detail.sharp_remesh_with_attrs(...)[source]#
Parameters:
  • obj

  • face_size

  • apply -- (default: True)

  • min_remesh_size -- (default: None)

  • attributes -- (default: None)

  • nearest_point_attributes -- (default: None)

infinigen.perf.core.placement.detail.min_max_edgelen(mesh)[source]#
Parameters:

mesh

infinigen.perf.core.placement.detail.adapt_mesh_resolution(...)[source]#
Parameters:
  • obj

  • face_size

  • method

  • approx -- (default: 0.2)

factory#

class infinigen.perf.core.placement.factory.AssetFactory(factory_seed=None, coarse=False)[source]#

Bases: AssetFactory

spawn_placeholder(i, loc, rot)[source]#
Parameters:
  • i

  • loc

  • rot

spawn_asset(...)[source]#
Parameters:
  • i

  • placeholder -- (default: None)

  • distance -- (default: None)

  • vis_distance -- (default: 0)

  • loc -- (default: (0, 0, 0))

  • rot -- (default: (0, 0, 0))

infinigen.perf.core.placement.factory.make_asset_collection(...)[source]#
Parameters:
  • spawn_fns

  • n

  • name -- (default: None)

  • weights -- (default: None)

  • as_list -- (default: False)

  • verbose -- (default: True)

  • centered -- (default: False)

placement#

infinigen.perf.core.placement.placement.placeholder_locs(...)[source]#
Parameters:
  • terrain

  • overall_density

  • selection

  • distance_min -- (default: 0)

  • altitude -- (default: 0.0)

  • max_locs -- (default: None)

infinigen.perf.core.placement.placement.scatter_placeholders(locations, factory)[source]#
Parameters:
infinigen.perf.core.placement.placement.filter_populate_targets(...) → list[tuple[bpy_types.Object, float, float]][source]#
Parameters:
infinigen.perf.core.placement.placement.populate_collection(...)[source]#
Parameters:
  • factory (AssetFactory)

  • placeholder_col (pf.Collection)

  • cameras (list[Object]) -- (default: None)

  • asset_col_target -- (default: None)

  • dist_cull -- (default: None)

  • vis_cull -- (default: None)

  • verbose -- (default: True)

  • cache_system -- (default: None)

Module contents#

Util (.perf.core.util)#

blender#

butil counterparts and Blender helpers for the optimized packages.

Inside an isolated build, select and SelectObjects expose an object missing from the scratch view layer instead of refusing it, and to_mesh makes it evaluable first.

infinigen.perf.core.util.blender.save_blend(path, autopack=False, verbose=False)[source]#

butil.save_blend, compressed unless compress_output_blend is off.

Parameters:
  • path

  • autopack -- (default: False)

  • verbose -- (default: False)

infinigen.perf.core.util.blender.apply_modifiers_via_evaluated_mesh(obj)[source]#

Materialize a mesh modifier stack without the object operator.

Parameters:

obj (Object)

class infinigen.perf.core.util.blender.SelectObjects[source]#

Bases: object

Counterpart of butil.SelectObjects; holds only the method that differs.

infinigen.perf.core.util.blender.select(objs)[source]#
Parameters:

objs (Object | list[Object])

infinigen.perf.core.util.blender.to_mesh(object, context=<bpy_struct, Context>)[source]#
Parameters:
  • object

  • context -- (default: <bpy_struct, Context>)

blender_gc#

Counterparts of butil garbage collection, collection membership, parenting and instance counting.

infinigen.perf.core.util.blender_gc.garbage_collect(...)[source]#
Parameters:
  • targets

  • keep_in_use -- (default: True)

  • keep_names -- (default: None)

  • verbose -- (default: False)

infinigen.perf.core.util.blender_gc.count_instance()[source]#
infinigen.perf.core.util.blender_gc.group_in_collection(...)[source]#

Collect objs (each None, an object or a list) and their children in name.

Parameters:
  • objs

  • name (str)

  • reuse -- (default: True)

infinigen.perf.core.util.blender_gc.parent_to(...)[source]#
Parameters:
  • a

  • b

  • type -- (default: 'OBJECT')

  • keep_transform -- (default: False)

  • no_inverse -- (default: False)

  • no_transform -- (default: False)

infinigen.perf.core.util.blender_gc.put_in_collection(objs, collection, exclusive=True)[source]#
Parameters:
  • objs

  • collection

  • exclusive -- (default: True)

Parameters:

obj

isolation#

Build assets in a scratch view layer, since each operator call updates the view layer at a cost that grows with the objects in it.

class infinigen.perf.core.util.isolation.IsolatedScene(link=(), collections=(), tag=None, batch=False)[source]#

Bases: object

Context in which operators see only the asset being built.

The window switches to a second view layer of the same scene (switching scenes re-evaluates the target), so new objects and the object order join follows match the main layer. It holds the active collection and a link collection for link, with older objects hidden; others are exposed on demand. Contexts nest, and in a batch one earlier spawns are parked outside the layer while the next one builds.

VL_NAME = 'asset_scratch (no gc)'#
PARK_NAME = 'asset_scratch:done (no gc)'#
active = []#
classmethod ensure_selectable(obj)[source]#

Expose obj to operators in the current isolated build; False if none.

Parameters:

obj

classmethod is_parked(obj)[source]#

True if obj is a finished spawn of the enclosing batch, parked outside the scratch view layer with no base there until exposed.

Parameters:

obj

classmethod ensure_evaluable(obj)[source]#

Make the scratch view layer evaluate obj before its evaluated data is read, since evaluated_get silently returns un-evaluated data outside it. A parked spawn goes back into the active collection; another object with modifiers or a non-mesh type gets its collections included with their objects hidden, which still evaluates them but keeps them out of selection-based operators.

Parameters:

obj

prefetch#

Large sequential reads that pull cold files on a network file system into the page cache ahead of readers that issue small requests (Blender, OpenCV, pickle).

infinigen.perf.core.util.prefetch.prefetch_files(paths, threads=4, min_size=1048576)[source]#

Read every file in paths (directories recursively) once with large requests, threads files at a time, skipping files under min_size bytes. Returns the number of bytes read.

Parameters:
  • paths

  • threads -- (default: 4)

  • min_size -- (default: 1048576)

random#

infinigen.perf.core.util.random.random_general(var)[source]#

random_general with weighted_choice searching one random_sample() in the CDF of p, the same draw and index as np.random.choice without its checks.

Parameters:

var

Module contents#

execute_tasks#

init#

infinigen.perf.core.init.configure_cycles_devices(use_gpu=True)[source]#
Parameters:

use_gpu -- (default: True)

surface#

infinigen.perf.core.surface.add_geomod(...)[source]#
Parameters:
  • objs

  • geo_func

  • name -- (default: None)

  • apply -- (default: False)

  • reuse -- (default: False)

  • input_args -- (default: None)

  • input_kwargs -- (default: None)

  • attributes -- (default: None)

  • show_viewport -- (default: True)

  • selection -- (default: None)

  • domains -- (default: None)

  • input_attributes -- (default: None)

infinigen.perf.core.surface.new_attr_data(...)[source]#
Parameters:
  • obj

  • attr

  • type

  • domain

  • data (array)

infinigen.perf.core.surface.read_attr_data(...) → numpy.array[source]#
Parameters:
  • obj

  • attr

  • domain -- (default: 'POINT')

  • result_dtype -- (default: None)

infinigen.perf.core.surface.write_attr_data(...)[source]#
Parameters:
  • obj

  • attr

  • data (array)

  • type -- (default: 'FLOAT')

  • domain -- (default: 'POINT')

tagging#

Module contents#

Terrain (.perf.terrain)#

Assets (.perf.terrain.assets)#

Caves (.perf.terrain.assets.caves)#

core#
class infinigen.perf.terrain.assets.caves.core.Cave(name='Cave')[source]#

Bases: Cave

infinigen.perf.terrain.assets.caves.core.caves_asset(folder, N=128)[source]#

Build an N`^3 cave SDF grid in `folder, or return its step in planning().

Parameters:
  • folder

  • N -- (default: 128)

infinigen.perf.terrain.assets.caves.core.caves_asset_step(...)[source]#
Parameters:
  • folder

  • N

  • seed

  • sample_point_count

infinigen.perf.terrain.assets.caves.core.plan_caves_asset(folder, seed)[source]#

caves_asset’s gin-resolved step, seeded so a worker builds the same cave.

Parameters:
  • folder

  • seed

Module contents#

Landtiles (.perf.terrain.assets.landtiles)#

ant_landscape#
infinigen.perf.terrain.assets.landtiles.ant_landscape.ant_heightmap(...)[source]#

Run the ANT landscape operator and write the tile’s heightmap.

Parameters:
  • folder

  • op_kwargs

  • preset_name

  • tile_size

  • resolution

infinigen.perf.terrain.assets.landtiles.ant_landscape.ant_landscape_asset(...)[source]#
Parameters:
  • folder

  • preset_name

  • tile_size

  • resolution

  • erosion -- (default: True)

  • snowfall -- (default: True)

core#
infinigen.perf.terrain.assets.landtiles.core.landtile_asset(...)[source]#

Generate one land tile asset in folder, skipping simulations the scene never reads when called through landtile_asset_for. Erosion and snowfall run here or in the enabled land-process pool, and the finish marker is written after them.

Parameters:
  • folder

  • preset_name

  • resolution -- (default: 2048)

  • device -- (default: None)

infinigen.perf.terrain.assets.landtiles.core.landtile_asset_for(needed_process, *args, **kwargs)[source]#

landtile_asset for a scene that reads needed_process’s outputs (None, Process.Erosion or Process.Snowfall), simulating only what those need unless only_needed_land_processes is off. Asset-library generation calls landtile_asset directly and gets every output.

Parameters:

needed_process

custom#
infinigen.perf.terrain.assets.landtiles.custom.multi_mountains_asset(...)[source]#
Parameters:
  • folder

  • tile_size

  • resolution

  • device

  • erosion -- (default: True)

  • snowfall -- (default: True)

infinigen.perf.terrain.assets.landtiles.custom.coast_asset(...)[source]#
Parameters:
  • folder

  • tile_size

  • resolution

  • device

  • erosion -- (default: True)

  • snowfall -- (default: True)

Module contents#

upsidedown_mountains#

infinigen.perf.terrain.assets.upsidedown_mountains.upsidedown_mountains_asset(...)[source]#

Upside, peak and downside heightmaps of a tile_size upside-down mountain tile, written to folder. min_freq, max_freq, height and coverage set the mountains’ base frequency range, height and coverage.

Parameters:
  • folder

  • device

  • min_freq -- (default: ('uniform', 0.005, 0.015))

  • max_freq -- (default: ('uniform', 0.025, 0.035))

  • height -- (default: ('uniform', 20, 30))

  • coverage -- (default: 0.5)

  • tile_size -- (default: 150)

  • resolution -- (default: 256)

  • verbose -- (default: 0)

Module contents#

Elements (.perf.terrain.elements)#

caves#

class infinigen.perf.terrain.elements.caves.Caves(
on_the_fly_asset_folder,
reused_asset_folder,
n_lattice=3,
is_horizontal=0,
frequency=0.03,
randomness=1,
height_offset=0,
deepest_level=-10,
scale_increase=('uniform', 1, 2),
noise_octaves=9,
noise_scale=5,
noise_freq=('log_uniform', 0.1, 0.3),
smoothness=0.5,
)[source]#

Bases: Caves

load_assets(on_the_fly_instances=5, reused_instances=0)[source]#
Parameters:
  • on_the_fly_instances -- (default: 5)

  • reused_instances -- (default: 0)

landtiles#

class infinigen.perf.terrain.elements.landtiles.LandTiles(
device,
caves,
on_the_fly_asset_folder,
reused_asset_folder,
n_lattice=1,
tiles=['MultiMountains'],
tile_density=1,
randomness=0,
attribute_probability=1,
attribute_distance_range=1000000000.0,
island_probability=0,
tile_heights=[-0.1],
land_processes=['erosion', None],
land_process_probs=[0.65, 0.35],
height_modification_start=None,
height_modification_end=None,
attribute_modification_start_height=None,
attribute_modification_end_height=None,
attribute_modification_distort_freq=1,
attribute_modification_distort_mag=2,
empty_below=-1000000000.0,
y_tilt=0,
y_tilt_clip=0,
material='mountain_collection',
transparency='Opaque',
use_cblerp=False,
smooth=False,
direction_deg=0,
)[source]#

Bases: LandTiles

load_assets(on_the_fly_instances=5, reused_instances=0)[source]#
Parameters:
  • on_the_fly_instances -- (default: 5)

  • reused_instances -- (default: 0)

voronoi_rocks#

Module contents#

Land Process (.perf.terrain.land_process)#

erosion#

infinigen.perf.terrain.land_process.erosion.run_erosion(...)[source]#

Hydraulically erode folder’s heightmap, or return its step in planning().

Parameters:
  • folder

  • Ns -- (default: [512, 2048])

  • n_iters -- (default: [10000, 500000])

  • mask_height_range -- (default: None)

  • spatial -- (default: 1)

  • mask_range -- (default: (4, 47))

  • ground_depth -- (default: 25)

  • sinking_rate -- (default: 0.05)

  • c_eq_factor -- (default: [1, 1])

infinigen.perf.terrain.land_process.erosion.erosion_step(...)[source]#
Parameters:
  • folder

  • Ns

  • n_iters

  • mask_height_range

  • spatial

  • mask_range

  • ground_depth

  • sinking_rate

  • c_eq_factor

infinigen.perf.terrain.land_process.erosion.plan_erosion(folder, **kwargs)[source]#

run_erosion’s step for a worker, with its gin parameters resolved.

Parameters:

folder

planning#

Plan a tile’s erosion and snowfall as steps to skip or run in a pool worker.

Sampling the base heightmap consumes the global random state, so it runs in place; erosion and snowfall only touch the tile folder, so skipping or deferring their gin-resolved (module, function, kwargs) steps leaves the RNG stream unmoved.

infinigen.perf.terrain.land_process.planning.planning(**context)[source]#

Inside this, land-process entry points return their step instead of running, with context (a seed) passed on to it.

infinigen.perf.terrain.land_process.planning.planning_context()[source]#

The active planning() context, or None when the entry points should run.

infinigen.perf.terrain.land_process.planning.needed_processes(process)[source]#

Declare the land process the scene reads for tiles generated inside this.

Parameters:

process

infinigen.perf.terrain.land_process.planning.needed_process()[source]#

The process set by needed_processes(), or NOT_GIVEN outside it.

infinigen.perf.terrain.land_process.planning.run_steps(steps)[source]#

Run steps in this process, in order, skipping None entries.

Parameters:

steps

infinigen.perf.terrain.land_process.planning.run_land_process_steps(folder, steps)[source]#

Run folder’s steps now, or submit them to the active land-process pool.

Parameters:
  • folder

  • steps

infinigen.perf.terrain.land_process.planning.mark_finished(folder, marker)[source]#

Create marker once every step submitted for folder has run.

Parameters:
  • folder

  • marker

pool#

Run planned land-process steps in worker processes, several tiles at once.

Each step has its gin parameters and seed resolved where it was planned and only touches its tile folder, so a worker needs no gin or scene state and writes the same files the step writes inline.

class infinigen.perf.terrain.land_process.pool.LandProcessPool(max_workers)[source]#

Bases: object

has_job(folder)[source]#
Parameters:

folder

submit(folder, steps)[source]#
Parameters:
  • folder

  • steps

add_finish_marker(folder, marker)[source]#
Parameters:
  • folder

  • marker

wait()[source]#
terminate()[source]#
infinigen.perf.terrain.land_process.pool.land_process_pool(...)[source]#

Run land-process steps submitted inside this context in worker processes and wait for them on exit; a failed worker raises RuntimeError. Disabled (the default) or with one worker, steps run inline. max_workers defaults to the usable CPUs, capped so worker_mem_gb per worker, the main process’s size and main_reserve_gb fit any memory limit, which only changes how many tiles run at once.

Parameters:
  • enabled -- (default: False)

  • max_workers -- (default: None)

  • worker_mem_gb -- (default: 3.0)

  • main_reserve_gb -- (default: 2.0)

infinigen.perf.terrain.land_process.pool.worker_main(jobfile)[source]#

Run the steps pickled in jobfile in this process.

Parameters:

jobfile

snowfall#

infinigen.perf.terrain.land_process.snowfall.run_snowfall(...)[source]#

Accumulate snow on folder’s eroded heightmap, or return its step in planning(). Diffusion uses a numpy replica of landlab with bitwise identical results; snowfall_step(backend=”landlab”) runs landlab itself.

Parameters:
  • folder

  • blending_params -- (default: [0, 0.5])

  • diffussion_params -- (default: [(256, 10, 9), (1024, 10, 5)])

  • verbose -- (default: 0)

infinigen.perf.terrain.land_process.snowfall.snowfall_step(...)[source]#
Parameters:
  • folder

  • blending_params

  • diffussion_params

  • verbose

  • backend

  • normal_params

infinigen.perf.terrain.land_process.snowfall.steepest_receivers(z, R, C)[source]#

D4 steepest-descent (receiver, steepest_slope) flat arrays on an R x C raster, matching landlab’s FlowDirectorSteepest with all edges open. Ties go to the lowest landlab link id (below, left, right, above); perimeter nodes are their own receivers with slope 0.

Parameters:
  • z

  • R

  • C

infinigen.perf.terrain.land_process.snowfall.transport_length_diffusion(...)[source]#

Transport-length hillslope diffusion for n_iters steps of dt on an open-perimeter raster, a bitwise identical replica of landlab’s FlowDirectorSteepest then TransportLengthHillslopeDiffuser (float64, unit grid spacing). np.add.at sums the fluxes in the same node order as landlab’s loop.

Parameters:
  • elev

  • n_iters

  • erodibility -- (default: 0.001)

  • slope_crit -- (default: 0.6)

  • dt -- (default: 1.0)

infinigen.perf.terrain.land_process.snowfall.landlab_transport_length_diffusion(elev, n_iters, verbose=0)[source]#

Reference implementation using landlab, for equivalence tests.

Parameters:
  • elev

  • n_iters

  • verbose -- (default: 0)

infinigen.perf.terrain.land_process.snowfall.plan_snowfall(folder, **kwargs)[source]#

run_snowfall’s step for a worker, with its gin parameters resolved.

Parameters:

folder

worker#

Land-process worker entry point, python -m …worker JOBFILE. Kept out of pool so that -m does not re-execute the pool module the terrain already imported.

Module contents#

Mesh To Sdf (.perf.terrain.mesh_to_sdf)#

surface_point_cloud#

class infinigen.perf.terrain.mesh_to_sdf.surface_point_cloud.SurfacePointCloud(mesh, points, normals=None, scans=None)[source]#

Bases: SurfacePointCloud

get_sdf(...)[source]#
Parameters:
  • query_points

  • use_depth_buffer -- (default: False)

  • sample_count -- (default: 11)

  • return_gradients -- (default: False)

Module contents#

Mesher (.perf.terrain.mesher)#

cube_spherical_mesher#

class infinigen.perf.terrain.mesher.cube_spherical_mesher.CubeSphericalMesher(
cam_pose,
r_min,
r_max,
base_90d_resolution,
base_R,
H_fov,
W_fov,
N0,
N1,
complete_depth_test=False,
inview_upscale=-1,
test_downscale=5,
bisection_iters=10,
complete_depth_test_relax=4,
device='cpu',
verbose=False,
)[source]#

Bases: CubeSphericalMesher

frontview_spherical_mesher#

class infinigen.perf.terrain.mesher.frontview_spherical_mesher.FrontviewSphericalMesher(
cam_pose,
H_fov,
W_fov,
r_min,
r_max,
H,
W,
R,
upscale,
complete_depth_test,
test_downscale=5,
bisection_iters_coarse=7,
bisection_iters_fine=15,
relax1=0,
complete_depth_test_relax=4,
device='cpu',
verbose=0,
)[source]#

Bases: FrontviewSphericalMesher

spherical_mesher#

infinigen.perf.terrain.mesher.spherical_mesher.kernel_caller(kernels, XYZ, bounds=None)[source]#
Parameters:
  • kernels

  • XYZ

  • bounds -- (default: None)

infinigen.perf.terrain.mesher.spherical_mesher.kernel_min_caller(kernels, XYZ, bounds=None)[source]#

Minimum of the kernels’ SDFs at XYZ in O(N) memory instead of O(N * K).

Parameters:
  • kernels

  • XYZ

  • bounds -- (default: None)

class infinigen.perf.terrain.mesher.spherical_mesher.OpaqueSphericalMesher(
cameras,
bounds,
base_90d_resolution=None,
pixels_per_cube=1.84,
test_downscale=5,
upscale1=2,
upscale2=4,
r_lengthen=1,
)[source]#

Bases: OpaqueSphericalMesher

class infinigen.perf.terrain.mesher.spherical_mesher.TransparentSphericalMesher(
cameras,
bounds,
base_90d_resolution=None,
pixels_per_cube=1.84,
test_downscale=5,
inv_scale=8,
r_lengthen=3,
camera_annotation_frames=None,
)[source]#

Bases: TransparentSphericalMesher

Module contents#

Utils (.perf.terrain.utils)#

mesh#

infinigen.perf.terrain.utils.mesh.convert_face_array(face_array)[source]#
Parameters:

face_array

class infinigen.perf.terrain.utils.mesh.Mesh(
normal_mode='mean',
path=None,
heightmap=None,
L=None,
downsample=1,
vertices=None,
faces=None,
vertex_attributes=None,
mesh=None,
obj=None,
mesh_only=False,
**kwargs,
)[source]#

Bases: Mesh

make_unique()[source]#
export_blender(name, collection='Collection', material=None)[source]#
Parameters:
  • name

  • collection -- (default: 'Collection')

  • material -- (default: None)

cat()[source]#
Parameters:

meshes

Module contents#

core#

class infinigen.perf.terrain.core.Terrain(
seed,
task,
asset_folder,
asset_version,
on_the_fly_asset_folder='',
device='cpu',
main_terrain='OpaqueTerrain',
under_water=False,
atmosphere=None,
beach=None,
eroded=None,
ground_collection=None,
lava=None,
liquid_collection=None,
mountain_collection=None,
rock_collection=None,
snow=None,
min_distance=1,
height_offset=0,
whole_bbox=None,
populated_bounds=(-75, 75, -75, 75, -25, 55),
bounds=(-500, 500, -500, 500, -500, 500),
)[source]#

Bases: Terrain

tag_terrain(obj)[source]#
Parameters:

obj

Module contents#

Tools (.perf.tools)#

Terrain (.perf.tools.terrain)#

generate_terrain_assets#

Asset-library generation that can run land processes and caves in pool workers.

infinigen.perf.tools.terrain.generate_terrain_assets.asset_generation(...)[source]#
Parameters:
  • output_folder

  • assets

  • instance_ids

  • seed

  • device

  • check_only -- (default: False)

Module contents#

Module contents#

kernels#

infinigen.perf.kernels.optional_import(module, attr=None, hint=None)[source]#

Import module (or its attr), or return None and log hint once so the caller can fall back to the default; hint should say how to build the kernel.

Parameters:
  • module

  • attr -- (default: None)

  • hint -- (default: None)

infinigen.perf.kernels.available(module, attr=None, hint=None)[source]#
Parameters:
  • module

  • attr -- (default: None)

  • hint -- (default: None)

options#

Gin settings of the optimized packages, inert unless their package is selected.

infinigen.perf.options.isolation_enabled(enabled=True)[source]#

Build assets and animate cameras in a scratch view layer holding only their objects. Off uses the main view layer, as the default does.

Parameters:

enabled -- (default: True)

infinigen.perf.options.compress_output_blend(enabled=True)[source]#

Write stage output .blend files with Blender’s lossless compression, so later stages read smaller files. Off writes them uncompressed, as the default does.

Parameters:

enabled -- (default: True)

infinigen.perf.options.only_needed_land_processes(enabled=True)[source]#

Skip land process simulations whose outputs the scene never reads (asset-library generation still runs them all). Off simulates all of them, as the default does.

Parameters:

enabled -- (default: True)

infinigen.perf.options.prefetch_input_scene(enabled=True)[source]#

Pull an input scene and its terrain assets into the page cache with large reads before Blender reads them in small requests. Off opens them directly.

Parameters:

enabled -- (default: True)

infinigen.perf.options.direct_monocot_leaves(enabled=True)[source]#

Build monocot leaf sheets, their decoration and the agave’s join from arrays, with a different face count. Off builds just these with the default operators.

Parameters:

enabled -- (default: True)

infinigen.perf.options.native_pinecone(enabled=True)[source]#

Build pinecones with the native kernels when compiled, at a slightly different triangle count. Off keeps the default pinecone in the optimized monocot.

Parameters:

enabled -- (default: True)

infinigen.perf.options.native_tree_meshing(enabled=True)[source]#

Mesh tree and bush trunks as a bark-displaced tube per stem instead of voxel remeshing them, changing topology. Off keeps the remesh in the optimized trees.

Parameters:

enabled -- (default: True)

infinigen.perf.options.native_tree_edge_length(ceiling_factor=1.7)[source]#

Edge length ceiling of native tree meshing, as a multiple of the target face size; lower gives denser trunks (the kernel’s own default is 1.0).

Parameters:

ceiling_factor -- (default: 1.7)

infinigen.perf.options.optix_kernel_cache(enabled=True, directory=None)[source]#

Where GPU renders cache OptiX kernels, by default under $XDG_CACHE_HOME or ~/.cache. Off leaves it to the driver; a set OPTIX_CACHE_PATH is kept.

Parameters:
  • enabled -- (default: True)

  • directory -- (default: None)

Module contents#

Optional optimized implementations, reached through gates on the default ones.

infinigen.core.init always imports this package so its gin settings register, but nothing optimized runs unless a package is selected.

infinigen.perf.apply_gin_selection()[source]#

Apply any parsed optimized.* gin selection and return the names selected.

infinigen.perf.available(module, attr=None, hint=None)[source]#
Parameters:
  • module

  • attr -- (default: None)

  • hint -- (default: None)

infinigen.perf.optional_import(module, attr=None, hint=None)[source]#

Import module (or its attr), or return None and log hint once so the caller can fall back to the default; hint should say how to build the kernel.

Parameters:
  • module

  • attr -- (default: None)

  • hint -- (default: None)

infinigen.perf.status()[source]#

One-line summary of the current selection, for logs and bug reports.