Issue with rendering multiple views in C++ #9148
-
I'm attempting to move an existing Android implementation to a JNI/native layer implementation. In Android, I currently have multiple views, each with their own camera and scene. I created two views to be able to have a 3D scene (with perspective camera settings) and a 2D overlay (with orthographic camera settings). In my render routine, I simply have: if (renderer.beginFrame(swapChain, frameTimeNanos)) {
renderer.render(view3D)
renderer.render(view2D)
renderer.endFrame()
} Additionally, I have the renderer set to use a clear color of transparent black; the view3D is set to be opaque and a skybox of solid black; the view2D is set to be translucent and a skybox of translucent black. The above code works fine on Android; however when transitioning to C++, the render window will occasionally go black. Within the C++ implementation, I've mimicked the entire configuration (views, scenes, cameras, swap chain, renderer, etc.) exactly. And this implementation renders fine if I only render the 3D view; however, when I add the rendering of the 2D view, the render window occasionally goes back and forth between being solid black and normal rendering. Is there something I'm missing in configuring the views or how I render? I tried using completely separate swap chains and renderers for 3D and 2D, and that didn't fix the issue. I don't understand how this works in Android, but doesn't work in JNI/native layer. Any help or insight would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have fixed the issue and posting my fix if it may help others. I was able to first pinpoint the issue as part of the post processing process as I disabled all post processing. I didn't witness the flickering issue, although the rendering was degraded (as you'd expect). Knowing this, I systematically went through each of the post processing processes and found that the issue was with the DynamicResolutionOptions. I was enabling this feature in both Android and C++ implementations, but I didn't change any of the default settings. In Android, this worked fine; however, when moving to C++, it didn't. I had to change the minScale from { 0.5f, 0.5f } to { 1.0f, 1.0f } in C++ for it to work (or not have the flickering issues I was seeing). I would have thought that the default setting of { 0.5f, 0.5f } would apply for both implementations, and maybe it does. But for some reason, I had to set it to { 1,0f, 1.0f } to not have the flickering when moving to C++. As another reference, I don't change the window size during execution -- the window/surface dimensions are constant. |
Beta Was this translation helpful? Give feedback.
I have fixed the issue and posting my fix if it may help others. I was able to first pinpoint the issue as part of the post processing process as I disabled all post processing. I didn't witness the flickering issue, although the rendering was degraded (as you'd expect). Knowing this, I systematically went through each of the post processing processes and found that the issue was with the DynamicResolutionOptions. I was enabling this feature in both Android and C++ implementations, but I didn't change any of the default settings. In Android, this worked fine; however, when moving to C++, it didn't. I had to change the minScale from { 0.5f, 0.5f } to { 1.0f, 1.0f } in C++ for it to work (o…