Jump to content

Of water and waves


wraitii
 Share

Recommended Posts

Interesting... Seems like you have an intel GMA 950, perhaps it doesn't support some of the stuff I'm doing. Does the post processing work (independently from the water)?

If it happens every time, could you try debugging using gdb? I'm afraid the logs don't give enough information.

(while this gets sorted out, check these (1,2) out.)

Link to comment
Share on other sites

Have superfancywater config option an equivalent in the setting menu? I am asking because whatever setting I have in the config file for superfancywater, the water options in the game menu are always enabled.

Also it would be nice to have a sound effect for waves (with volume depending on zoom level, no sound when zoomed too far).

Link to comment
Share on other sites

Yes, I added a toolbox. Ultimately this should probably be a dropdown box with "lowest, low, medium, high, highest" setting but I haven't implemented such flexibility yet.

What I mean is: is superfancywater local.cfg option matching "Enable advanced water" in the in-game options menu? If yes it's not working properly because the in-game menu option is always enabled no matter of the local.cfg option.

Link to comment
Share on other sites

If I'm reading this correctly, your issue is caused by the ntdll.dll library... Which is weird. I'm not even sure what that library is.

ntdll.dll is for low-level OS functions. Our vertex arrays use memory-aligned blocks, so they might be calling stuff in there (most likely indirectly). Maybe you are passing some wrong parameter somewhere? Otherwise, this could be good, old memory corruption, like writing past the end of an array or dereferencing dead pointers, that sort of thing.

Link to comment
Share on other sites

I guess I could be passing some wrong parameters, but it's probably more likely a good old memory corruption mistake. I'll give a look at the code to see if i can find anything.

