Voxel Plugin
2.0p-320
2.0p-320
  • Home
  • Roadmap
  • Getting Started
    • Installing Voxel Plugin
    • Installing Example Content
    • Migrating from 1.2
  • Basics
    • Brush & Channels
    • Foliage
    • Navmesh & Collision
    • Density Canvas
    • Blueprints
      • Setting graph parameters
      • Querying voxel graphs
    • Cubemap planets
  • Advanced Usage
    • Memory Usage & Render Performance
    • Using Graph Preview
    • Debugging plugin code
  • Platform Support
    • Targeting Mac & iOS
    • Targeting Android
  • Design Insights
    • Why Landmass & MetaGraphs
    • Channels & Physics Scenes
    • Execution Flow & Query Data
    • Node Types
    • Passing Data to Materials
    • MetaGraph Macros
    • Buffers and Uniforms
    • Utilities for Performant Graphs
  • Licensing
  • Release Notes
Powered by GitBook
On this page
  • 1. Usage
  • 2. Technical Details

Was this helpful?

  1. Design Insights

Buffers and Uniforms

The differences between Buffers and Uniforms and their distinct usages.

PreviousMetaGraph MacrosNextUtilities for Performant Graphs

Last updated 1 year ago

Was this helpful?

1. Usage

Data used in the plugin can be a Buffer or a Uniform. Generally, Uniforms are used when data is the same for every position in a chunk.

Both types have their own pin visual. Uniform pins have round pin icons, whereas Buffer pins have a square pin icon.

Buffers can only be used as an input for Buffer pins specifically. Uniforms can be used as an input for both Buffer and Uniform pins.

2. Technical Details

A single-length Buffer is functionally identical to a Uniform, and using one will not have any impact on performance. Performance considerations only change if the Buffer contains multiple values.

The most straight-forward rule of thumb for whether a given value should be a Bufferor a uniform is this:

  • If a value changes based on position, it is almost always a Buffer.

  • If a value is the same for every position, it is almost always a Uniform.

On a technical level, a Buffer is simply a stack of data: a single Buffer pin represents the data for every point within a chunk at the same time, rather than just being a single value. Having this data in a stack allows it to be operated on in bulk, i.e. by calculating many values at once using ISPC on the CPU, or (not currently supported, but theoretically possible) GPU compute.

Uniform values are constant throughout all of a chunk's positions. If needed, a Uniform value can change from once chunk to the next. For example, the Get LOD node returns a uniform. It reports the current LOD, which varies from one chunk to the next. Because the LOD value will never change within a chunk, however, it can still be a uniform.

Additionally, there are a handful of special types, such as Surfaces and Point Sets, which are treated as uniform under the hood, despite them being intuitively 'different per position'. In these cases, the uniform is actually a struct that contains a set of buffers. The entire struct is uniform per chunk, but this single uniform struct holds a value for each position within its chunk inside the buffer elements. To avoid confusion, these types have visually distinct icons and are not presented to the user as uniforms.

Some pins are uniform (round), others are buffers (square), and some pins (grey center) can be either.