Simple Fog

More
3 years 11 months ago - 3 years 11 months ago #1 by fuze
Simple Fog was created by fuze
Depth based fog effect.

My first ever effect. A cheap fog effect that uses depth, multiplys it with a color (uses texture for the color), and does a screen operation over the image.

To change the fog color you need to change the color of the texture.

Feel free to modify, enhance or do whatever you want with this.

EXAMPLE

DOWNLOAD [r1]

DOWNLOAD [r2] (Uses RGB modifier instead of texture, thanks to NoMansReshade).
Last edit: 3 years 11 months ago by fuze.
The following user(s) said Thank You: Elimina, Insomnia, andrew, Gar Stazi

Please Log in or Create an account to join the conversation.

More
3 years 11 months ago #2 by NoMansReshade
Replied by NoMansReshade on topic Simple Fog
Replaced texture with rbg modifier. Couldn't figure out how to change the distance of the fog, but:


#include "ReShade.fxh"

texture texColorBuffer : COLOR;
texture texDepthBuffer : DEPTH;
texture texFogColor < source = "FogColor.png"; > { Width = 16; Height = 16; Format = RGBA8; };

uniform float Fog_Intensity <
	ui_type = "drag";
	ui_min = 0; ui_max = 2;
	ui_label = "Fog Intensity";
	ui_tooltip = "Intensity of the fog.";
> = 1;

uniform float Fog_Additive <
	ui_type = "drag";
	ui_min = -2; ui_max = 2;
	ui_label = "Additive Fog Multiplier";
	ui_tooltip = "Makes fog Additive (1.0 for non additive)";
> = 1;

uniform float Fog_Length <
	ui_type = "drag";
	ui_min = 0; ui_max = 2000;
	ui_label = "Fog Distance";
	ui_tooltip = "Distance of the fog.";
> = 1;


uniform float3 FogRGBBalance <
	ui_type = "drag";
	ui_min = 0; ui_max = 1;
	ui_label = "RGB Balance";
	ui_tooltip = "A per channel multiplier to the fog strength so you can give more boost to certain colors over others.";
> = float3(1.0, 1.0, 1.0);


sampler samplerDepth
{
	Texture = texDepthBuffer;
};

sampler samplerColor
{
	Texture = texColorBuffer;
};

sampler samplerFogColor
{ 
	Texture = texFogColor; 
};

void Fog(float4 pos : SV_Position, float2 texcoord : TEXCOORD0, out float4 color : SV_Target)
{
	float4 fogcolor = float4(FogRGBBalance.r, FogRGBBalance.g, FogRGBBalance.b,	Fog_Intensity);
	//float4 fogcolor = tex2D(samplerFogColor, texcoord).rgba;
	float depth = tex2D(samplerDepth, texcoord).r;
	depth = Fog_Intensity / (-99.0 * depth + 101.0);
	color = tex2D(samplerColor, texcoord);
	color = depth * fogcolor + (Fog_Additive - depth) * color;
}

technique Fog < enabled = true; >
{		
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = Fog;	
	}	
}
The following user(s) said Thank You: fuze, Gar Stazi

Please Log in or Create an account to join the conversation.

More
3 years 11 months ago #3 by fuze
Replied by fuze on topic Simple Fog
Thank you :)

Updated the download with the updated version (thanks to NoMansReshade).

Please Log in or Create an account to join the conversation.

More
3 years 10 months ago #4 by Elimina
Replied by Elimina on topic Simple Fog
definitely using this

Please Log in or Create an account to join the conversation.

More
3 years 10 months ago #5 by Martigen
Replied by Martigen on topic Simple Fog
Sweet! Will give this a go.

Please Log in or Create an account to join the conversation.