Rendering a secondary depth map

actually, thinking about it … in engine v2 this should do it. Just enabled depth rendering on the cameraFrame like this:

const cameraEntity = new pc.Entity();
cameraEntity.addComponent('camera');

const cameraFrame = new pc.CameraFrame(app, cameraEntity.camera);
cameraFrame.rendering.sceneDepthMap = true;
cameraFrame.update();

app.root.addChild(cameraEntity);

and use this color texture:
cameraFrame.renderPassCamera.prePass.linearDepthTexture

1 Like