blenderproc.python.modules.object.OnSurfaceSamplerModule module

class blenderproc.python.modules.object.OnSurfaceSamplerModule.OnSurfaceSamplerModule(config)[source]

Bases: blenderproc.python.modules.main.Module.Module

Samples objects poses on a surface.
The objects are positioned slightly above the surface due to the non-axis aligned nature of used bounding boxes and possible non-alignment of the sampling surface (i.e. on the X-Y hyperplane, can be somewhat mitigated with precise “up_direction” value), which leads to the objects hovering slightly above the surface. So it is recommended to use the PhysicsPositioning module afterwards for realistically looking placements of objects on the sampling surface.
Parameter Description Type
objects_to_sample Here call an appropriate Provider (Getter) in order to select objects. provider
max_iterations Amount of tries before giving up on an object (deleting it) and moving to the next one. Default: 100. int
pos_sampler Here call an appropriate Provider (Sampler) in order to sample position (XYZ 3d vector) for each object. UpperRegionSampler recommended. Provider
rot_sampler Here call an appropriate Provider (Sampler) in order to sample rotation (Euler angles 3d vector) for each object. Provider
surface Object to place objects_to_sample on, here call an appropriate Provider (getter) which is configured such that it returns only one object. Provider
min_distance Minimum distance to the closest other object. Center to center. Only objects placed by this Module considered. Default: 0.25 float
max_distance Maximum distance to the closest other object. Center to center. Only objects placed by this Module considered. Default: 0.6 float
up_direction Normal vector of the side of surface the objects should be placed on. Default: [0., 0., 1.]. mathutils.Vector
run()[source]

Samples the selected objects poses on a selected surface.