- Got to here: https://github.com/JonMicheelsen/jm_x4_shaders
- Download by clicking the green "Code" button and select the "Download Zip" button.
- Go to your root X4 Foundation install folder. In Steam you can right click the game icon and under "Manage" you can select "Browse local files" to find the root install folder, and in that you find "extensions".
- Open the ZIP file. In it you find the autogenerated "jm_x4_shaders" folder, drag that folder into the "extensions" folder.
- If github has a branch named attached to it like "jm_x4_shaders-main", remove that from the folder name, or the shader files wont compile!
- Once in game in the main menu go to Extension and make sure "Shader Improvements" is on, and then you are good to go!
Features for now:
- Screen space shadows, short range near, where the vanilla shadows have gaps some times and far range at the distance where the vanilla shadows fade away.
- Massive work on multiple fronts to reduce specular aliasing!
- Various refinement of how SSAO is applied, as well as how SSAO is calculated.
- New retroreflective diffuse model - for ambient and most analytical light types.
- Flexible subsurface model with epidermal/subdermal specular and scattering approximation. Still very WIP.
- Fake soft shadow approximation on all light types - relies on SSAO to be on!
- Global glow remap and boost, to make even the smallest lights bloom a tiny bit, without completely exploding the large ones
- SSAO polish.
- Glow tweaking.
- Fixed reflection probes that was accidentally broken in a previous version.
- Performance improvements of screen space shadows and further tweaking of both near and far parameters giving better coverage in both cases.
- None, but here's my subsurface R&D, that is now in, albeit without profile switching yet. https://www.shadertoy.com/view/DtcXRM
Near future WIP:
- Improve Geometric Area lights, that are currently the culprit behind most lighting wonk.
- Look into refining species specific subsurface profiles.
- Look into baking and adding some generic subsurface depth textures.
- Eye shaders
- Hair shaders
- HBAO+ style ssao, would probably look nicer and would improve shadow aproximations.
- Some form of simple dynamic SSGI, would add a lot to visuals on stations/ships with potentially little impact in space combat where you really want the fps
- Per triangle culling of things you can never see might improve performance greatly, a ton of base pass is wasted on this every frame, investigate if there's a relevant method that is viable with what's available
- Planet shaders, visuals could be raised quite a bit here I think
- Backdrop shaders, visuals could be raised quite a lot here I think
Original first post:
I've been exploring the shader pipeline a bit.
I've add a fix for what I believe to be a bug in the specular math and I've added some gentle tweaks to the PBR in general, as well as implemented a new feature; screen space far shadows. I plan to make this into a mod eventually. In that context I have some questions.
But let's start with some examples!
Screen Space Shadows is a cheap dynamic shadow solution, that in a game like this works great at distance, but wouldn't work great up close for anything else. It works particular well as an extension to the PCF Cascade shadows already in the game, that are great up close but unfeasible at long distances and thus fade away, causing shadow popping when ever you fly towards something. It also doesn't have a draw call overhead like the cascade technique does, making it quite cheap regardless of number of shadow casters on screen. In game it looks like this. Note the low FPS is from the capture software I used!
https://cdn.discordapp.com/attachments/ ... adows2.mp4
Debug mode: Red and green are pixels on screen evaluated, green is the actual shadow cast. Blue is the games default PCF Cascade Shadows. The two fade seamlessly into each other, greatly reducing shadow popping.
https://cdn.discordapp.com/attachments/ ... G_MODE.mp4
To show the other changes, I've implemented a split screen compare mode. The left half of the following screenshots is Vanilla, the right half is the gently tweaked code.
There is what I believe to be a bug in the geometric attenuation shader code for the geometric analytical lights, where when normal mapped surfaces in the case where the pixel normal shows the backside relative to the camera view direction, a bright pixel wide grazing artefacts occurs, particular noticeable in dark areas, which leads to a very noisy image, when there is repeating or high frequency normal mapped surfaces:
https://cdn.discordapp.com/attachments/ ... /image.png
https://cdn.discordapp.com/attachments/ ... /image.png
https://cdn.discordapp.com/attachments/ ... /image.png
In addition I've added a roughness remap function, an old Pixar trick, that gently raises the smoothest surfaces towards less mirror like while simultaneously gently enhances range utilization of the high end of the roughness(or low end of smoothness). This reduces the wet feeling some scenes in the game has, while also making dull surfaces a little more interesting. Note the above grazing angle fix is also on here.
https://cdn.discordapp.com/attachments/ ... /image.png
https://cdn.discordapp.com/attachments/ ... /image.png
https://cdn.discordapp.com/attachments/ ... /image.png
As you can see, these are extremely subtle changes, since I don't intend to drastically change art direction and artists works - or mess with custom textures from mods - but rather enhance the image rendered.
So to questions!
All these new features are currently controlled with a set of #define's in common.h. Is it possible to expose these, one way or another, through some custom interface and make some of them runtime modifiable in game?
Is it possible to make the game hot reload shaders?
Is it possible to get shader compiler error and warning logging on shaders somehow? [The challenge is already fun, but it doesn't have to be that hardcore ]
If I wanted to go a little wilder, is it possible to assign some global textures, not specific to material definitions? [Some very complex lighting models can be baked to lookup tables]
If I want to go really wild, is it possible to add new render passes to the pipeline, with control of what buffers goes in and out? [If I wanted to take a shot at for example http://www.iryoku.com/separable-sss/]
What is the best way to make this a stand alone mod? [Currently I work off the shader folder being extracted to the root X4 folder]
Next things I'm probably gonna look at is improving the diffuse lighting models to get the non metals to stand out a bit more, and after that I may take a shot at improving character skin rendering.