Strange error when using pc.RenderTarget to update a cubemap

i’m getting a strange error in the script that i made to teste the pc.RenderTarget, it says: ERROR: FRAMEBUFFER_INCOMPLETE_ATTACHMENT

i did not find any solution or at least a cause for this here is the script code atached to a camera:

var texture = this.app.assets.get(5036732); //Getting the CubeMap

var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture,{
    face: 0
});

this.entity.camera.renderTarget = renderTarget;

Mirror Sphere is the project, any solution ?

You can’t create a cubemap (or regular 2D texture) in the PlayCanvas UI and then render to it. Although we recognise this would be a cool feature to have and we’ll no doubt add it before too long.

In the meantime, it’s probably easier to achieve what you want to do in script. I’ve had a first stab here:

https://playcanvas.com/project/424223/overview/dynamic-cubemap

The important script is here:

https://playcanvas.com/editor/asset/5108995

There’s a few problems though. First, the cubemap looks flipped horizontally (looks at the cone and the cylinder). Also, I can’t figure out how to generate a mipmapped cubemap so I’ve set the filter to bilinear for now. But it’s close and a good start. Maybe @Mr_F has some thoughts on this topic. It would be cool if dynamic cubemaps were easier to achieve generally.

Thanks, i will update my project, i wished that i could do more to help but i’m learning a ton of amazing things with all of this.

Thanks again.

1 Like