RealDocs

UImportanceSamplingLibrary::RandomSobolCell2D

function Engine Blueprint Since 5.0
#include "Kismet/ImportanceSamplingLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns a Sobol-distributed 2D position within a specific cell of a stratified grid, useful for jittered/stratified sampling patterns like Poisson-disk-style scattering.

Caveats & Gotchas

  • NumCells is silently rounded up to the next power of two, so the effective grid resolution may be larger than requested — don't assume exact cell counts for indexing elsewhere.
  • Cell coordinates are expected as integer grid coordinates packed into an FVector2D, not normalized 0-1 positions.
  • For stepping through consecutive indices within the same cell, NextSobolCell2D avoids recomputation.

Signature

static FVector2D RandomSobolCell2D(int32 Index, int32 NumCells = 1, FVector2D Cell = FVector2D(0,0), FVector2D Seed = FVector2D(0,0))

Parameters

Name Type Description Default
Index int32 Which sequential point in the cell, starting at 0.
NumCells int32 Size of the cell grid, 1 to 32768. Rounded up to the next power of two. 1
Cell FVector2D Integer grid cell coordinate to draw the point from. FVector2D(0,0)
Seed FVector2D Random 2D seed (components in the range 0-1) to randomize across multiple sequences. FVector2D(0,0)

Return Type

FVector2D

Example

Scatter points within a grid cell C++
const FVector2D Point = UImportanceSamplingLibrary::RandomSobolCell2D(0, 16, FVector2D(3, 5), FVector2D(0.1f, 0.7f));
// Point is a jittered 2D sample within grid cell (3,5) of a 16x16 grid

Tags

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.