(I'm fixing some issues with shadows right now, and perhaps some issues with retro-compatibility on some older hardwares.)

Link to comment
Share on other sites

Pretty weird... I'll look into that, I've got something to do atm.

I've fixed some errors with shadows being off, I'll commit when I get back (see IRC, FeXoR's having a weird issue).

Fabio: it happens on all maps?

Yes for the "black areas", I suppose yes also for the zigzagged shoreline, but it's probably less noticeable on some maps (clearly reproducible at least on two maps).

A last design issue is that waves always go to the beach, while foam goes back and forth: in some maps it doesn't seems very realistic, maybe in this case waves should be disabled?

Link to comment
Share on other sites

Hmpf, I'm getting a segfault on cycaldic archipelago and some other errors (not the ones you have though). Should look into that, might be related to Lion's problems.

edit: ah, no, that sounds related to some AI changes. Nevermind.

Edit 2: Okay, so I'm getting neither, so this is another hardware problem. I am getting some weird stuffs with the foam and the LOS though, should check that.

About the waves: it's also an artifact of the way I generate waves. I'm about 30% happy with it...

Fabio: the black areas could be a problem with the depth buffer. How does the fog work for your computer?

Edit3: could some testers report on performance, too? On my computer, the difference between superfancywater = false and superfancywater = true is basically 0.2 ms, negligible enough. Mainly, I'm considering making the "normal" water also use the depth buffer for depth, it'd give a much nicer result.

Link to comment
Share on other sites

Edit3: could some testers report on performance, too? On my computer, the difference between superfancywater = false and superfancywater = true is basically 0.2 ms, negligible enough. Mainly, I'm considering making the "normal" water also use the depth buffer for depth, it'd give a much nicer result.

The difference for me is 1 fps. :)
Link to comment
Share on other sites

Hmpf, I'm getting a segfault on cycaldic archipelago and some other errors (not the ones you have though). Should look into that, might be related to Lion's problems.

edit: ah, no, that sounds related to some AI changes. Nevermind.

Edit 2: Okay, so I'm getting neither, so this is another hardware problem. I am getting some weird stuffs with the foam and the LOS though, should check that.

About the waves: it's also an artifact of the way I generate waves. I'm about 30% happy with it...

Fabio: the black areas could be a problem with the depth buffer. How does the fog work for your computer?

I had some problem with postproc effects see here and later posts for the full story.

Edit3: could some testers report on performance, too? On my computer, the difference between superfancywater = false and superfancywater = true is basically 0.2 ms, negligible enough. Mainly, I'm considering making the "normal" water also use the depth buffer for depth, it'd give a much nicer result.

FPS went from 20-21 to 13-14 with fancywater here (RV530 with git mesa driver).

Link to comment
Share on other sites

About Atlas and super fancy water, I did an experiment and it's actually quite simple to do away with the g_GameRestarted hack, because the simulation sends MT_TerrainChanged messages whenever terrain changes including when a map is loaded. CCmpWaterManager can handle this in a similar way to how CCmpTerritoryManager does.

When terrain is not being modified, it works quite smoothly as expected and the foam/waves look correct. The problem is when terrain is modified (or the water height adjusted - don't forget that case), the update is so slow, there is a noticeable delay in the rendering. It would be very annoying if this happened in Atlas. At the same time, it's not easy to preview how the environment settings will affect the super fancy water in-game, so I think this problem should be solved.

Is it possible to optimize the update code, or can it be split into multiple steps and stretched across frames, or moved into a thread, instead of forcing it into a single frame?

Link to comment
Share on other sites

I'm mainly asking or the difference between fancy and superfancy. The reflections/refractions are really causing the lag with the water.

Sorry the performance drop was with superfancywater. Fancywater doesn't have a noticeable FPS drop.

Do these black areas move? Are they waviness dependent?

They depends on the distance and IIRC they move, however I am not sure since I cannot test again until next week. (Also a note that with superfancywater I don't see error by the graphics driver about unassigned input).

Link to comment
Share on other sites

I guess I could make it run over multiple frames for a small overhead cost, in Atlas. Perhaps I could use another function that would basically be the same code updated to run over multiple turns.

There are also likely optimizations, it's not the fastest code since it was not really needed in-game, but it probably can't be made much faster unless I realize my math is completely idiotic.

Another solution is to only reload when "MT_TerrainChanged" is no longer being sent, ie when the player releases the mouse in Atlas or something. I'll have to check.

Anyway, about the water: right now there are three levels

-non-shader. A simple filter, using transparency. Extremely ugly, no fog support.

-reflections. Shows real reflections and refractions (very slow. On my computer this is about 80/90% of the time to render water), waves, uses "depth at surface". Supports fog.

-advanced. Uses the real depth, shows foam and waves, has "interpolated" wave effects that look nicer. Supports fog too.

I'm thinking of switching to:

-hypothetically, fixed function, like before, for compatibility mainly.

-'lowest': simple shader based stuff. Using transparency instead of refraction, reflecting only the skybox (as a texture), perhaps some basic wave effect, fog support. Since that would not render reflections and refractions, it should allow most users to enjoy a water that's not too ugly, and functional

-'low' level: this would have realistic reflections (ie the whole thing, not only the skybox), still use transparency instead of refraction, and use fake "surface" depth along with some semi-nice wave effect.

-'medium' would add real refraction and real depth (refractions only if it's not too costly, might swap it with foam or something. )

-'High' would be the whole thing, adding shadows on the water, interpolated waves, foam…

(perhaps a 'highest' could be considered, I'd have to check).

This would have the benefit of allowing most users to enjoy a water that's not too ugly, at a little cost since refractions/reflections is really slow. Also, I think up to 'medium' ARB support would be possible. After that it may require too many different texture sampling for ARB, which is pretty limited in that aspect.

@Fabio: ah, I see. Seems pretty weird, the drop should be between no shader at all and fancywater, not between superfancywater and fancywater. Who knows. As for the black areas, report again whenever you can, as long as it doesn't crash I'm going to say it's not highest priority.

Link to comment
Share on other sites

@fabio: are you using the latest radeon mesa git code base driver.

There was some fix given in the radeon mesa code base for performance improvement

http://www.phoronix....item&px=MTIxOTI

There are some other areas that patch made impact on, some games are slow.

Can you check if that affects this

Yes, thanks, I know about it but I am using older r300 driver, the patch is only for r600 driver. I opened an interesting similar bug affecting both r300 and r600 with 0 A.D. some time ago, however: https://bugs.freedesktop.org/show_bug.cgi?id=44536

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...