- Scene diffuse (unlit) and scene color (lit) buffer are blended, allow to see in the complete dark while still having luminance difference on pixel affected by lights
- Option to have pixels with high luminance tending toward white
fixed4 frag (v2f i) : SV_Target { // Get pixel color fixed4 col = tex2D(_MainTex, i.uv); fixed4 diffuse = tex2D(_CameraGBufferTexture0, i.uv); // Diffuse RGB, Occlusion A fixed4 nakedColor = col;
// Scene color - Keep only luminance fixed luminance = (col.r + col.g + col.b) * 0.333f; col.rgb = fixed3(luminance, luminance, luminance);
// GBuffer - Keep only luminance float diffuseLuminance = (diffuse.r + diffuse.g + diffuse.b) * 0.333f; diffuse.rgb = fixed3(diffuseLuminance, diffuseLuminance, diffuseLuminance); // Blend scene color with GBuffer to keep luminance when no light still preserving light col = lerp(diffuse, col * _LightSensitivity, luminance);
// Colorize pixel with a constant color col *= _ColorTint; // Blend high luminance pixel with white to empower the luminance if (luminance > _LightWhiteTreshold) col.rgb = lerp(col.rgb, fixed3(1, 1, 1) * _LightWhitePower, luminance);
public class ImageEffect_Generic : MonoBehaviour
{
#region MonoBehaviour Methods
// Use this for initialization
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
/// <summary>
/// Called when image is renderer for graphics
/// </summary>
/// <param name="_Source">Source image</param>
/// <param name="_Destination">Destination Image</param>
private void OnRenderImage(RenderTexture _Source, RenderTexture _Destination)
{
// Set the image to draw
Graphics.Blit(_Source, _Destination, m_Material);
}
#endregion
#region Attributes
[SerializeField]
public Material m_Material = null;
#endregion
}
Put the image effect script on your camera and make a material using the night vision shader. Then you just have to modify the material parameter and to enjoy it.
Note that Unity 2018 works with stack and it needs some modifications to works with stack: https://github.com/Unity-Technologies/PostProcessing/wiki/Writing-Custom-Effects
What is FPS Maker FPS Maker is a FPS game engine with no coding knowledge requirements designed for absolute newbies in game development, it looks like more a game with its own map editor. FPS Maker is written in C++ and uses Irrlicht for the rendering part and OpenAL for the audio part. I started working on it 3 months ago, of course it is still under development and my free time will be highly shortened soon, so progress will be slow but I will try to add/improve features depending on my free time. So this is how FPS Maker looks like for now, hoping I will have enough time to post updates. Main Features Editor Map editing Play current map from editor Build game in a standalone format Tile based navigation graph generation (automatic) Browse custom game assets Game Basic FPS 3C Weapons AI based on state machines Path finding based on A* algorithm Batching for static geometry Dynamic per pixel lighting (using a custom shader, not the Irrlicht built ...
I wrote a simple shader for Unity to make a stylized fog like Fire Watch's fog. The idea is to get a pixel on the texture depending on the pixel depth, if the fog is near, a pixel on the left on the texture uv will be picked, if the fog is far, a pixel on the right on the texture uv will be picked. Features Choose between a linear fog and an exponential fog Choose between a simple color or a texture Screenshots Video Source Code Image Effect Version (Unity 2017 and older if not using Stack) [+] Shader Shader "Hidden/Shader_StylizedFog" { Properties { _MainTex("Texture", 2D) = "white" {} _FogColor("Fog Color", Color) = (1, 1, 1, 1) _UseStylizedFogTexture("Use Stylized Fog Texture", Int) = 0 _StylizedFogTexture("Stylized Fog Texture", 2D) = "white" {} _FogMinDistance("Fog Min Distance", Float) = 0 _FogMaxDistance("Fog Max Distance",...
This comment has been removed by the author.
ReplyDelete