MaiaVictor
MaiaVictor

Reputation: 53037

Can I post-process three.js on processing.js?

Can I get the output of Three.js as a workable buffer on processing.js, so I can do some post-render processing with effects and overlays?

Upvotes: 1

Views: 422

Answers (1)

If you have access to the output in image form you can hand this over to your sketch by using something like this:

sketch:

addThreeJSImage(String datauri) {
  PImage img = loadImage(datauri);
  // trigger further code based on img
}

javascript (assuming sketch reference 'p'):

function doFunkyStuff(canvas) {
  imgdata = canvas.toDataURL('image/png');
  p.addThreeJSImage(imgdata);
}

This is assuming three.js gives you access to the canvas, of course, and the data it draws is "clean" (i.e. you didn't import any external images, because then cross-origin lockdown prevents you from reading the pixels; you'll only be able to write over them...)

Upvotes: 1

Related Questions