The Colour of Water

It is often suggested that DX10 water is lighter than DX9, so I thought I would look at why.

 

First DX9 – bloom off water 2.low Shader 2 Original Shaders

 

 

Now DX10

I think its clearly true that there is a difference, ignore the white light on the water in DX9 that’s a separate property it’s the colour tone we are interested in here.

 

I also tried Bojote’s Shader 3 Mod which seems even deeper blue again

 

So what is going on in the water shader?

In both DX9 and DX10 the colour appears to be arrived at by interpolating between the Water Colour from a water texture with the Environment which is another texture this is based on a factor which refers to Fresnel values. It also adds the specular component this is based off the transparency (alpha channel) of the water colour. There are some tweaks too. For DX10 it adds in white caps and also fog. For DX9 the fog is external. There are also some bump textures which have an influence.

Anyway the approach that I took was to break down the process into its various stages and compare the various parts at each stage

DX9

 

DX10

DX9 Shader3 mod w/o fog

So curiously the environment is darker in DX10

Lets look at the Water colour. From this point on I used the Shader Mod 3 shaders because I could then avoid the fogging which gets applied outside the shader in Shader 2.0. This made it easier to compare like for like.

 

DX10

 

DX9 Shader 3

 

Dx10 blend

Slightly lighter in tone?

 

 

DX9 Blend

 

DX10 with altered Fresnel factors for blend to match DX9

 

DX10 After second specular blend (with altered fresnels)

So that’s where the major difference occurs happens – its either the specular values or their blend with the land which is based on the alpha of the base water colour. Unless the land blend is broken it must be the specular factor.

So lets remove the land blend and look at just the specular element.

 

DX10 100% specular component

 

DX9 100% specular

 

Now the DX10 specular term

Color = float4(lerp(Color.xyz + (g_vSunDirectional * specularFactor.x) + (0.3 * (specularFactor.y + saturate(dot(g_vSunVectorWorld_Moon,vSurfaceNorm)))).xxx, baseColor.xyz, fAlpha.xxxx),fAlpha);

Has a multiplier of 0.3 which is 0.1 in DX (so lets reduce it!

 

DX10 with reduced specular factor (showing just the specular term)

Which is getting a lot closer

 

Ok so now Final effect

 

 

And the original DX9 shot

 

And our adjusted DX10 with altered fresnels

 

I hope that you will agree its much closer. In DX9 the single bump map leads to more reflections of the sun which is I think the reason for the differences in the bottom left hand portion – there are specular highlights in DX10 as well but they are out of shot to the left.

About stevefsx

I don't use FSX that much. But I am very annoyed when it doesn't work properly!
This entry was posted in DX10 Water. Bookmark the permalink.

15 Responses to The Colour of Water

  1. Mark says:

    LOL, you continue to both amaze me and impress me, Steve. Great work. So is this something that you’ll be adding to your patch, maybe 3.2?

    When you get time, can you have a look at my post in your ‘DX10 Bloom Tuning’ post. I’ve asked REX (it’s their effects that I can’t get working in DX10) but, as usual, developers don’t seem to want to discuss FSX DX10. This surprises me considering more and more effort is spent (from the likes of REX, TrafficX, FSWC, yourself, etc) on DX10 features/support/compatibility.

    Devs obviously know that there are people who want DX10 sopported in future software but they don’t want to address queries. Maybe they simply don’t know how to address such issues.

    Thank you.

  2. Paul Johnson says:

    I moved the multiplier to 0.2, Steve.. Where did yours end up?

    Cheers,

    pj

    • stevefsx says:

      0.1 in pictures plus fresnel min max to 0.375 and 0.588 from 0 & 1.

      The water constants.xml isn’t used for dx10 it’s all hard coded in a shader header files’ water 40 const or something like that.

      Aces were planning to have different settings for each water class, the parameter exists but is always 0, it’s a shame as it would be nice to be able to remove ocean breakers from rivers!

  3. Paul Johnson says:

    Yes – I noticed the WaterConstants made no difference when we first began playing ..

    Thanks, Steve. . trying it now..

  4. Mark says:

    I’d like to know why DX10 water doesn’t undulate like that of the DX9 water. I’m running REX stuff and in DX9 the water (with whatever effects are being used) gives the appearance of undulation, rolling waves, etc, but in DX10 the water, although looking nicer in my opinion, doesn’t actually warp/transform/undulate. The texture just stays the same, the light (sun, moon, whatever) giving the appearance of any movement.

    I am currently in discussion with REX over this, but I thought I’d ask here too.

    Thank you.

    • Mark says:

      Hmm, after unticking the ‘Wave Animation’ option within REX and seeing absolutely no difference I’m now wondering if Orbx has anything to do with this.

      I performed a complete reinstall of FSX last night (a nightmare is an understatement considering the amount of extras I had installed) and ONLY installed FSX, Orbx scenery (Aus and NZ) and REX.

      Sorry to go slightly off topic here, but this is bugging me.

      • Paul Johnson says:

        Hey, Mark; It can be changed within FSX, just as was the case with the Bojote’s water animation and his Shader mod: It’s just around the corner, but not there yet, but I suspect Steve will look to including this in the next patch. … but don’t hold me to that!

  5. Paul Johnson says:

    Hi Steve: I found that the multiplier had little effect (thus far) all the way down to .001: I also – leaving the FFMin at zero, but moving only the FFMax downward to .01 – Very Dark, .1 – Dark, 1 – M. Blue.

    So – with the multiplier at .001 or at .3 – with the FFMax at .1 and .1 – I get an identically dark pic.

    https://www.dropbox.com/sh/7btxj4pz6q284aw/Z9v8vs3LsD

    …………Multi……..FFMin….FFMax….
    18-25 _ 001 ___ 0.0___ .01___ Very Dark
    18-27 _ .01 ___ 0.0 ___ 0.1___ Dark
    18-30 _ .1 ____ 0.0 ___ 1.0 __ M. Blue
    18-33 _ .3 ____ 0.0 ___ 1.0 __ M. Blue
    18-35 _ .3 ____ 0.0 ___ 0.1 __ Dark

    18-27 & 18-35 were identical.

    Thoughts?

    pj

    • stevefsx says:

      Well my advice would be Start with a dx9 screenshot!

      In terms of the multiplier are you sure that you are changing the right line? There are two in an if !defined(debug). It’s the first One you need to change.

  6. Paul Johnson says:

    The fresnel MinMax setting (was (0,1,satu…) is now (0,0.3,satu…) :-

    #if !defined(SHD_WATER_DEBUG)
    // Compute per-poly fresnel
    o.MiscData = float4(1.0 – lerp(GET_FresnelFactorMin, GET_FresnelFactorMax, pow(smoothstep(0,.3,saturate(-normalize(vWorldPos).y)),0.5)),
    GET_WhiteCapPower,
    0,
    0);
    #else
    // Compute per-poly fresnel
    o.MiscData = float4(1.0 – lerp(GET_FresnelFactorMin, GET_FresnelFactorMax, pow(smoothstep(0,.3,saturate(-normalize(vWorldPos).y)),0.5)),
    GET_WhiteCapPower,
    (g_iWaterShowClass!=0) ? (g_iWaterShowClass==WaterClass) : 1,
    0);
    #endif

    and the multiplier (was .3, is now .1) :-

    // Determine the final color
    Color = float4……………..*envColor, Input.MiscData.x)).xyz,fAlpha);
    Color.xyz = lerp(…………………….n+0.2)*whiteCap.xyz, crashFactor);

    //Color = float4(lerp(Color.xyz + (g_vSunDirectional * specularFactor.x) + (0.3 * (specularFactor.y + saturate(dot(g_vSunVectorWorld_Moon,vSurfaceNorm)))).xxx, baseColor.xyz, fAlpha.xxxx),fAlpha);

    Color = float4(lerp(Color.xyz + (g_vSunDirectional * specularFactor.x) + (0.1 * (specularFactor.y + saturate(dot(g_vSunVectorWorld_Moon,vSurfaceNorm)))).xxx, baseColor.xyz, fAlpha.xxxx),fAlpha);

    • stevefsx says:

      I don’t know what you are changing there! The fresnel min and max factors are the values returned by the macros labelled fresnel min and max factor, not the values inside the smooth step function.
      They come from the water consts header file which serves the same purposes as the water constants.xml in dx9

      The first thing you need to do is locate a combination of water colour and lighting conditions that leads to a big difference between dx9 and dx10. I don’t know whether the example you are looking at fits the bill really, so far I only see significant differences with light water , e.g try bowerman, seattle harbour or the Caribbean when the sun is high but not for example the Solent. In those cases the change I suggest seem to narrow the gap to me.

  7. Paul Johnson says:

    I took it from this, right after the 15th pic (above), where you went from .3 to .1, so I did the same.:-

    “Now the DX10 specular term

    Color = float4(lerp(Color.xyz + (g_vSunDirectional * specularFactor.x) + (0.3 * (specularFactor.y + saturate(dot(g_vSunVectorWorld_Moon,vSurfaceNorm)))).xxx, baseColor.xyz, fAlpha.xxxx),fAlpha);

    Has a multiplier of 0.3 which is 0.1 in DX (so lets reduce it! ”

    So I did!, Then went looking for the fresnel Min/Max values – which is perhaps wrong. I assumed they would be in the same water40.fx file, and they were the only candidates..
    Sorry, Steve, my own fault – if it’s not plain simple “C”, Clipper or a Unix shell – I’m out of my depth – merely clutching at straws! Of course it’s my own system and is pretty safe… Actually from an earlier post I was under the impression that you had not been into the Water40Conts.fxh.

    Ok – thanks for this is will go digging in a different direction.

    • stevefsx says:

      I wasn’t meaning to be rude, I just meant I really don’t know what impact changing those values would have. I hadn’t provided any clear instructions on altering the fresnel values, as the changes were very minor visually. The fresnel values affect the water on the horizon by changing the blend between reflections and the base water colour.

      The main change is the 0.3 to 0.1 but as I say it seems to affect light coloured water which is where I perceive differences between dx9 and dx10. Light green seems to go to white/blue which looks wrong to me.

  8. Paul Johnson says:

    I am using Bowerman, as its water looks awful. Thinking back further – I did try the 0.375 and 0.588 in the water40consts header, Steve, but I only edited the three elevations for the “Fall” season, so I the flight may have been Spring or summer, I suppose. I will be more accurate this time….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s