CameraNode + ViewPort + PiP-Camera, black when attaching cameranode to target?


I’ve recently tried adding a cameranode to my PiP camera, so to make it follow the selected spatial. The Picture-in-Picture camera is working fine, but as the entity I’m pointing the PiP-camera at is moving, it’s not much good. Now, adding the cameranode seems okay, however when I add the following line:


The picture in picture-viewport is all black. The node i’m moving is the parent of the spatial.

I’m running out of ideas. You can see my code here:

Please help me, Obiwan Kenobi.


Maybe your camera “lookAt” to a wrong direction (if you have no background, it’s black), mimic the direction (rotation) of parent should be not what you whish. You can try to add a Control to your CameraNode, to force it to “lookAt” your player or your selectedSpatial.

That’s the weird thing, I have an ambient light in my scene, so there’s no black anywhere to found.

black is the default color when the screen is cleared. Ambient is only applied on materials that that take care of it. So ambient as no impact on the clear/background color.

Did you try to force lookat to selectedSpatial (every frame) ?

Did you try to define the rootNode for the viewport of cam2 ?


see jme3:advanced:multiple_camera_views

I’ll try those things.

What I meant by having an ambient light is that my scene, when playing the game, has no black anywhere. I can post a screenshot when I get back to you.


Hi, I’m heaving a very similar problem. I also tried setting the background color to pink as @david_bernard_31 mentioned. The rendering is still black. Have you found a solution for your problem, @asser_fahrenholz?

Maybe you’re using normal maps and miss tangents in your model.

No, not yet. If I set the background color, the viewport reflects the change.

@normen I’m not even sure what that means, but that doesn’t mean it’s not the cause :smile:

Right-click the geometry in the SceneComposer and select Tools->Generate Tangents or if you don’t use the SDK use the TangentBinormalGenerator

The main camera can see all the objects just fine. When I then click an object the PiP-camera should show the object chosen in a smaller viewport in the corner (they are basic ‘boxes’ - no fancy stuff).