I’ve been trying to get Tamarin 2 working in some of my real projects and I’m experiencing an issue where if the cameras have a bloom filter applied they flicker (otherwise they are fine). I think that flicker is the glow being applied only on some frames.
A minimal example that includes Tamarin is:
public class Main extends SimpleApplication{
public static void main(String[] args) {
AppSettings settings = new AppSettings(true);
settings.put("Renderer", AppSettings.LWJGL_OPENGL45);
settings.setTitle("Tamarin OpenXR Example");
settings.setVSync(false);
Main app = new Main();
app.setLostFocusBehavior(LostFocusBehavior.Disabled);
app.setSettings(settings);
app.setShowSettings(false);
app.start();
}
@Override
public void simpleInitApp(){
XrAppState xrAppState = new XrAppState();
xrAppState.configureBothViewports(v -> {
FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
BloomFilter bf=new BloomFilter(BloomFilter.GlowMode.Objects);
bf.setBlurScale(0.5f);
fpp.addFilter(bf);
v.addProcessor(fpp);
});
getStateManager().attach(xrAppState);
Box b = new Box(0.1f, 0.1f, 0.1f);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Gray);
geom.setMaterial(mat);
geom.setLocalTranslation(0, 1, 5f);
xrAppState.playerLookAtPosition(new Vector3f(0,1,5));
rootNode.attachChild(geom);
}
}
I’ll try to create a minimal example that doesn’t involve Tamarin if the problem isn’t immediately obvious to someone (but that will probably be hard so I wanted to at least see if someone had an idea first).
The way this works is
During XrAppState#update the viewport is given an output frame buffer to render into
@Override
public void update(float tpf){
...
leftViewPort.setOutputFrameBuffer(inProgressXrRender.getLeftBufferToRenderTo());
...
}
Then later during the post render OpenXR is informed that the scenes are ready
@Override
public void postRender(){
super.postRender();
if (inProgressXrRender !=null){
xrSession.presentFrameBuffersToOpenXr(inProgressXrRender);
inProgressXrRender = null;
}
}
My two current working theories are:
- The bloom filter is only applying to the frame buffer that is attached to the viewport when the filter is applied; it’s triple buffered so that would make a kind of sense, but the processors belong to the viewport, not the framebuffer
- The bloom filter may or may not be “ready” by the time I present it to OpenXR. But it feels like too regular a flicker for that theory to make sense.
Anything people think could plausibly be causing these problems?