wraitii Posted February 11, 2016 Report Share Posted February 11, 2016 Speaking as the maintainer of the water code: Seems like you managed to fix the weird inverted normal Issue I had which made specular wrong and I never bothered to fix. By this point I expect you have noticed I'm using real reflections for the skybox and distorting a transparent "reflection map" for objects that are near. FYI the "artifacts" when you orient the wind north are dependent on graphic cards. It never happened for me on Intel GMA and I could never fix it because of that. Make sure to test your code with all textures types and all waviness settings as there is a lot of room for mistakes there. Likewise, the Red color that appears at low angle is WorkingAsDesigned and is there because of the distortion code. With the shader tries to get refraction texels that are "above water" pixel and contain garbage data. I detected this in the shader by checking the red component against the other one (the "horrible hack") and choosing the original undistorted texel in this case. However in some cases even that is insufficient. SO if you just remove the hack you're only going to break it further. The red comes from the C++ code, the refraction texture is cleared with (255,0,0) before drawing the refraction. So when you fetch a pixel that's not rendered (above water) you get full red, which is why it happens on the edges of the map. The proper fix for that problem is not trivial. Also FYI the shore waves took me months of thinking to get somewhat right. I do not believe they are recomputed every frame, though, if they are it's an insane bug on my part. IIRC I create polygons by trying to follow the shore, but I never got it to work really well. Edit: Oh yeah also I see you removed my comment about reflections being wrong at low angles far away, but the problem is still there. Just as an FYI, I still believe my "default to sky color" is the right way to go about this, but there is one thing to notice: since the normal map gets entirely blurry, the normal of the water plane becomes (0,1,0) ie straight vertical. But in real-life, you see the sky more because of the wave ripples. See my attached diagram. So that may be another thing to go after. 2 Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 11, 2016 Author Report Share Posted February 11, 2016 The fact that pixels outside of the water plane are cleared to red is helpful in figuring that out. I'll have to tinker with that now that I know the cause. I was probably mistaken about it recalculating the shore line every frame. Shore waves are kind of expensive but probably for other reasons. Also, why does the normal map become blurry? I didn't see any particular evidence of lod being used, although it might be, but the water plane should be taking the surface normals directly from the normal map (and normalized vectors are distance and angle independent). Also note that if the angle between the view vector and the surface normal is small (ie looking at the side of a wave) what you -should- get is more refraction and less reflection anyway. The old fresnel function was also kind of bad, being nearly linear when reflections should be more confined to grazing angles. Another issue I found was that the addition of small waves on top of the large ones creates high frequency artifacts in the refractions (particularly with ocean waves). Removing them did not noticeably reduce wave details, but did remove the high freq noise. The small-wave-noise also made it look like the water was rushing along in a current rather than just being waves in a static body of water, and is a lot more noticeable with a high-res refraction map. Quote Link to comment Share on other sites More sharing options...
wraitii Posted February 11, 2016 Report Share Posted February 11, 2016 Yeah, I'm aware of that last issue, but you're really free to change it if you think it looks better. About the normal map point: The textures used at low angle, even with a lot of anisotropic filtering, end up being blurred at low angles, or are very "sharp" which looks even worse (basically either left or right here). You need at least 16x anisotropic filtering to keep it acceptable, and even then it's never really enough. Also I might have done the linear fresnel thing on purpose: we as humans are used to seeing reflections on water, as we tend to look at water at a low angle. Looking at water from above with no reflections at all looks kind of odd, so I artificially made my water too reflective. You're right that looking at the side of a wave means more refraction, but because of the problem in my diagram above instead code usually shows reflections, which is basically entirely wrong. Feel free to ask any other question. 2 Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 12, 2016 Author Report Share Posted February 12, 2016 (edited) 13 hours ago, wraitii said: Yeah, I'm aware of that last issue, but you're really free to change it if you think it looks better. About the normal map point: The textures used at low angle, even with a lot of anisotropic filtering, end up being blurred at low angles, or are very "sharp" which looks even worse (basically either left or right here). You need at least 16x anisotropic filtering to keep it acceptable, and even then it's never really enough. Also I might have done the linear fresnel thing on purpose: we as humans are used to seeing reflections on water, as we tend to look at water at a low angle. Looking at water from above with no reflections at all looks kind of odd, so I artificially made my water too reflective. You're right that looking at the side of a wave means more refraction, but because of the problem in my diagram above instead code usually shows reflections, which is basically entirely wrong. Feel free to ask any other question. I see what you mean about normal maps now. That would indeed be a limitation of normal maps since the water surface technically remains flat, but the reason I removed the comment is simply because I've never seen any visually disturbing artifacts as a result of that. It might occur on huge maps, but I've never actually seen any of those, either (not that I've seen every map for that matter). The linear fresnel thing did indeed include reasoning, but I always found it to be visually disturbing. On the other hand I do see what you mean, since the water surface becomes invisible without any reflections at all (and irl the effective view angle would be distorted by lens effects). A more 'correct' solution would be to utilize a bias term in the fresnel approximation, which is what I ended up doing. The fresnel function I'm using currently looks like this: fresnel = clamp(((pow(1.1 - ndotv, 3.0)) * 1.5), 0.2, 1.0); where 3 is the power, 1.5 is the scale and 0.2 is applied as a bias through clamp. It ends up looking like this: Actually I do have a relevant question. For some reason fish display 'ghost refractions' that aren't fully opaque even though the fish are. You can see it especially in the bottom right of this screenshot: I think that's probably the culprit of 'off-colored-fish' issues that people have reported, but I'm not sure why it only happens for fish and not terrain. EDIT: Nevermind, the discoloration is a problem with depth, and I'm not sure how to fix that properly. Basically it uses the depth of the fish but the texture of something else due to the displacement. Edited February 12, 2016 by aeonios 1 Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 12, 2016 Report Share Posted February 12, 2016 “I think that's probably the culprit of 'off-colored-fish' issues that people have reported, but I'm not sure why it only happens for fish and not terrain. ” @aeonios :This is because of the water depth and the height of the problem of fish produced by the phenomenon of fish. Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 12, 2016 Author Report Share Posted February 12, 2016 Well, I figured out why that is. It's because 'water depth' is an approximation and not an accurate method for creating refractions. If the difference between the depth of the fish and the depth of the terrain behind them is large you end up with fish-shaped distortions. That's one of those 'only ray tracing can do that properly' effects, but I think I've got it to the point where it's pretty good nonetheless. Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 12, 2016 Report Share Posted February 12, 2016 (edited) And more importantly, the camera Angle. When the camera out and rise will appear red fish. Edited February 12, 2016 by feneur Removed distracting formatting Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 12, 2016 Author Report Share Posted February 12, 2016 I think I've got it cleaned up well enough now, and finally got SVN set up to make a diff. Ticket here: http://trac.wildfiregames.com/ticket/3781 5 Quote Link to comment Share on other sites More sharing options...
wraitii Posted February 12, 2016 Report Share Posted February 12, 2016 3 hours ago, aeonios said: Well, I figured out why that is. It's because 'water depth' is an approximation and not an accurate method for creating refractions. If the difference between the depth of the fish and the depth of the terrain behind them is large you end up with fish-shaped distortions. That's one of those 'only ray tracing can do that properly' effects, but I think I've got it to the point where it's pretty good nonetheless. Yup, you're entirely right. I tried some stuffs to fix that but it just added more problems. I'm quite interested in your patch, looks good. Re normal maps: there are no visual artifacts. There's only a visual "issue" that you see flat reflections instead of seeing what you should see (a mix of water color and sky). Check out this picture, we see very little reflection in the distance, as the water isn't flat. Compare with this. And in-game in the attached picture. It only ever happens at low angles, but it looks very bad on cinematic shots. 2 Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 14, 2016 Report Share Posted February 14, 2016 In this screenshot coastline effect let people look like the edge of the water and waterfront edge is stuck together, it is very rough, the lack of natural and true feeling. Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 14, 2016 Report Share Posted February 14, 2016 (edited) How do I see the sun? I tested the patch: #3781 [PATCH] (Improved Water Rendering Ticket), but did not see the effect of sunlight and water. Edited February 14, 2016 by feneur Removed distracting formatting Quote Link to comment Share on other sites More sharing options...
niektb Posted February 15, 2016 Report Share Posted February 15, 2016 I was wondering, from a scenario designer POV, how does this affect the 'murkiness' option in Atlas? 1 Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 15, 2016 Author Report Share Posted February 15, 2016 17 minutes ago, niektb said: I was wondering, from a scenario designer POV, how does this affect the 'murkiness' option in Atlas? Not at all. At first I thought there was some problem with excessive murkiness, but I found out later that it was just the map settings. In the end I left it the same, and murkiness isn't affected by the changes in refraction. Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 15, 2016 Report Share Posted February 15, 2016 (edited) Where they are? I tested it, I didn't see the real effect of specular reflection? Please help me. Edited February 15, 2016 by Itms Removed distracting formatting Quote Link to comment Share on other sites More sharing options...
niektb Posted February 15, 2016 Report Share Posted February 15, 2016 20 hours ago, gameboy said: effect of sunlight This entirely depends on the sky that's used and therefore differs from map to map (and won't be visible at all if you can't see the sky) 1 Quote Link to comment Share on other sites More sharing options...
wraitii Posted February 15, 2016 Report Share Posted February 15, 2016 I think you made refraction too weak at low waviness. 2 Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 16, 2016 Report Share Posted February 16, 2016 (edited) @wraitii: I used the highest set of the game, why the use of the aeonios patch, there is no such a beautiful surface reflection effect? I can't see the effect: Please help me to achieve this effect, thank you, my friends, I like this effect, it looks great. Edited February 16, 2016 by gameboy Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 16, 2016 Author Report Share Posted February 16, 2016 12 hours ago, wraitii said: I think you made refraction too weak at low waviness. That's not so much a problem at low waviness as it is with low water depth. I've been trying to improve that but without much success as of yet. 1 Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 16, 2016 Report Share Posted February 16, 2016 But you realized so beautiful surface reflection effect, why I use the patch you have no such effect? Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted February 16, 2016 Report Share Posted February 16, 2016 1 hour ago, gameboy said: But you realized so beautiful surface reflection effect, why I use the patch you have no such effect? 1. Did you rebuild pyrogenesis with the patched files? 2. If you did you have to have the right angle in relation to the sun to see the sun reflection. This is true without the patch as well. 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted February 16, 2016 Report Share Posted February 16, 2016 (edited) Sometime I think the reflections of objects can be too colorful (and too bright) or too detailed. I think it is difficult with current game's rendering to get this effect, which I see in most rivers in rreal life: Edited February 16, 2016 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 16, 2016 Report Share Posted February 16, 2016 1. Yes 2. I adjusted the Angle, can see the sun, but was unable to see the effect of the water reflects sunlight, so beautiful you make with his patch? Quote Link to comment Share on other sites More sharing options...
gameboy Posted February 16, 2016 Report Share Posted February 16, 2016 You should see him screenshots, the surface reflection effect is very beautiful. Quote Link to comment Share on other sites More sharing options...
wraitii Posted February 16, 2016 Report Share Posted February 16, 2016 Yeah this color-fade effect isn't handled very well. I think another direction to work on is to base reflections more intelligently on normals. If the reflection vector ends up being "straight up" there should definitely not be a reflection of a nearby object from the map. About depth: I find the idea of a logarithm very interesting. 1 Quote Link to comment Share on other sites More sharing options...
aeonios Posted February 16, 2016 Author Report Share Posted February 16, 2016 wrt color, I think part of the issue is that colors in the real world are generally less saturated than the colors in game art. That was also the reason why I cut the intensity of sky reflections in half. I think another issue is that there's no map level control over shadow color. The shadows in that photo are very dark, but the ones in game are much brighter. 1 hour ago, wraitii said: I think another direction to work on is to base reflections more intelligently on normals. If the reflection vector ends up being "straight up" there should definitely not be a reflection of a nearby object from the map. That only occurs if the nearby object is blocking the view of the sky. Reflection distortions just tend to make the objects look wavier rather than breaking up the reflections like what water tends to do more, but I don't see a way of fixing that reasonably. 1 hour ago, wraitii said: About depth: I find the idea of a logarithm very interesting. log is one of those useful slowly increasing functions. Getting refractions to look good everywhere is still a challenge I'm working on though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.