Why is my windscreen broken?
Some mod cars have windscreens that seem to behave strangely: sun glare is present at unexpected times, mysterious shadows are cast across the screen seemingly by nothing. To make matters worse the Custom Shaders Patch‘s (CSP) WindscreenFX features (‘Remove all dirt’ and blur shadows with speed) have no effect on these cars.
For an example of this problem lets take the Touring Car Legends (TCL) Lotus Cortina MkI for an early morning spin at Goodowood:
None of this seems right. Let’s take a Kunos car, the Alfa 33 Stradale, out and see how it compares:
That looks a lot more like what I’d expect to see. So whats the wrong with Cortina then?
The problem appears to be the shader assigned to the inside of the Cortina’s windscreen. While the Alfa has the ksWindscreen shader assigned to the inside of it’s windscreen (which sounds sensible), the Cortina has it set to the more general ksPerPixel shader.
This is what is causing both CSP not to be able to apply the WindscreenFX settings, and the in game lighting to be non-sensical.
Should I call Autoglass?
The obvious method to fix this would be to edit the kn5 to change the shader to ksWindscreen, but that’s not easy, and would break compatiblity for any online races. Fortunately, CSP gives us an alternative, in the form of per car extension configurations, so we can create a configuration file to tell CSP to replace the shader on the windscreen mesh at runtime.
DIY Cortina Windscreen repair
Let’s go through fixing the Cortina’s screen as an example
It might take a few clicks to correctly select the inside of the windscreen, as Content Manager will cycle through the various meshes under the pointer.
We can now see (highlighted in green) the name of the Material associated with inside of the windscreen (in this case INT-Window), as well the fact the Shader for this material is ksPerPixel. Make a note of the material name, as we’ll need that in a minute. This material name will differ from car to car, INT-Window is the correct value for the Cortina. You need to check what the correct material name is for each car you are trying to fix.
Now go to your \Documents\Assetto Corsa\cfg\extension directory, and create a new folder called “cars”, if there’s already a “cars” folder there then that’s fine.
To create our new configuration file to tells CSP to switch the shader to ksWindscreen, open Notepad and enter the following:
[SHADER_REPLACEMENT_100] MATERIALS = INT-Window SHADER = ksWindscreen
Then save it with the exact name of the folder of the car we’re trying to fix, and an .ini extension, into the folder we just created, So, in this example the complete path and filename would be:
C:\Users\<yourusername>\Documents\Assetto Corsa\cfg\extension\cars\tc_legends_cortina.ini
Job done!
And that’s it, the windscreen is now fixed! Glare and shadows should show in the right places, and CSP‘s WindscreenFX features should work to blur shadows with speed and\or hide the dirt texture completely.
Among the TCL cars, at least the Cortina and the 911 suffer from this problem. The Porsche can be fixed in a similar way, as should any other car with the same issue.
If you think the windscreen is too dirty, but don’t want to use WindscreenFX to turn it off completely, then CSP extension configuration files can be used to change the dirt’s opacity or even replace the dirt texture completely. But I’ll cover that another time!
abc says:
Just mind that if you don’t have a diffuse texture containing the transparent image for the mod car’s interior glass no matter how hard you try with CSP code you won’t reach similar good result. So the correct way of dealing with this on mod car that has no internal reflection is to UV map the cube projection of the windshield on a proper custom made .dds with transparency and set the correct parameters in ksEditor.
And the online checksum errors should be relevant only to car’s data and not to the .kn5 model but that’s a matter of the server admin doing a proper job.