I have read through the forum and quite a few people have had problems with multiple camera's.
I have code that works, but due to the number of people having issues I wanted to check that what I am doing is correct.
Basically I am writing a split screen flight sim (two players).
To add one additional level of complexity I want to use two different models:
- A high detail (combat) model which contains the planes and items of interest
- A low detail model for the terrain
These two models have different far planes so that I can keep my triangle count down.
Each model has its own root node and its own RenderPass.
Note:
I don't care about fog on the high detail model (things can just pop into view as they are typically really small).
For now I have locked the second camera to the first and point it backwards.
Q1
I understand that if I wanted to use the whole screen to render the first camera's, then overlay a piece with the second camera that would be an issue, because the back and depth buffers would be screwed, but is there any issue as long as I split screen it?
Q2
Do I really need to attach the camera's to the models?
As long as both models origins are 0,0,0 I think I can loose the attach/detach calls.
TIA
Anyway heres my render method:
protected void render(float interpolation) {
Renderer r = display.getRenderer();
/** Clears the previously rendered information. */
r.clearBuffers();
// Execute renderQueue item
GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).execute();
camera1.setFrustumFar(20000f);
camera1.update();
display.getRenderer().setCamera(camera1);
/** Have the PassManager render. */
terrainPass.renderPass(display.getRenderer());
camera1.setFrustumFar(2000f);
camera1.update();
combatPass.renderPass(display.getRenderer());
camera2.setFrame(camera1.getLocation(), camera1.getLeft().negate(), camera1.getUp().clone(), camera1.getDirection().negate());
camera2.setFrustumFar(20000f);
camera2.update();
display.getRenderer().setCamera(camera2);
/** Have the PassManager render. */
terrainPass.renderPass(display.getRenderer());
camera2.setFrustumFar(2000f);
camera2.update();
combatPass.renderPass(display.getRenderer());
}