Improved shadows mod (tweaked shader)
aruametello
Join Date: 2012-11-08 Member: 168371Members
important edit:
this mod is fully deprecated, since the reinforced update ns2 already uses a improved shadow shader. (with similar results and better performance than this mod)
===============
This thread is more about questions/sugestions to anyone than announcing a actual mod, but the post also include the download to the mod described.
Short version: some slight modifications to the shadow rendering, to use a more pronounced PCF filter and some noise in the penumbra to try to mimick smooter shadows, this mod is nothing related to actual complex optimization and/or extra code, almost everything "added" was already there, but aparently disabled for performance reasons.
WARNING: this mod cost GPU time, it is made with "high end" gpu setups in mind. (like sli/crossfire or high end video cards), in my tests i had about 20% extra GPU load.
Comparasion screenshots
* i didnt figured out how to post the photobucket fullsize screenshots but you probably already noticed some improvement, the extra quality is more noticeable when comparing in full resolution)
a few other random screenshots (without comparasions because you cant ask for random people playing to pose for 2 similar pictures)
Mod download link (single modified file): http://www.4shared.com/rar/Ub2vFeQt/RenderDeferred.html
Instalation instructions:
* make a backup copy of the file (NS2DIR)\core\renderer\RenderDeferred.fx
* overwrite the same file with the one given in the download link above. (inside the rar file)
* you need to have the option "shadows" turned on in the graphics menu. (duh)
Fact: use this at your own risk.
its worth mentioning that since this modification works even inside "non modded" servers and the same file can hold modifications that can exploit the game, you may end up being confused with some low life, hacking things like lighting (make everything bright to see in the dark) or even painting every surface with a single color, what would be similar to what some hacks do.
The questions:
1) the files outside "(NS2DIR)\NS2" arent "officially" modable? (likely considering its mostly engine inner workings sensitive stuff)
(i can be wrong in this one, but in the documentation aparrently mods are only for the "(NS2DIR)\NS2" folder and subfolders)
2) maybe splitting the RenderDeferred.fx file into several others (using #includes) could help modders to modify only smaller portions of the shaders?
(i only modified the "GetShadow" function for example)
3) This file (core\renderer\RenderDeferred.fx) is not checked for consistency? (i think it should)
4) Maybe a "oficial" version for "higher quality" shadows in the graphical settings? (like off, normal, high instead of just off,on)
(with also a bigger shadow depth buffer in the high setting plz)
this mod is fully deprecated, since the reinforced update ns2 already uses a improved shadow shader. (with similar results and better performance than this mod)
===============
This thread is more about questions/sugestions to anyone than announcing a actual mod, but the post also include the download to the mod described.
Short version: some slight modifications to the shadow rendering, to use a more pronounced PCF filter and some noise in the penumbra to try to mimick smooter shadows, this mod is nothing related to actual complex optimization and/or extra code, almost everything "added" was already there, but aparently disabled for performance reasons.
WARNING: this mod cost GPU time, it is made with "high end" gpu setups in mind. (like sli/crossfire or high end video cards), in my tests i had about 20% extra GPU load.
Comparasion screenshots
* i didnt figured out how to post the photobucket fullsize screenshots but you probably already noticed some improvement, the extra quality is more noticeable when comparing in full resolution)
a few other random screenshots (without comparasions because you cant ask for random people playing to pose for 2 similar pictures)
Mod download link (single modified file): http://www.4shared.com/rar/Ub2vFeQt/RenderDeferred.html
Instalation instructions:
* make a backup copy of the file (NS2DIR)\core\renderer\RenderDeferred.fx
* overwrite the same file with the one given in the download link above. (inside the rar file)
* you need to have the option "shadows" turned on in the graphics menu. (duh)
Fact: use this at your own risk.
its worth mentioning that since this modification works even inside "non modded" servers and the same file can hold modifications that can exploit the game, you may end up being confused with some low life, hacking things like lighting (make everything bright to see in the dark) or even painting every surface with a single color, what would be similar to what some hacks do.
The questions:
1) the files outside "(NS2DIR)\NS2" arent "officially" modable? (likely considering its mostly engine inner workings sensitive stuff)
(i can be wrong in this one, but in the documentation aparrently mods are only for the "(NS2DIR)\NS2" folder and subfolders)
2) maybe splitting the RenderDeferred.fx file into several others (using #includes) could help modders to modify only smaller portions of the shaders?
(i only modified the "GetShadow" function for example)
3) This file (core\renderer\RenderDeferred.fx) is not checked for consistency? (i think it should)
4) Maybe a "oficial" version for "higher quality" shadows in the graphical settings? (like off, normal, high instead of just off,on)
(with also a bigger shadow depth buffer in the high setting plz)
Comments
can some dev coment on this ? :-B
Variance shadow maps. According to this paper variance is between 1.5 and 10 times faster than PCF.
Is there much of a frame hit to this like I'd imagine there would be?
You should rework infestation bump mapping too, since this change really impacts those looks.
GREAT work btw!
Any benchmark comparisons?
Edit: Hm when I tried it this evening the shadows look extremely pixelated and blocky. Guess it doesn't work for me.
With the mod:
Normal unmodded shadows:
It is completely ok to mod files in the "core" directory. If fact you should create a workshop mod out of this (directly overwriting the install files is not recommended, since it will prevent you from playing on servers that enforce consistency on shader files and could cause the game to break when we release a patch. Say you have a mod "mymod" installed and the engine tries to load renderer/RenderDeferred.fx. It will look for that file in these locations:
mymod/renderer/RenderDeferred.fx
ns2/renderer/RenderDeferred.fx
core/renderer/RenderDeferred.fx
Which ever one it finds first it will use.
The rendering system is actually very modable. The files renderer/Deferred.render_setup and renderer/Deferred.shader_template contain all kinds of flexibility. For example the bloom, ambient occlusion, refraction, infestation rendering and low quality particle optimization features are all implemented completely in these text files. The engine itself doesn't know anything about those features. Even the core deferred rendering system can be modified. I've done experiments with light pre-pass and other variations on deferred shading just by tweaking these files and seeing the results while the game is running (make sure you have -hotload on the command line).
It'd be great if you could implement your mod into workshop!
i have a better plan based on this: http://http.developer.nvidia.com/GPUGems/gpugems_ch11.html that would use fragment coordinates (where the pixel will be rendered on the screen) to pick what samples to use (the "noise" offset of each sample)
but right now i am busy with work, and dont have much idea how to get the "gl_fragcoord" equivalent in hlsl. (most of my knowledge is in opengl)
I am almost sure of what went wrong on your setup, and its not your fault in any way, basically there are a few separate pieces of code that "samples" the shadows and i basically just played with the code with "try and error" until finding the one my ns2 was using here, maybe the other (very similar) functions are used with different setups (like different brand of video card or video settings, etc).
if i release a new (proper) version of this, it will be a steamworkshop mod (Thanks to max instructions) and most likely will be properly tested. (i can try to test on a few setups first)