Natural Selection Wiki
Advertisement

Introduction

Alien Vision highlights Players and Structures, giving Aliens a huge advantage when fighting a Marine. It can be modified via Mods.

Using colors that are the most comfortable to you, your UI or Crosshairs color can help you to improve your game experience. A darker Alien Vision can help you to focus less on the map and more on your targets.

Sources

Alternative Alien Vision styles can be found in: Steam Workshop Mods (have usually better performance)
Steps to activate an Alien Vision Mod can be found in Mods

Mephilles' custom Alienvision basic setup guide.

Text Guide

Placeholder till I make a video about how to make a proper AlienVision mod that gives both a unique colour to every entity and a background fog

For a non-video example of an Alien Vision mod made by Wraith click "EXPAND" ->

A small text guide for making your own Alien Vision mod, you simply copy the text and paste it into something like Notepad++ or even normal Notepad that comes with Windows and then change the values and publish it as a mod (most of the code doesnt need to be changed, only a few numbers to make the mod look the way you want it to)

Values to change:

[The following will represent the colours of entities in the game, the variables are followed by a green comment on the right representing which entity's colour they affect]

edgeColorBlue - Marine Colour

edgeColorDarkBlue - Marine Structures Colour

edgeColorOrange - Alien Colour

edgeColorDarkRed - Alien Structure Colours

edgeColorGreen - George Colour

Here you simply use the 3 first numbers in the parentheses ( ), from left to right they are Red, Green and Blue, and then an extra number that you dont need to change and will stay as 0 These values represent how much of each colour you want to use and go from 0 to 1, representing the % of the colour's saturation, where 0 would be 0% and 1 would be 100%, for example: 0, 1, 1 would be 0% red 100% green and 100% blue which would make a Green/Blue-ish colour

After choosing the colours of your entities, all thats left is to choose the colour of the Background (also known as fog), these variables are in the middle of the code and im not 100% sure as to what each value affects, so feel free to fiddle with them as much as you want (this is easier when you hotload the mod into your client to see the colour changes live, you can see how to do this in Mephilles' video) This variable is called "edgeColor = float4", it shows up in 10 places (excluding the commented ones) and each affect the colour of the Background "fog" separately

#include <renderer/RenderSetup.hlsl>

struct VS_INPUT
{
   float3 ssPosition   : POSITION;
   float2 texCoord     : TEXCOORD0;
   float4 color        : COLOR0;
};

struct VS_OUTPUT
{
   float2 texCoord     : TEXCOORD0;
   float4 color        : COLOR0;
   float4 ssPosition   : SV_POSITION;
};

struct PS_INPUT
{
   float2 texCoord     : TEXCOORD0;
   float4 color        : COLOR0;
};

sampler2D       baseTexture;
sampler2D       depthTexture;
sampler2D       normalTexture;

cbuffer LayerConstants
{
    float        startTime;
    float        amount;
};

/**
* Vertex shader.
*/  
VS_OUTPUT SFXBasicVS(VS_INPUT input)
{

   VS_OUTPUT output;

   output.ssPosition = float4(input.ssPosition, 1);
   output.texCoord   = input.texCoord + texelCenter;
   output.color      = input.color;

   return output;

}

float2 clamp_tex2D( sampler2D tex, float2 coord )
{
    // TODO: remove this and fix sampler using wrapped instead of clamped addressing for depthTexture
    return tex2D( tex, clamp( coord, float2( 0.001, 0.001 ), float2( 0.999, 0.999 ) ) );
}

const float4 edgeColorBlue = float4(1, 0.45, 0, 0); // Marines
const float4 edgeColorDarkBlue = float4(0.65, 0.0, 0, 0); // Marine Structures
const float4 edgeColorOrange = float4(0.1, 0, 0.5, 0); // Aliens
const float4 edgeColorDarkOrange = float4(0.2, 0, 0.3, 0);
const float4 edgeColorDarkRed = float4(0, 0.7, 0.05, 0); // Alien Structures, etc
const float4 edgeColorGreen = float4(0.8, 0.1, 0.5, 0); // Georges
const float4 edgeColorDarkGreen = float4(0.07, 240, 0.00, 0);
const float4 edgeColorDark = float4 (0, 240, 0, 0);
	

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     = 1.6;
    const float frontSpeed            = 18.0;
    const float pulseWidth            = 20.0;

    float2 texCoord = input.texCoord;

    float2 depth1    = tex2D(depthTexture, input.texCoord).rg;
    float4 inputPixel = tex2D(baseTexture, input.texCoord);
    
    if (amount == 0) {
        return inputPixel;
    }

    float x     = (input.texCoord.x - 0.5) * 0;
    float y     = (input.texCoord.y - 0.5) * 0;	
	float distanceSq	= x * x + y * y;
	
    // exp
	float fadeout = pow(2.71828182846, -depth1.r * 0.23 + 0.23);
	
    const float offset = 0.0005 + distanceSq * 0.005 * (1 + depth1.g);
	float  depth2 = tex2D(depthTexture, input.texCoord + float2( offset, 0)).rg;
	float  depth3 = tex2D(depthTexture, input.texCoord + float2(-offset, 0)).rg;
	float  depth4 = tex2D(depthTexture, input.texCoord + float2( 0,  offset)).rg;
	float  depth5 = tex2D(depthTexture, input.texCoord + float2( 0, -offset)).rg;


	float edge;
    float4 edgeColor;
   	
			edge = clamp(abs(depth2.r - depth1.r) +
					abs(depth3.r - depth1.r) +
					abs(depth4.r - depth1.r) +
					abs(depth5.r - depth1.r),
					0, 8);
					
    if (depth1.g > 0.5)
    {
		edge = clamp(pow(edge * 1, 1), 0.1, 0.95);
		
        if (depth1.r < 0.15){
            edgeColor = float4(0.2, 0.01, 0, 0);
        }
		
		
		
        else
        {
            edgeColor = float4(0.5, 0.08, 0.02, 0) + float4(1.0, 0.1, 0.0, 0) * (fadeout * 8);
        }
    }
		if ( depth1.g > 0.5) // entities
	{
		if (depth1.r < 0.4) // view model
			{
				return inputPixel;
			}	
			
			float min_intensity = 0.5; // entity colouring base intensity
			
			edge = (edge + min_intensity);
			
			if( depth1.g > 0.99 ) // marines 1
			{
				return lerp(inputPixel, edgeColorBlue * edge, amount * (0.1 + edge) * 0.6);
			}
			else if ( depth1.g > 0.97 ) // marine structures 0.98
			{
				return lerp(inputPixel, edgeColorDarkBlue * edge, amount * 0.5);
			}
			else if (depth1.g > 0.95 ) // alien players 0.96
			{
				return lerp( inputPixel, edgeColorOrange * edge, amount * 0.5);
			}
			else if ( depth1.g > 0.93 ) // georges 0.94
			{
				return lerp( inputPixel, edgeColorGreen * edge, amount * 0.5);
			}
			else { //targets and world ents 0.9
				return lerp( inputPixel, edgeColorDarkRed * edge, amount * 0.5);
			}
			
	}
    else
    {
		//edge = edge + fadeout;
		if (depth1.r == 0){
			edgeColor = float4(0.3, 0.0, 0.0, 0);
		}
		else{
			//edgeColor = float4(0.16+0.25*fadeout, 0.16+0.4*fadeout, 0.16+0.15*fadeout, 0) * 0.8;
			//edgeColor = float4(0.02+(0.02+(sin(4*fadeout)+1)/2)*fadeout, 0.06+(0.2+(sin(4*fadeout+120)+1)/2)*fadeout, 0.1+(0.06+(sin(4*fadeout+240)+1)/2)*fadeout, 0) * 0.66 + float4(0.02+0.05*fadeout,0.1+0.5*fadeout,0.05+0.2*fadeout,0)*0.33 ;
			//edgeColor = float4( 0.02, 0.26, 0.1, 0 ) * clamp(1.3+fadeout/14,0,1) + float4( 0.02, 0.1, 0.2, 0 ) * clamp(1.3-fadeout/14,0,1) * clamp(1-pow(fadeout/4,2),0,1) ;//) * clamp(1.32-(fadeout/1.6),0.2,1);
			edgeColor = float4( 0., 1, 1, 0 ) * clamp(fadeout*0.35,0.05,1.05) + float4( 0.02, 0.5, 0.2, 0 ) * clamp(1-fadeout*2.6,0,0) * clamp(fadeout*0,0.5,0.2) + float4( 0.04, 0.04, 0.04, 0 ) * (1-clamp(fadeout*05,0.2,0.8)) ;
		}
		
    }
	
    
    // Compute a pulse "front" that sweeps out from the viewer when the effect is activated.

    float wave  = cos(4 * x) + sin(4 * x);
   
    float front = pow( (time - startTime) * frontSpeed, frontMovementPower) + wave;
    float pulse = saturate((front - depth1.r * 1) / pulseWidth);
	
    if (pulse > 0)
    {
		const float kPulseFreq = 4;
		const float kEntityPulseSpeed = 1.5;
		const float kBaseMotionScalar = 0.5;
		const float kEntityMotionScalar = 1;
		
		float movement = (sin(time * kPulseFreq * (1.0 - depth1.g * kEntityPulseSpeed) - depth1.r * (kBaseMotionScalar + depth1.g * kEntityMotionScalar)) + 2) * 0.2;
		float saturation = max( max(abs(inputPixel.r - inputPixel.g), abs(inputPixel.r - inputPixel.b)), abs(inputPixel.b - inputPixel.g) );
		
		return inputPixel*0.005 + (max(inputPixel, edge) * edgeColor)*5;
    }

	
	if ( depth1.g > 0.5) // entities
	{
		if (depth1.r < 0.4) // view model
			{
				return inputPixel;
			}	
			
			float min_intensity = 0.5; // entity colouring base intensity
			
			edge = (edge + min_intensity);
			
			if( depth1.g > 0.99 ) // marines 1
			{
				return lerp(inputPixel, edgeColorBlue * edge, amount * (0.1 + edge) * 0.6);
			}
			else if ( depth1.g > 0.97 ) // marine structures 0.98
			{
				return lerp(inputPixel, edgeColorDarkBlue * edge, amount * 0.5);
			}
			else if (depth1.g > 0.95 ) // alien players 0.96
			{
				return lerp( inputPixel, edgeColorOrange * edge, amount * 0.5);
			}
			else if ( depth1.g > 0.93 ) // georges 0.94
			{
				return lerp( inputPixel, edgeColorGreen * edge, amount * 0.5);
			}
			else { //targets and world ents 0.9
				return lerp( inputPixel, edgeColorDarkRed * edge, amount * 0.5);
			}
			
	}
	
	
	    else
    {
        return inputPixel;
    }
}

Once you copied this code into Notepad or Notepad++ and edited the colour values to your liking you can save the file as DarkVision.hlsl and use Mephilles' video above to upload it as a mod to use (note that if you simply use this file to replace the one in your game's files then it would be rewritten automatically every patch and thus lost

Advantages

A list of some of the advantages an AlienVision mod can provide over the default one that comes with the game:

  • New Aesthetic - changing the appearance of the game to look more colourful and unique
  • Focus - changing the colour of the background and the colour of enemies makes it easier to focus on the enemies if the colours are contrasted well
  • Structure Detection - certain AlienVision mods have a unique colour that distinguishes between the Marine Structures and Marines themselves and even their Weapons, allowing you to more easily notice key structures from very far away at a single glance, such as Gates, Command Stations and ARCs
  • Weapon Detection - along with the above mentioned Structure Detection, certain AlienVision mods allow you to easily notice which Weapons Marines are holding or are on the ground to make sure you Bile them as a Gorge
  • Mine Detection - perhaps the most important advantage of all, certain AlienVision mods colour Mines separately from Marine Structures which can save you from faceplanting into a Mines that has been placed near a Gate or even in Marine bases
  • Gorge Detection - as explained in the points above, another distinction in colour that can be made is for Gorges, in order for you to quickly notice that a Gorge is nearby to ask for a heal, they will be coloured differently from the rest of the aliens for quick distinction
  • Egg Highlight - Another great feature of most AlienVision mods is the ability to highlight lifeform eggs a different colour than normal eggs, that way if you play Gorge you will be able to differentiate between them and help speed up the growth of the egg into a lifeform and even defend it


Examples

The following are some examples of Alien Visions with different Mods or NS2+ Settings, except the first one:


Advertisement