Thanks @max, I found a post in the forum on which you had been helping out before, but it seems the initial post started with the need to take a cubemap that was already part of the assets and replacing it in the scene.
Further in that same topic, @Kamael expressed the need to dynamically generate the cubemap and posted a script that makes a whole lot of sense:
- Create an entity
- Attach 6 cameras with 6 renderTargets
But from there, I don’t see how I can extract an image from each of those cameras.
After some digging, I found a script that does this in THREE.js and it works exactly like I’d like it to. Takes a snapshot and downloads an image. So I’ve taken up the task of converting that script into Playcanvas.
I actually made it pretty far in with the translation, but I’m starting to hit a few bumps with terms and properties that don’t transfer over as smoothly, for example (and most importantly), the concept of a CubeCamera and the WebGLRenderer.
CubeCamera
Creates 6 cameras that render to a WebGLRenderTargetCube.
WebGLRenderer
The WebGL renderer displays your beautifully crafted scenes using WebGL.
For the cubeCam I created an entity with 6 child cameras using @Kamael 's code , but have no idea really where to attach it or how to trigger the scene snapshot. As far as the WebGL renderer, I first thought it referred to the CANVAS, then thought it was the renderTarget, but it seems that the THREE.CubeCamera also has a renderTarget as a child.
Thoughts?
Anyone interested in taking this on with me?
https://playcanvas.com/editor/code/495087?tabs=8596687
https://launch.playcanvas.com/539610?debug=true