@pixi-pbr/diffy
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@pixi-pbr/diffy

This package can be used to minimize buffer upload overhead in vertex-bound applications. It exploits bufferSubData to upload only modified parts of the batched geometry. This trades off graphics memory for reducing data transfers.

Installation 📦

npm install @pixi-pbr/diffy

Notes

  • WebGL 1: WebGL 1 does not the required overload of gl.bufferSubData to do partial uploads. This in turns only allows optimizations in the case where the geometry has not changed at all.
  • Projection Matrix: If your application uses a viewport (like pixi-viewport by David Fignater), then you can optimize it use a projection-matrix so that your object's coordinate do not change when modifying the viewport itself. This has the effect of the geometry not changing at all when panning/zooming so buffer uploads can be fully optimized away!

Usage

To enable this optimization, you can use the exported geometry-factory and drawer.

import { BatchRendererPluginFactory } from 'pixi-batch-renderer';
import { DiffGeometryFactory, DiffDrawer } from '@pixi-pbr/diffy';

// YourRenderer will have the diffy optimization!
const YourRenderer = BatchRendererPluginFactory.from({
    ...yourOptions,
    BatchGeometryFactoryClass: DiffGeometryFactory,
    BatchDrawerClass: DiffDrawer
});

Collaboration

I'd like to thank Strytegy for funding the initial development of this package.

Package Sidebar

Install

npm i @pixi-pbr/diffy

Weekly Downloads

10

Version

2.0.1

License

MIT

Unpacked Size

131 kB

Total Files

9

Last publish

Collaborators

  • shukantpal