#3781 closed enhancement (fixed)
[PATCH] Improved Water Rendering
Reported by: | aeonios | Owned by: | wraitii |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 21 |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
-Increases reflection and refraction texture sizes. -Changes the refraction function to be less extreme and to work better over a larger range of water depths. -Improves the reflection/fresnel function so that reflections fall off more naturally. -Reduces the intensity of sky reflections because the color is too extreme otherwise. -Reduces the distortion intensity for reflections to a more natural level.
-Cleans up the code a bit, removes old commented-out stuff and adds/improves comments in a few places.
Attachments (5)
Change History (23)
comment:1 by , 8 years ago
Keywords: | patch review added |
---|
comment:2 by , 8 years ago
comment:3 by , 8 years ago
I have tested it, but I don't see the effect of the water and the sun on your image. This is why?
comment:4 by , 8 years ago
When testing #3697, we also tested this patch, since it is included in attachment:trade-v2.3.patch:ticket:3697. All three of us got errors and water that was rendered completely black. It apparently has something to do with the user.cfg (likely the one of a19).
comment:5 by , 8 years ago
If you don't provide the error log then there's nothing I can do about it. :|
by , 8 years ago
Attachment: | errors.txt added |
---|
comment:6 by , 8 years ago
aeonios : you won't get the errors while replaying ? I join the errors i got in console.
comment:7 by , 8 years ago
hmm.. that looks like the patch is not being applied properly, or perhaps was not created properly. The variable it's saying was not declared definitely has a declaration and is only used within the ifdef where it was declared, so a garbled file seems most likely. I have no idea why that would happen though.
comment:8 by , 8 years ago
Description: | modified (diff) |
---|---|
Keywords: | review removed |
- With the latest patch after compiling:
ERROR: Failed to compile shader 'shaders/glsl/water_high.fs': Fragment shader failed to compile with the following errors: ERROR: 0:260: error(#143) Undeclared identifier: refColor ERROR: 0:260: error(#202) No matching overloaded function found: mix ERROR: 0:260: error(#160) Cannot convert from: "const float" to: "highp 3-component vector of vec3" ERROR: 0:331: error(#143) Undeclared identifier: alphaCoeff ERROR: error(#273) 4 compilation errors. No code generated
Options:
waterfancyeffects = "true" waternormals = "false" waterrealdepth = "false" waterreflection = "false" waterrefraction = "false" watershadows = "true" waterugly = "false"
Switching some functions (in particular water-refraction) triggers errors too.
- Why do you change things like
ReflectionTextureSize
toRefTextureSize
? (Could the error even have something to do with this?)Ref
reads less descriptive thanReflection
.
- Comments should start with capital letters
- But the effect looks impressive and it should be committed in my opinion!
comment:10 by , 8 years ago
Ah, ok those errors are real and occurred due to reflection and refraction being disabled. I need to double check some things but that should be fixable.
The reason why I changed it from ReflectionTextureSize to RefTextureSize is because there used to be two separate values, ReflectionTextureSize and RefractionTextureSize, which is also why it's now simply 'ref' as in REFlection and REFraction.
wrt refractions I agree. The problem is getting them to be strong enough under low waviness/depth without causing pinching artifacts under high waviness/depth. I may try using a constant distortion factor and see how that works.
comment:11 by , 8 years ago
I can confirm fatherbushido errors when enabling everything but Refractions. This config make water completely disappear.
by , 8 years ago
Attachment: | water.diff added |
---|
comment:12 by , 8 years ago
I fixed the issue with the shader breaking when refraction is disabled. It now also obeys water murk color settings when refraction is disabled as well.
Fixed comments. (except one that starts with a variable name)
I also changed the distortion factor to be constant rather than depth based. Distortions should now be more noticeable in low waviness (to a point) and seems to work well enough on gold oasis and greek acropolis. With high waviness it's not too extreme, and taking depth out of the equation should fix some of the issues with fish.
I also managed to reduce the severity and frequency of red water issues. I think the reason that happens is because the refraction map is not rendering the water plane properly from certain angles (zoomed in or from off map), which causes what should be terrain to instead appear as pure red (the clear color). Previously it also tried distorting in the opposite direction when encountering out-of-bounds pixels, but that didn't seem to improve anything. Now I have it use entirely undistorted coords instead, which seems to work a bit better. A proper fix should be possible but I have no idea how long it'll take to track down exactly what's wrong.
comment:13 by , 8 years ago
Keywords: | review added |
---|
comment:14 by , 8 years ago
Milestone: | Alpha 20 → Alpha 21 |
---|
by , 8 years ago
Attachment: | water_r.png added |
---|
by , 8 years ago
Attachment: | water_r2.png added |
---|
comment:15 by , 8 years ago
About the last patch (all options are enabled, Cycladic Islands & Golden Island):
- water looks too transparent (need dependence of depth)
- reflection looks a bit strange
- need to test, but for me it seems a lower performance
- windows eols, few comment and indent issues
comment:18 by , 8 years ago
Keywords: | review removed |
---|
Code seems OK at first glance, I'll review the changes later, but there is one thing I'd suggest you go back on: refractions can actually benefit from a downscaled texture as it applies a rudimentary "blurring" effect, which looks better.