Alien Vision Mod
twiliteblue
bug stalker Join Date: 2003-02-04 Member: 13116Members, NS2 Playtester, Squad Five Blue
This is a client side mod which changes the visuals of alien vision (Dark Vision).
Download link (works for b254): [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_b253/DarkVision.hlsl[/url] Right click and "save".
Mod previews available here: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=174440948[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_b253/2013-09-02_00001.jpg[/img][/spoiler]
Green version: [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_green/DarkVision.hlsl[/url]
preview: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=175139523[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_green/2013-09-03_00002.jpg[/img][/spoiler]
Blue version: [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_blue/DarkVision.hlsl[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_blue/2013-09-02_00005.jpg[/img][/spoiler]
[b]Note: The mod in Steam Workshop does not work on all servers, but installing the mod with the following instructions will.[/b]
NEW non-Workshop Installation
===================================
1. Download the file DarkVision.hlsl.
2. Create a new mod folder in your Natural Selection 2 folder (it should be your "<Steam directory>\steamapps\common\natural selection 2" folder). Rename the new folder to something more meaningful, such as "avMod".
3. Create a new "shaders" folder inside your mod folder. Copy/move DarkVision.hlsl into this folder.
4. Create a shortcut to your NS2.exe, which you will be using to launch this mod.
5. Edit the "properties" of the shortcut, add the following after the quotation marks at end the target field: -game <mod name> (eg. -game avMod).
6. Launch the mod from the new shortcut.
Download link (works for b254): [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_b253/DarkVision.hlsl[/url] Right click and "save".
Mod previews available here: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=174440948[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_b253/2013-09-02_00001.jpg[/img][/spoiler]
Green version: [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_green/DarkVision.hlsl[/url]
preview: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=175139523[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_green/2013-09-03_00002.jpg[/img][/spoiler]
Blue version: [url]https://dl.dropboxusercontent.com/u/60032446/AV_mod_blue/DarkVision.hlsl[/url]
[spoiler][img]https://dl.dropboxusercontent.com/u/60032446/AV_mod_blue/2013-09-02_00005.jpg[/img][/spoiler]
[b]Note: The mod in Steam Workshop does not work on all servers, but installing the mod with the following instructions will.[/b]
NEW non-Workshop Installation
===================================
1. Download the file DarkVision.hlsl.
2. Create a new mod folder in your Natural Selection 2 folder (it should be your "<Steam directory>\steamapps\common\natural selection 2" folder). Rename the new folder to something more meaningful, such as "avMod".
3. Create a new "shaders" folder inside your mod folder. Copy/move DarkVision.hlsl into this folder.
4. Create a shortcut to your NS2.exe, which you will be using to launch this mod.
5. Edit the "properties" of the shortcut, add the following after the quotation marks at end the target field: -game <mod name> (eg. -game avMod).
6. Launch the mod from the new shortcut.
Comments
Outlines surrounding entities and geometry edges are more blurred the closer they are to the screen's edges.
I like the fact you can see infestation too.
<a href="http://www.2shared.com/file/nP7mCx12/AlienVision.html" target="_blank">Download Link</a>
<img src="http://i.imgur.com/1JV1k.jpg" border="0" class="linked-image" />
<img src="http://i.imgur.com/gJIxw.jpg" border="0" class="linked-image" />
I'm still using a blue version with low saturation, it could be a good idea to show off what's capable and have several versions for preview and download.
<a href="http://dl.dropbox.com/u/60032446/zoomblur4/DarkVision.fx" target="_blank">http://dl.dropbox.com/u/60032446/zoomblur4/DarkVision.fx</a>
<img src="http://dl.dropbox.com/u/60032446/zoomblur4/NS2%202012-05-28%2012-02-03-82.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/zoomblur4/NS2%202012-05-28%2012-11-09-42.jpg" border="0" class="linked-image" />
<a href="http://dl.dropbox.com/u/60032446/zoomblur5/DarkVision.fx" target="_blank">http://dl.dropbox.com/u/60032446/zoomblur5/DarkVision.fx</a>
<img src="http://dl.dropbox.com/u/60032446/zoomblur5/NS2%202012-05-28%2012-48-53-28.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/zoomblur5/NS2%202012-05-28%2012-49-43-18.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/zoomblur5/NS2%202012-05-28%2012-49-55-39.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/zoomblur5/NS2%202012-05-28%2014-32-08-38.jpg" border="0" class="linked-image" />
<a href="http://www.2shared.com/file/nP7mCx12/AlienVision.html" target="_blank">Download Link</a><!--QuoteEnd--></div><!--QuoteEEnd-->
Gotta say, this is beautiful! good work to both of you
Ah I can't take any credit, all the code is twiliteblue's (of course based off Sewlek's original work). He's put a lot of hours into this! What I posted is just my favourite iteration, though I haven't tried out either of the new ones posted since and am looking forward to doing so.
Have you tried it in game? The one I posted actually changes the way it looks depending on lighting quite a bit (in response to the colours, not eyestrain).
did you try to do something else than cell shading? i think cell shading is limiting a bit and it seems that all versions are basically the same but with adjusted colors (i know they are all different and I have read the code)
Here is an example:
<img src="http://i.imgur.com/WVwJm.jpg" border="0" class="linked-image" />
Download link: <a href="http://www.2shared.com/file/KT_U2VD9/AlienVision.html" target="_blank">http://www.2shared.com/file/KT_U2VD9/AlienVision.html</a>
I like that one! Awesome :)
<a href="http://dl.dropbox.com/u/60032446/neo/DarkVision.fx" target="_blank">http://dl.dropbox.com/u/60032446/neo/DarkVision.fx</a>
<img src="http://dl.dropbox.com/u/60032446/neo/NS2%202012-05-29%2014-25-44-37.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/neo/NS2%202012-05-29%2014-26-40-30.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/neo/NS2%202012-05-29%2014-28-30-90.jpg" border="0" class="linked-image" />
<center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/_S3BiAKGSYg"></param><embed src="http://www.youtube.com/v/_S3BiAKGSYg" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->struct VS_INPUT
{
float3 ssPosition : POSITION;
float2 texCoord : TEXCOORD0;
float4 color : COLOR0;
};
struct VS_OUTPUT
{
float4 ssPosition : POSITION;
float2 texCoord : TEXCOORD0;
float4 color : COLOR0;
};
struct PS_INPUT
{
float2 texCoord : TEXCOORD0;
float4 color : COLOR0;
};
texture baseTexture;
texture depthTexture;
float time;
float startTime;
float amount;
sampler baseTextureSampler = sampler_state
{
texture = (baseTexture);
AddressU = Wrap;
AddressV = Wrap;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
SRGBTexture = False;
};
sampler depthTextureSampler = sampler_state
{
texture = (depthTexture);
AddressU = Clamp;
AddressV = Clamp;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = None;
SRGBTexture = False;
};
/*float random( vec2 p )
{
// We need irrationals for pseudo randomness.
// Most (all?) known transcendental numbers will (generally) work.
const vec2 r = vec2(
23.1406926327792690, // e^pi (Gelfond's constant)
2.6651441426902251); // 2^sqrt(2) (Gelfond–Schneider constant)
return fract( cos( mod( 123456789., 1e-7 + 256. * dot(p,r) ) ) );
}*/
/**
* Vertex shader.
*/
VS_OUTPUT SFXBasicVS(VS_INPUT input)
{
VS_OUTPUT output;
output.ssPosition = float4(input.ssPosition, 1);
output.texCoord = input.texCoord;
output.color = input.color;
return output;
}
float4 SFXDarkVisionPS(PS_INPUT input) : COLOR0
{
// This is an exponent which is used to make the pulse front move faster when it gets
// farther away from the viewer so that the effect doesn't take too long to complete.
const float frontMovementPower = 3.0;
const float frontSpeed = 10.0;
const float pulseWidth = 20.0;
float2 texCoord = input.texCoord;
float2 depth1 = tex2D(depthTextureSampler, input.texCoord).rg;
float4 inputPixel = tex2D(baseTextureSampler, input.texCoord);
const float macro_offset = 0.95;
const float offset = 0.0025;
float depth2 = tex2D(depthTextureSampler, input.texCoord * float2( macro_offset, macro_offset) - float2( -((1-macro_offset)/2), -((1-macro_offset)/2))).r;
float depth3 = depth2 - tex2D(depthTextureSampler, input.texCoord * float2( 0.9, 0.9) - float2( -((1-0.9)/2), -((1-0.9)/2))).r;
float depth4 = depth3 - tex2D(depthTextureSampler, input.texCoord * float2( 0.8, 0.8) - float2( -((1-0.8)/2), -((1-0.8)/2))).r;
float depth5 = depth4 - tex2D(depthTextureSampler, input.texCoord * float2( 0.7, 0.7) - float2( -((1-0.7)/2), -((1-0.7)/2))).r;
float4 edgeColor;
if (depth1.g != 1)
{
// Normal Surfaces
edgeColor = float4(0.18, 0.2, 0.1, 0) * 0.00125;
}
else
{
// Highlights
edgeColor = float4(1, 0.08, 0, 0) * inputPixel.r;
}
float edge = abs(depth2 - depth1.r) /
abs(depth3 - depth1.r) *
abs(depth4 - depth1.r) +
abs(depth5 - depth1.r);
// Compute a pulse "front" that sweeps out from the viewer when the effect is activated.
float x = (input.texCoord.x - 0.5) * 2;
float wave = cos(10 * x) + sin(15 * x);
float front = pow( (time - startTime) * frontSpeed, frontMovementPower) + wave;
float pulse = saturate((front - depth1.r) / pulseWidth);
if (pulse > 0)
{
float4 fog = float4(0.05, 0.08, 0.05, 0);
float fogDensity = 0.0005;
float fogAmount = 1- saturate(exp(-depth1.r * fogDensity));
return lerp( inputPixel, edgeColor * (edge / pulse + depth1.r) + fog * fogAmount, amount ) * edge / 6;
}
else
{
return inputPixel;
}
}
technique SFXDarkVision
{
pass p0
{
ZEnable = False;
ZWriteEnable = False;
VertexShader = compile vs_2_0 SFXBasicVS();
PixelShader = compile ps_2_0 SFXDarkVisionPS();
CullMode = None;
}
}<!--c2--></div><!--ec2-->
We'd like to include your version in the next version of NS2. One thing though: could you have the orange ents fade to blackness sooner? Ie, when the level goes to black, can you have the live entities be black also? This way it wouldn't be so easy to pick out a marine at a distance (which we believe is necessary to ensure the vision mode is a trade-off and isn't always on).
On a side note, I think it's so awesome that so many of you can and do create your own shaders. It's exciting to think about what the collective NS2 mod scene will do.
a bit off topic I guess, sorry twilightblue..
What I mean is that up to now, every single version still looks like some sort of tweaked thermal vision...
<img src="http://fallout3.nexusmods.com/mods/images/14371-1-1283172573.jpg" border="0" class="linked-image" />
If you can see what I mean.
But then half the reason to make a game moddable goes out the window. (Half in my mind being customization and the other half large scale mods like Insight)
almost sure it will be a server flag to turn the consistency on/off, so there will be pure ns2 servers with consistency on and moddable servers
Charlie, I hope you like my new "deep sea" alien vision. :)
Download: <a href="http://dl.dropbox.com/u/60032446/deepsea/DarkVision.fx" target="_blank">http://dl.dropbox.com/u/60032446/deepsea/DarkVision.fx</a>
<img src="http://dl.dropbox.com/u/60032446/deepsea/NS2%202012-05-30%2012-55-12-02.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/deepsea/NS2%202012-05-30%2013-12-00-61.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/deepsea/NS2%202012-05-30%2013-12-04-12.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/deepsea/NS2%202012-05-30%2013-12-40-02.jpg" border="0" class="linked-image" />
<img src="http://dl.dropbox.com/u/60032446/deepsea/NS2%202012-05-30%2013-17-15-63.jpg" border="0" class="linked-image" />
I have made Marines less conspicuous at long range in this version, but not completely camouflaged.
Having tried playing with a version of alien vision that made live entities fade out completely at long (20-40) range, I found that it wasn't very pleasant. Since Marines can already snipe aliens from long range with little fear of retaliation, and blend into the blue-gray environments quite well, I do think aliens need a little help spotting marines at long range.
Charlie, I hope you like my new "deep sea" alien vision. :)<!--QuoteEnd--></div><!--QuoteEEnd-->
Nice, again!
It would be cool if this got implemented with color sliders for background and "body"(marines, structures, etc) colors. Then people could customize them in game with ease!
<img src="http://media.desura.com/images/members/1/288/287053/black-1.2.jpg" border="0" class="linked-image" />
(sorry...but your last version really looks like that on my screen)
I have made Marines less conspicuous at long range in this version, but not completely camouflaged.
Having tried playing with a version of alien vision that made live entities fade out completely at long (20-40) range, I found that it wasn't very pleasant. Since Marines can already snipe aliens from long range with little fear of retaliation, and blend into the blue-gray environments quite well, I do think aliens need a little help spotting marines at long range.<!--QuoteEnd--></div><!--QuoteEEnd-->
Personally, I liked the colour in this one the best.
<img src="http://dl.dropbox.com/u/60032446/NS2%202012-05-26%2014-03-29-21.jpg" border="0" class="linked-image" />
The blurry effects make it feel really alien and organic I think. Is it possible to instead of fading to black, make them blur based on distance? That way you could still see that there's marines there, but it'll be an "orange blob" and make it hard to make out an entity from another if they are far away? That way it could rightly make them stand out clearly from the background in close quarters to make it easier to track marines, while still being able to spot them at a distance but not being able to scout with it that well. You could even have the colours of an entity approach the same one at a distance to make players and structures blend together, but have different ones when they are closer to make them stand out, such as red for structures and yellow for marines, both blurring to orange at a distance. For Kharaa the colour scheme could be blue for structures and green for lifeforms when close :)
It would be nice if you could pick up the state of lighting and infestation in the room with alien vision on. It's something I miss in the live version (another reason I use the mod too). I think having the vision giving a clear advantage in darkness and close quarters while being less useful at a range is a better design then having it remove vital information.