0

I want to get the output (ie what is displayed on the screen) as an array of colors.

I tried googling 'three.js screen output as array' but couldnt find what I was looking for. Any advice or pointers in the right direction would be appreciated.

Bjathr
  • 85
  • 1
  • 10
  • What have you already tried? (other than just searching) – 2pha Sep 06 '18 at 21:47
  • I havent tried anything yet, as it seems rather complicated, and I was hoping for some shortcut. If there isnt a ready-made function in three.js for this I guess I either try to do something like ebragaparah here: https://stackoverflow.com/questions/1936021/javascript-eyedropper-tell-color-of-pixel-under-mouse-cursor or delve into the three.js library itself and search for the function that does the actual screenoutput, then use that to get an array instead of screenoutput. – Bjathr Sep 10 '18 at 07:41
  • 1
    If using the webgl renderer, convert the canvas into an image, draw the image onto a new canvas (context2d), then read the pixels from the canvas. Search google for each of those steps and you should have your answer. – 2pha Sep 10 '18 at 23:33

1 Answers1

1

2pha's comment above solved the issue!

If using the webgl renderer, convert the canvas into an image, draw the image onto a new canvas (context2d), then read the pixels from the canvas. Search google for each of those steps and you should have your answer.

Bjathr
  • 85
  • 1
  • 10
  • 1
    Would you put a quote (or summary) of the comment here in this answer please? Comments on this site may disappear at anytime. – ouflak Dec 15 '21 at 10:23