Hi,
Our game has a very big view range (up to 7km), and we decided to draw a lowpoly version of the terrain underneath the actual terrain. Well, this works really good, while we have huge view ranges the active world range is kept relatively small to take full advantage of EE world streaming.
Later we also want to add some lowpoly billboard-based forests, so it might happen that the lowpoly terrain is actually higher at some places than the EE terrain. In order to prevent seeing the lowpoly terrain on close range we want draw the lowpoly terrain always behind all of the world geometry (except the sky).
The lowpoly terrain is a simple Mesh and gets drawn explicitily in code. But so far I did not managed to get this working...
The desired draw order is:
Sky
Lowpoly Terrain
Game.World
I already noticed that I couldn't use the usual Renderer and disable depth writing for one draw call, because the draw calls in EE get delayed. With RM_BLEND it did not work because RM_BLEND seems to be called after RM_PREPARE (makes sense).
So I decided to make use of the background rendering feature of the engine:
Code:
D.clear(BLACK);
D.depthWrite(false);
_terrainMesh.draw(MatrixIdentity);
D.depthWrite(true);
// Didn't work either:
//D.clearZ();
Renderer.combine = true;
Renderer(Render);
Renderer.combine = false;
Why isn't that working? I am not quite sure how to achieve that the terrain gets rendered in front of the sky, but so far it doesn't even get rendererd behind the Game.World :(
So how long do draw calls get delayed? Is the reason why this isn't working, that the _terrainMesh gets added to a list and is rendered by the renderer (without depthwriter being disabled)? How do I prevent this from happening? Is there some kind of renderer flush method?
Does anyone have an idea how to get this working? Did I miss something?
Any help is greatly appreciated.
// Note: I am using EE 1.0