this is kind of related to the other post i just made about trying to make PIP viewport, but this is a different issue. Im trying to add the same scene processors to my “main” and my “pip” viewport so they look the same. this is the code i have right now:
[java]
// creates a viewport along the right side of the screen taking up percentage of the screen
private void createPipVerticalRight(float percentage) {
Camera cam2 = cam.clone();
cam2.resize(Math.round(cam.getWidth() * percentage), cam.getHeight(), true);
cam2.setViewPort((1 - percentage) / percentage, 1 / percentage, 0, 1);
ViewPort view2 = renderManager.createMainView("Right PIP", cam2);
view2.setBackgroundColor(MoreColorRGBA.CORNFLOWER_BLUE.mult(ColorRGBA.Red));
view2.setClearFlags(true, true, true);
view2.attachScene(rootNode);
PssmShadowRenderer shadow = new PssmShadowRenderer(assetManager, 1024, 3);
shadow.setDirection(new Vector3f(0, -1, -2));
shadow.setLambda(0.55f);
shadow.setShadowIntensity(.6f);
shadow.setCompareMode(PssmShadowRenderer.CompareMode.Hardware);
shadow.setFilterMode(PssmShadowRenderer.FilterMode.Bilinear);
view2.addProcessor(shadow);
}
[/java]
however my test scene also uses the filter post processor with an ssao filter
[java]
FilterPostProcessor fpp2 = new FilterPostProcessor(assetManager);
SSAOFilter ssaoFilter2 = new SSAOFilter(12.940201f, 43.928635f, 0.32999992f, 0.6059958f);
fpp2.addFilter(ssaoFilter2);
view2.addProcessor(fpp2);
[/java]
this causes my pip viewport to get moved from the right side of the screen, and i think its being stretched or something, because i only see the sky in my scene rather than the cube thats in it.
I tried this with a few other filters (toon, gray scale…) and they all caused the same problem, the only way the problem doesnt occur is if i add a FPP to the viewport with no filters added to it. (the shadow renderer does not cause this issue, just the fpp when filters are added to it)
ive tried resetting the camera settings after adding the fpp, but it didnt seem to have an effect.
edit:
to better clarify
i can do
cam2.setViewPort(0, 1, 0, 1);
and put it along the left side of the screen. but when i try to do
cam2.setViewPort((1 - percentage) / percentage, 1 / percentage, 0, 1);
it goes haywire. it seems to lose understanding of its dimensions with the filters added somehow…
if you do
cam2.setViewPort(0.5f, 1.5f, 0, 1);
it seems to be moved by the correct amount but looks to be somehow getting clipped off. it doesnt want to draw anything outside of the 0,1,0,1 portion of the screen.