disactive camera

hide,I want to add shadow to my scene

first , I place a camera on the light pos, and draw deep map

then ,I disconnect deep map from buffer,and disable the camera

but ,if I disable the camera,the deep map will be changed

winprops = WindowProperties.size(2048, 2048)
        props = FrameBufferProperties()
        props.setRgbColor(1)
        props.setAlphaBits(1)
        props.setDepthBits(1)

        LBuffer = base.graphicsEngine.makeOutput(
            base.pipe, "offscreen buffer", -2,
            props, winprops,
            GraphicsPipe.BFRefuseWindow,
            base.win.getGsg(), base.win)
	self.LCam = base.makeCamera(LBuffer)
	self.LCam.reparentTo(render)
        self.LCam.node().setScene(render)
        #self.LCam.node().getLens().setFov(40)
        self.LCam.node().getLens().setNearFar(10, 20000)
	self.LCam.setPos(SunPos)
        self.LCam.lookAt(SunLookAt)
        self.LCam.node().setInitialState(lci.getState())
	self.LCam.node().setCameraMask(VIEWCAM_MASK)

       Ldepthmap_static = Texture()
        LBuffer.addRenderTexture(Ldepthmap_static, GraphicsOutput.RTMBindOrCopy,
                                 GraphicsOutput.RTPDepthStencil)
        if base.win.getGsg().getSupportsShadowFilter():
            Ldepthmap_static.setMinfilter(Texture.FTShadow)
            Ldepthmap_static.setMagfilter(Texture.FTShadow)
	Lcolormap_static = Texture()
        LBuffer.addRenderTexture(Lcolormap_static, GraphicsOutput.RTMBindOrCopy,
                                 GraphicsOutput.RTPColor)


     base.graphicsEngine.renderFrame()
	LBuffer.clearRenderTextures()

     self.LCam.node().setActive(False)
   

if i add “self.LCam.node().setActive(False)”,Ldepthmap_static will be changed

I’m having difficulty understanding what you are asking. You are rendering a depth map, and want to disable it without seeing it changed?

In what way do you see it changed? Do you see it cleared or does it still render something?

Disabling the camera will not disable clearing. You will have to either disable clears on your buffer (and any display regions you might have enabled clears on), or you can disable the entire buffer:

LBuffer.setActive(False)

I want to render a depth map in the first frame to calculate the shadow of the static model.

I can see the depth map by " base.bufferViewer.toggleEnable() "

when I disable the camera,

base.graphicsEngine.renderFrame()
LBuffer.clearRenderTextures()
LBuffer.setActive(False)
self.LCam.node().setActive(False)

the depth map be cleared. In the buffer view, Lcolormap_static is total gray

You should not call clearRenderTextures(). Just deactivating the buffer works. Deactivating the camera is not necessary either if you deactivate the buffer.

I just pushed a change to the shadow sample programs that shows how to deactivate the shadow map updates. Just press U to toggle shadow map updates.