methods for drawing swamp

Started by
5 comments, last by Norman Barrows 10 years, 6 months ago

i'm looking for methods for drawing swamp

in the past i've drawn the ground mesh, then drawn a second flat "swamp water" ground mesh. needless to say, drawing the ground mesh twice is a big performance hit.

any ideas?

drawing a flat swamp water ground mesh, then drawing individual "dry land" meshes occurred to me....

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

Is your swamp water transparent? If not, then you can use the depth buffer and draw it before the ground mesh. Then you'll avoid the pixel-shading cost of the ground mesh that lies under the water.

On what hardware is rendering the two different ground objects on top of each other expensive?

On thing you can probably do to speed things up for the underwater terrain is to simplify the pixel shader by reducing visual quality. As long as the water surface has some roughness to it you can probably get away with a fairly basic shader as the detail will be hidden.

You might also find http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter19.html useful to draw that rough refractive water relatively cheaply.

It's the reflection that gets really expensive - you'll need to re-render the whole scene to a texture to make that work well :)

Is your swamp water transparent? If not, then you can use the depth buffer and draw it before the ground mesh. Then you'll avoid the pixel-shading cost of the ground mesh that lies under the water.

yes, that might help a bit. but the ground mesh is typically 50% below, and 50% above the water plane, so its almost a wash as to which drawing order culls more triangles.

and given that this a performance hit, i haven't even considered alpha blended water (but it would be very cool!). i've seen some pretty impressive stuff done with just 2 or three layers of alpha blended water.

maybe i need to make a special swamp water mesh with holes where the land sticks up, and a second ground mesh of just a bunch of little "islands". that would reduce / eliminate the "double draw". it might not be too hard to do that with the terrain chunk ground mesh generator. it already creates a ground mesh of four interleaved meshes, each with its own texture tile. interleaving land and water would be similar.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php


On what hardware is rendering the two different ground objects on top of each other expensive?

that would be an early test on a baseline windows 7 box with on-board graphics chip only, dx9 fixed function, using individual dynamic quads (sloooow). since then I've switched to static ground chunks generated on the fly as needed (MUCH faster). for now, the swamp is drawn as chunks, with just a single placeholder texture that is a photo of swamp that has both land and water. looks awful! <g>. its not even seamless.

but static vs dynamic might make enough of a difference - even without generating separate interleaved land and water meshes.

water is drawn with aniso tmapping & mipmaps, and (usually) one directional light. no blending, alpha, etc. so filtering methods are about the only simplification possible, lose the aniso and mipmaps, but it probably wouldn't get me much. i could turn off lighting and manipulate the look of the water by using multiple textures. that would save lighting calculations. or i could break down and write a shader. but the fixed function capabilities i'm using for this scene at the moment are very basic. i think vs 2012 even pre-generates it as one of the basic shaders when you start a new directx project. so i doubt my shader pcode would be faster than fixed function machine code.

reflection is probably not possible, due to the long visual ranges ( ~1000 d3d units). i'll be glad (to start at least) if i can just do land and water as plain old textured quads, without reflection, refraction, or translucency. then i can think about "turning up the volume" on the graphics some more if possible.

perhaps i'll give brute force static meshes a try and see what happens. if they're too slow "double drawing", i can always attempt to interleave. but the land and water may not slice up into separate quads nicely.

i suspect at least some overlap will be required.

i'd definitely like to get this working, as it was one of the better effects from the original version - despite the fact that it ran slower than anything else in the game.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

What kind of 'performance hit' are you talking about? If you're not slower than your target goal, when running in release mode, then there probably isn't much of a problem. Are you measuring your performance in FPS or microseconds?


What kind of 'performance hit' are you talking about? If you're not slower than your target goal, when running in release mode, then there probably isn't much of a problem. Are you measuring your performance in FPS or microseconds?

pretty bad. about 10-12 fps vs the minimum playable 15 fps. but that was with the old dynamic quads. i'll try the ID software approach: brute force at what the pc is good at doing fast (static meshes). seems to work out ok for them most of the time. OTOH, its a non-static world, and i can't afford a mips alpha and a month to pre-calculate possibly visible surfaces, so maybe ID's way isn't a good example to follow.....

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

This topic is closed to new replies.

Advertisement