Rendering Camera Feed as Texture on a Plane


I am trying to Render Camera Feed as Texture on a Plane, similar to the example project -

But when i try to fork this project or try to create a new project on similar lines, I am getting a getting blank plane with no camera feed.

Also, i wanted to do this in AR, any more directions will be a great help.


Hi @parul_bansal,

That example is a bit old, written before the Playcanvas Layers system was introduced. Now the way to do that would be to create a new Layer in the editor, assign it to your active camera and objects you would like to render on and in code make the following change:

//     // Set the render target on an entity's camera component
// = renderTarget;
    // added a new Layer named Render
    var layer ='Render');
    layer.renderTarget = renderTarget;

If you would like to render to texture the whole Layers composition including the skybox etc, take a look at the following project by @yaustar :

Hey Thanks for the reply I used the layers and the code suggested above.

  1. I am able to get the 3d object, but i am unable to get the skybox.
  2. Also, I am able to get the model wrapped ona a cylinder like shown in this example -
    but i want it to get wrapped only the curved surface. My project is about wrapping a watch around a cylinder in AR, with cylinder having camera feed texture.

As the 3d models always load on top of the marker, I was just trying to experiement, if i can mimic it getting wrapped aroung hand with this.


Hi @parul_bansal,

  1. Good point, let me check and will get back to you what’s the best way to get the full camera feed and not just a camera layer.

  2. To do that you need to prepare a cylinder model in your modelling app, to have the right texture coordinates for your use case (unwap UVW).

Hi @Leonidas

Gr8, I will try to modify the cylinder object with blender.

Also, do let me know incase you find a solution for point 1. I will also look and share if i find something

Thanks :slight_smile:

1 Like

Hi @parul_bansal,

Here is an example that renders a full camera view on a plane, it’s an engine based example.

Hope it helps! The full source code:

Edit: About the Skybox though, since that is rendered on its own layer I think still it will not be included on the rendered texture. There is a quick and dirty solution to grab a texture from the Application texture, but that will kill performance.

Will research further on what is the optimal way :wink: Most likely using a pc.PostEffect to copy the colorBuffer to a render texture.


Apologies for late reply.

Thanks for the suggestion. I will try this example and get back to you with the results…
Thanks again for your help.

1 Like