Opened 12 years ago

Closed 11 years ago

Last modified 8 years ago

#1572 closed enhancement (fixed)

[PATCH] Water effects enhancements.

Reported by: wraitii Owned by: wraitii
Priority: Nice to Have Milestone: Alpha 12
Component: Core engine Keywords: water, shader, graphics, patch
Cc: Patch:

Description (last modified by historic_bruno)

(creating a ticket since it seems more convenient and Kieran recommended it on another matter).

So I've been working on updating the water shader effects. This features: -A new setting: "superfancy", in-game "advanced effects" I believe, which activates : coastal foam, waves, more realistic water depth and thus water rendering. -For fancy and superfancy water, a nicer and more customizable system for choosing the color of the water, based on both the tint and the color of the water. -The normal map that simulates waves has been enhanced: it's smoother on superfancy as it interpolates more between each frame(thanks to myconid), its effect scales with the waviness (which thus becomes much more visible a factor).

It's already pretty much up-and-running, and should be reasonably fast. The basic mode has practically not been modified, the "fancy" has been slightly but should be about as fast, while the "superfancy" is a bit slower, but not by too much on my computer.

Waves are still sort of a WIP at the moment.

This patch would fix #932, myconid added shadows on water. This patch sort of references #1501 (ship sinking effects could fairly easily be added, I believe). This patch may reference #1380. I don't believe it fixes it but it may change a few things (haven't checked myself).

(I'm still having a few troubles with this "patch" thing, so if it doesn't work, do report).

Attachments (3)

water.patch (296.9 KB ) - added by wraitii 12 years ago.
foam.png (230.3 KB ) - added by wraitii 12 years ago.
shore_wave.png (7.8 KB ) - added by wraitii 12 years ago.

Download all attachments as: .zip

Change History (9)

by wraitii, 12 years ago

Attachment: water.patch added

comment:1 by historic_bruno, 12 years ago

Component: Art & AnimationCore engine
Description: modified (diff)
Keywords: patch review added
Milestone: BacklogAlpha 12

Can you attach the textures separately?

by wraitii, 12 years ago

Attachment: foam.png added

by wraitii, 12 years ago

Attachment: shore_wave.png added

comment:2 by wraitii, 12 years ago

Done. They should go in "binaries/data/mods/public/art/textures/terrain/types/water/".

(thanks for fixing my formatting errors).

comment:3 by wraitii, 11 years ago

Resolution: fixed
Status: newclosed

In 12802:

fixes #1572 and fixes #932
Changes the water rendering in game to support higher quality effects and to look nicer.

comment:4 by historic_bruno, 11 years ago

Some comments about r12802:

It doesn't compile in MSVC, due to ambiguous use of sqrt in WaterManager.cpp. I can fix the build error by casting its argument as a float, but you might want to look at this line and check that it's doing what you expect (especially w.r.t/ rounding).

Then about the entire file, there are issues with floating point types. Generally in C/C++ you should add an "f" suffix to float constants, so 1.0 becomes 1.0f. Otherwise the compiler will default to double precision which is probably not intended. In some cases, that causes a compiler warning (MSVC) when the assumed double value is stored to a float variable. See r12797 if it's not clear what I mean. You might look over the rest of your commit for this same issue.

Here's another example of ambiguity:

terrain->GetExactGroundLevel( (i+xx)*4, (j+yy)*4 );

The parameters of GetExactGroundLevel are float, i/j are signed integers, xx /yy are floats, and 4 is an integer. Personally I prefer making it explicit by casting integers as floats when they're used in float expressions, instead of relying on strange compiler rules :)

In that same line, some of the formatting is unconventional (we don't put spaces before and after parentheses).

comment:5 by ben, 11 years ago

In 12804:

Fixes build error on MSVC, use of sqrt was ambiguous. Refs #1572

comment:6 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.