Giter Site home page Giter Site logo

three.fbohelper's Introduction

THREE.FBOHelper

FrameBuffer Object inspector for three.js

####Check out a demo here: Goth GPU Physics Demo

Screenshots

SnapshotPosition buffer SnapshotMotion blur buffer
SnapshotShadow map buffer SnapshotPosition buffer

How to use

  • Include THREE.FBOHelper.js. There's an ES6 build and an ES5 build transpiled with babel-cli in /build.
  • Create a helper linked to a WebGLRenderer
var helper = new FBOHelper( renderer );

or use npm to install the package:

npm i three.fbo-helper

and include it in your code (remember to include three.js too)

var THREE = require( 'three' );
var FBOHelper = require( 'three.fbo-helper' );
  • Call .setSize to adjust to the renderer size (don't forget to do onResize!)
helper.setSize( width, height );
  • Attach WebGLRenderTargets at discretion
helper.attach( fieldFBO, 'Distance Field' );
helper.attach( particleFBO, 'Particles' );

attach() admits a third parameters, formatter, a function that will receive an object with the values of the current point x, y, u, v, r, g, b, and a. You can return a custom string in case you want to show a different caption in the label. Otherwise, it will show all the values. Example:

helper.attach( buffer, 'Particles', function( d ) {
  return `Position: (${d.x}, ${d.y}, ${d.z}) | Life: ${d.a}`;
} );
  • Update with your animation loop
helper.update();
  • If for any reason you resize the FBO, call:
helper.refreshFBO( fbo );
  • Call .detach to remove any fbo previously attached
helper.deatch( fbo );

Once the helper is working, you can select FBOs to inspect, and drag the viewer around and use the scroll/mousewheel to zoom in and out.

License

MIT licensed

Copyright (C) 2016 Jaume Sanchez Elias, http://www.clicktorelease.com

three.fbohelper's People

Contributors

spite avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.