How to determine if a plane is occluded

Started by
0 comments, last by y2kiah 18 years, 7 months ago
Hello everyone, I've recently added some water to my terrain engine. I've used Michael Horsch's water shader which is, from what I can see, somewhat based on Yann L's article in theory. Works and looks pretty fine. But like it always is, a problem came up - the water eats up my framerate big time due to the two additional renderpasses I need for reflection and refraction texture. At the moment I'm using one superlarge groundwater plane (quad) which is just as large as my terrain. Wherever the terrain is lower than the groundwater level, the water becomes visible. That means, it could be possible, that for example only a small lake will be visible within the whole terrain - but I will go through the water rendering routine every frame anyway, no matter if the water is visible or not (see this screenshot). Since the water plane will basically always be within the view frustum, I can't use my standard frustum culling algorithm to not render water wherever it's not visible - I have to test whether the terrain is lower that the groundwater level at any point within the view frustum and only then generate the reflection/refraction texture. Unfortunatly I don't have any clue how I could do that. Can anyone help? Another thing I'd like to ask: A few days ago a friend of mine showed me the Earth 2160 Terrain Editor. Within that editor, it is possible to add several water planes at different heights with full reflection and refraction - and the framerate basically stays the same. Does anyone know how they do that? Thanks for any hints in advance Greets Chris
Advertisement
instead of having a universal water plane you can define smaller water areas throughout the map, test them against the frustum, and do the render to texture passes only if you need to. Keep in mind that for every water area that is visible with a different height, you will need another 2 render to texture passes, so set up your world wisely to minimize this. Chances are you are extremely fill rate limited right now. Make sure you are taking advantage of early z culling, basically don't reference the depth buffer anywhere in your water shaders. It may also be possible to take advantage of the stencil buffer in the render to texture passes to improve the frame rate, but I'd have to think about that one more.

This topic is closed to new replies.

Advertisement