- 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 ...
Today, I'll show you a good exercise I made to manipulate quaternions. In extra you got a 3C structure for a flight game. I chose to make a flight behavior because of rotation complexity. Today we always use physics to drive vehicles in video games, but this exercise is focused on quaternions manipulations, so all the behavior is driven by quaternions. Main Features: - Smooth TPS camera - Camera switch (FPS / TPS) - Auto replace character rotation: 3 different ways to smoothly reset character rotation (All Axis, Per Axis, None) Video Controls: - Z/S: pitch - Q/D: roll - Shift: boost - Left click / Right click: dodge left / right (lateral movement with roll as in some Star Wars video games) Download: - Download Windows standalone - Download Unity project
This comment has been removed by the author.
ReplyDelete