[solved] Dual camera with water

I’m trying to make a world map-like secondary camera. The problem is that since I’m using water (which is a FilterPostProcessor), the secondary camera don’t see it. Here is my code:

public class WorldMapAppState extends SimpleAppState {

FilterPostProcessor fpp;

WorldMapAppState(FilterPostProcessor fpp){

public void initialize(AppStateManager sm, Application app) {
    super.initialize(sm, app);
    // Setup first full-window view
    cam.setViewPort(0f, 1f, 0f, 1f);
    cam.setLocation(new Vector3f(3.32f, 4.48f, 4.28f));
    cam.setRotation(new Quaternion(-0.07f, 0.92f, -0.25f, -0.27f));

// Setup second, smaller PiP view
Camera cam2 = cam.clone();
cam2.setViewPort(.4f, .6f, 0.8f, 1f);

    cam2.setLocation(new Vector3f(98.3518f, 2797.5417f, -51.294434f));
    cam2.setRotation(new Quaternion(0.48278663f, -0.5134845f, 0.5185406f, 0.48411405f));

    ViewPort viewPort2 = renderManager.createMainView("PiP", cam2);
    viewPort2.setClearFlags(true, true, true);


If I uncomment the last line I don’t see the secondary camera… :frowning:

I don’t see any issue at first glance in the code.
Please test TestMultiViewsFilters jmonkeyengine/TestMultiViewsFilters.java at master · jMonkeyEngine/jmonkeyengine · GitHub in the repo and see if it works for you.

If it does, there should be something you missed and the answer is in this test class

1 Like

Thanks! I’ve found it: I needed to use a different FilterPostProcessor for each ViewPort. I can’t just recycle it. :slight_smile: