This Could Be Very Interesting - AnKor's Shaders

In the thread discussing Gecko's new High Rez mapping file that sets the color of the water for ETO, he revealed that we can use a file named State.txt added to the Effects\Fxtextures folder to trigger the different sea states listed at the top of SeaWater.fx.

http://www.sim-outhouse.com/sohforu...Water-Colors?p=1207368&viewfull=1#post1207368

The valid entries are:
Calm
Light
Medium
Heavy
(having no text in the file uses Default)

With the ability to try these all out now I've been able to put together some updated parameters for the SeaWater.fx entries that provides a progression of different sea states. This is set up to have the Default fall in the sequence between Calm and Light.

#if defined Sea_Calm
#define BaseOpacity 0.95
#define WaveBump 6.0
#define WaveScale 6.0
#define FoamAmount 0.33
#define AddFoam
#elif defined Sea_Light
#define BaseOpacity 0.97
#define WaveBump 4.0
#define WaveScale 4.0
#define FoamAmount 0.31
#define AddFoam
#elif defined Sea_Medium
#define BaseOpacity 0.99
#define WaveBump 3.0
#define WaveScale 3.0
#define FoamAmount 0.30
#define AddFoam
#elif defined Sea_Heavy
#define BaseOpacity 1.0 // assumed 1 if not defined
#define WaveBump 2.0
#define WaveScale 2.0
#define FoamAmount 0.29
#define AddFoam
#else // default (i.e. stock CFS3)
#define BaseOpacity 0.99
#define WaveBump 5.0
#define WaveScale 5.0
#define FoamAmount 0.32
#define AddFoam
#endif

Calm
4Gv7c2A.jpg


Default
xvdolwj.jpg


Light
jXeM3O6.jpg


Medium
4M2Mivw.jpg


Heavy
TlJELFh.jpg
 
There's one thing I've been thinking about a lot and only now did it occur to me that why not ask the master himself. At least I think I haven't asked this before.

So AnKor, can you shed some light here? When the shaders aren't enabled the autogen trees controlled by the scenerysheet01 texture have full 256-level transparency, as defined by the alpha sheet in the texture. However, when the shaders kick in, it seems to be reduced to either full opacity or full transparency, especially noticable in the winter trees. I'm sure there's a reason to this, or am I just simply doing something wrong with some setting?
 
greycap.paf,
yes, my shaders don't support partial transparency in autogen objects, pixels are either opaque or fully transparent.

There is a "hidden" option which can be added in d3d8.ini:
AlphaToCoverage=1
This is an experimental feature which may or may not work on different configs. If you enable it and also have multisampling enabled, you may get some levels of partial transparency for autogen trees. How many levels you get depends on your multisampling settings, but it will be less than 256 anyway.

Also, depending on your tastes, you may try changing
#define AlphaDither 1
to
#define AlphaDither 0
in Scenery.fx to remove artificial dithering from trees.


Now, why it works like this.

One of the first things I noticed in CFS3/WOFF when starting missions on an airfield is that sky was often unnaturally visible through tree outlines.
This happens, because for alpha blending (partial transparency) to work properly objects must be rendered in specific order - from furthest to nearest ("back to front").
CFS3 correctly sorts semi-transparent objects coming from m3d models and does this for each frame, but autogen objects are generated once, stored in buffers and their rendering order is never updated. This is understandable, because sorting them would kill the performance.

It is a bit too technical, but in simpler words: even barely visible semi-transparent parts of a tree "occlude" more distant trees if rendered in a wrong order. So instead of a forest you only see some trees closer to you and a clear sky/terrain behind them.

There's NO painless solution for this.

You either have to
- Sort everything which is very slow.
- Use Alpha To Coverage which is a weak substitute, and not a standard feature for DX9.
- Use dithering, which can be ugly but still acceptable in some cases.
- Or just avoid partial transparency.

Maybe I should have kept the original behavior as an option, but it is too late to change now.
 
Good and understandable reasons, thanks! :encouragement:


However I've developed a new problem, and a pretty interesting one at that. After some hardware (and software) revisions I now have a W10 machine - and CFS3 runs, no problems with that. How it runs though is a complete mystery to me. More specifically, anti-aliasing doesn't work when the shaders are applied. The latest Nvidia drivers are in use.

The story began when I got everything in working order, fired up CFS3 for the first time, and immediately noticed all the jagged edges. I then combed through all the Nvidia 3D settings, double checked them to be the same (or higher) as they used to be, and no luck. The only setting that makes a difference is the FXAA which looks so bad that no thanks. Originally I thought that the fake driver version might be the culprit so I tried with the real version number, no change.

Then, for some reason or another, I tried the vanilla install used as a base for add-ons. Of course it looked horrible - but it had perfectly working AA, of all things. The next steps were MAW and ETO, both with the shaders, and neither worked. I even tried 16-bit colours to see if it was the key but no, the jaggies didn't go anywhere. Seeing a bit of a pattern here I removed the shaders from my main install, ran CFS3config, and started it up, and... no shaders as expected, but no jagged edges either. Putting the shaders back in made them return so the shaders play some role in this. I just have no idea which that role is!
 
Now that... that was some of the weirdest stuff I've seen and I've seen quite a lot. Diablo III settings to get CFS3 to run. :dejection: But it works!
 
I recently started thinking that the prop disk on most aircraft appear much darker that what I remember seeing in films and in-person at airshows. Also the glint from the light striking the blades at varying angles as the aircraft maneuvered was missing. I tried modifying the alpha layer of the prop_german.dds and prop_us_brit.dds files, but that just made the blades stand out more as the disk disappeared, and did nothing for the glint. (I did end up increasing their resolution to 1024 to smooth out some of the banding, and aliased edges) I then tried editing the m3d to enable the same sort of transparency and dynamic lighting effects that AnKor's Shader provide for the canopy glass. This had no effect initially, until I remembered that the [PropDisk] function in TextureMagic.ini is there to specifically prevent the shader effects like shadows and reflections from being applied to the prop. Quickly removing these dds references from that section, and I was in business. Once I found the entries for the prop in the m3d I turned on the 3d reflectivity, and reduced the opacity to 55 (00 00 FF 00 FF FF FF 55). No other edits appear to be required. I didn't suffer any negative impact on FPS, and the effect looks close to what I was after.

Original Prop Disk Opacity, Reduced Opacity, Reduced Opacity With Glint
llBiDCw.jpg


The glint comes and goes pretty quickly as the angles change, so you don't see it most of the time.

p.s. I live under the glide slope of a small airport, and was watching the planes pass over today. The prop disk is surprisingly hard to see at 1,500 ft unless it happens to catch the glint of the sun.
 
Last edited:
So for some clarification:

1. In the end you only changed the resolution of prop_german.dds and prop_us_brit.dds but nothing else?

2. Which were the exact dds references in the ini file did you remove?

3. Which m3d's do you mean; those for each aircraft? Is this; " I turned on the 3d reflectivity, and reduced the opacity to 55 (00 00 FF 00 FF FF FF 55)"; a straight forward thing to do for amateur m3d editors?
 
1. In the end you only changed the resolution of prop_german.dds and prop_us_brit.dds but nothing else?

I did not change the alpha layer opacity (black conceals / white reveals), but I did run a 3 pixel gaussian blur filter after the enlargement to smooth the edges of the grey scale transitions because of the noticeable mach banding.


2. Which were the exact dds references in the ini file did you remove?

Since I was experimenting, and either prop_german.dds or prop_us_brit.dds covers most of the aircraft, I just temporarily renamed both of them in the [PropDisk] section by putting an X at the beginning. I also discovered the hard way that prop_german.dds had accidently been listed there twice.


3. Which m3d's do you mean; those for each aircraft? Is this; " I turned on the 3d reflectivity, and reduced the opacity to 55 (00 00 FF 00 FF FF FF 55)"; a straight forward thing to do for amateur m3d editors?

Yes, like reflective canopy glass, it would have to be done for each installed aircraft that you want this effect for. The method for doing this is described in the Knowledge Base here http://www.sim-outhouse.com/sohforu...knowledge-base?p=920762&viewfull=1#post920762 This is actually easier than doing the glass, because you know exactly which line is referencing the prop dds, whereas the glass can take some trial and error to find the right line to edit. By removing the exclusion from the [PropDisk] section it automatically allows all aircraft using that dds file to cast shadows on the prop disk. To also get the reduced opacity and glint requires the m3d edit.

I use XVI32 for my hex editor. http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm
 
Hi all. I know I'm somewhat late to the party, but finances have get me away from simming for far too long. I now have a pretty decent PC into which I have (just this week) installed a GT 1030 graphics card. I have the latest drivers installed, I have the current DirectX installed and .... nada. When I run a vanilla copy of CFS 3.1a there are no issues, the instant I drop the Shaders files in I get the initial Splash Screen and then a black screen and CRASH. This is what the d3d8 log shows.

0.00: Start - DLL Version Nov 23 2019
0.39: D3DWrapper::GetAdapterDisplayMode - 1920, 1080, 59, 22
0.52: D3DWrapper::GetAdapterDisplayMode - 1920, 1080, 59, 22
0.52: D3DWrapper::CreateDevice - NVIDIA GeForce GT 1030 (Driver Version: 31.0.15.2698)
0.52: D3DWrapper::CreateDevice - Hardware Vertex Processing
0.52: D3DWrapper::CreateDevice - Adapter: 0, Type: 1, Flags: 0x43
0.52: D3DWrapper::CreateDevice - Windowed: 0, Width: -65276, Height: 1199562752, Refresh: 0, Format: 8497732, Multisampling: 0
0.52: D3DWrapper::CreateDevice - AutoDepthStencil: 1 Format: 75
0.52: D3DWrapper::CreateDevice - SwapEffect: 1, PresentationInterval: 0, BackBufferCount: 1
0.52: D3DWrapper::CreateDevice - D3D9Ex is disabled.
0.52: D3DWrapper::CreateDevice - CreateDevice call - FAILED. HR = 0x8876086C
0.58: DllMain - Exit.

Now I'm guessing that "D3D9Ex is disabled", I just don't know how to fix it. Using the belt & braces approach I redownloaded and reinstalled the latest DirectX package, the result is exactly the same. Any help or pointers would be greatly appreciated.

Thanks

Andy
 
Thank you for your reply but sadly it is still crashing.

0.00: Start - DLL Version Nov 23 2019
0.40: D3DWrapper::GetAdapterDisplayMode - 1920, 1080, 59, 22
0.40: D3DWrapper::GetAdapterDisplayMode - 1920, 1080, 59, 22
0.41: D3DWrapper::CreateDevice - NVIDIA GeForce GT 1030 (Driver Version: 31.0.15.2698)
0.41: D3DWrapper::CreateDevice - Hardware Vertex Processing
0.41: D3DWrapper::CreateDevice - Adapter: 0, Type: 1, Flags: 0x43
0.41: D3DWrapper::CreateDevice - Windowed: 0, Width: -65276, Height: 1199562752, Refresh: 0, Format: 8497732, Multisampling: 0
0.41: D3DWrapper::CreateDevice - AutoDepthStencil: 1 Format: 75
0.41: D3DWrapper::CreateDevice - SwapEffect: 1, PresentationInterval: 0, BackBufferCount: 1
0.41: D3DWrapper::CreateDevice - D3D9Ex is enabled.
0.41: D3DWrapper::CreateDevice - CreateDeviceEx - FAILED. HR = 0x8876086C
0.51: create_minidump - Unhandled Exception 0xC0000005 at EIP=0x656B82B1 (dll base is 0x65690000)
2.51: DllMain - Exit.

Any more thoughts?
 
Make sure you have DX9c installed. If you have trouble getting it i have it saved. You have to have this for the shaders to work. Hope this helps. Regards,Scott
 
Gentlemen, I thank you. Not sure which of your suggestions was the solution or whether it was a combination of both but ...... wow!!
 
Display split by variable width band of landscape at horizon

Using JSGME I applied the AnKor's Shader's mod. It seemed to work in that my P47 is shiner and the tail casts a shadow as I fly. However, there is a several inch band at the horizon that erases my fuselage in both inside and outsize views. When very low the band is a only a few pixels thick, but it grows with altitude. I don't think it is the band described in the documentation regarding the blend of sky and Earth, because it seems to several inches of distant landscape.

Either a cause of this problem, or a side effect of some other, I am not able to save the Dual Pass, High Res Z, and Disable Shadow settings in ConfigOveridesdw.xml (nor turn off the movie). I change the xml file, run config.exe, and recheck that the xml settings are there, but after running cfs3.exe I recheck the xml settings and they have been reset to the default.

I think this might be because when I open cfs3 I get the message that it did not shut down properly. (I don't know why this is the case as I quit using the menu.) I am assuming there is some issue and as a result the config file is reset. By the way, this happened before I applied the mod as well

Another clue may be that even though I (think I) installed DX9c, the dxdiag.txt suggests that I am running DX12,

So, my issue could be config settings, DX issues, or something completely different. How do you make user you are using DX9c? How do you assure a graceful exit? How do you assume the settings are set? Ultimately, how I get rid of that band? Can anyone give me some advice? Thanks!
 
Make sure you have Dual Pass Render disabled.

I think that is a main part of the problem. I turn off Dual Pass Render and turn on High Resolution Z Buffer and Disable Shadows. I run config.exe using Exit to close the window. When I start cfs3 I get a message that it did not shut down properly and it seems that my configs are reset to the default. I can't seem to set any config settings, not even turning off the movie. How do I debug what is causing cfs3 to shut down improperly? I don't get any error messages at all. Alternatively, how can I get my settings to stick?
 
When using the cfs3config.exe, you must close it using 'file' 'exit' and
not closing it with the right side 'X' or it will not save.
I've never edited the ConfigOveridesdw.xml, I just run the config app
to make all the settings.
 
When using the cfs3config.exe, you must close it using 'file' 'exit' and
not closing it with the right side 'X' or it will not save.
I've never edited the ConfigOveridesdw.xml, I just run the config app
to make all the settings.
Oh good grief! I was doing it wrong. I thought that you had to change the xml file then run config.exe to apply the settings... because of your comment I see that you can change all the setting via config.exe. The problem went away. Thank you so much!
 
Back
Top