Jump to content

  • Log In with Google      Sign In   
  • Create Account

methods for drawing swamp


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Norman Barrows   Crossbones+   -  Reputation: 2158

Like
0Likes
Like

Posted 23 September 2013 - 04:22 PM

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 1988"

 

rocklandsoftware.net

 


Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 3928

Like
0Likes
Like

Posted 23 September 2013 - 04:25 PM

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.


Edited by phil_t, 23 September 2013 - 04:26 PM.


#3 Adam_42   Crossbones+   -  Reputation: 2512

Like
0Likes
Like

Posted 23 September 2013 - 05:45 PM

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 :)



#4 Norman Barrows   Crossbones+   -  Reputation: 2158

Like
0Likes
Like

Posted 24 September 2013 - 07:50 PM

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 1988"

 

rocklandsoftware.net

 


#5 Norman Barrows   Crossbones+   -  Reputation: 2158

Like
0Likes
Like

Posted 24 September 2013 - 08:17 PM


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 1988"

 

rocklandsoftware.net

 


#6 Servant of the Lord   Crossbones+   -  Reputation: 19665

Like
0Likes
Like

Posted 24 September 2013 - 08:38 PM

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?


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#7 Norman Barrows   Crossbones+   -  Reputation: 2158

Like
0Likes
Like

Posted 28 September 2013 - 09:56 AM


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 1988"

 

rocklandsoftware.net

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS