Code Monkey home page Code Monkey logo

windows-terminal-shaders's Introduction

                                                                                                              
                                                                     ░      ░░░░▒▒▓  ▒▓▒                      
               ▓▓█▒                       ░  ░░   ░░░░ ░▒░▒▒▒▓▓▓▓▓█████████████████ ▓███                      
         ▒▓█░  ███▓    ▒░             ██▓░ ░ ▒▒░▒▒░▒▓▒░▓▓▒▓█▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▒▒▒▒  █▓█▒                     
         ████  ▒█▓▓  ▓███   ▒▓█      ▓███░         ░ ▒▒ ░░░        ▓▓█▒              ▓█▓█                     
          ███▓  █▓█  ░███░ ▓███▓    ░████░   ░      ▒███    ▒▓▓▓▒  ▓▓▓▒        ░░▒▓░ ▓███▓░                   
          ▒███  ▓▓█▒ ░███▓  ███▓▒   █▓██▓▒▓███░     ████  ▒███████ ▒▓▓▓ ▒▓▒▓▓▓▓█████ ▒███▓█▓▓░░               
       ▒▒ ▒███▓ ▓▓▓▒ ░███▓  ▓▓█▓▒▒ ▓▓▒▓▓▓▓▓███▓    ▓▓███ ░██▓▒ ▓██▓▓▓▓▓ ▓██▓▓▓▒░▒▒▒▒  █▓▓▓▓████▓▓▒            
    ▒░▒▓▒▒░▓▓█▓ ▒▓▓▒  ▓██▓░ ▓▓▓▓▒▒▒▓▒▒░▓▓▓▒▓██▓▒  ▓▓▒▓▓▓▒▓▓▓▒   █▓█▓▓▓▓ ▓▓▓▓▓▒▒▓▒     ▓▓▓░  ░▒▓▓▓▓░           
  ░▒▓▓▒░   ▒█▓▓  ▓▒▓ ░▓██▓▓ ▒█▒▒▒▒▓▓▒  █▓▒ ▓▓█▓▒▒░▓▒▒▓▓▓▓▓▓▓▓  ▓██▓ ▓▓▒     ▓████▒    ▓▓▓▓     ▓▓▓▒           
 ░▒▒▓▒     ▒█▓▓  ▓▓▒ ▒▓▒█▓▓  ▓▓▒ ▓▓░   █▓▓ ▓▓▓▓▒▒▓▓▒  ▓▓▒ ▓██▓  ░▓  ▓▓▓   ░▓███▓▒     ▓█▓▒    ▒▓▓▒░           
 ▒▓▓▒      ▓▓█▓  ▓▒▒ ▒▓▒▓▓▓▓ ▓▓▒░░░   ░▓▒▒ ▒▓▒▒▒▓▓▒░ ░▓▓▓  ▓██▓▒    ▓▓▒  ░███▓     ░  ░█▓▓██▓▓ ▒░             
  ▓▒▓░    ▒▓▓█░  ▒▒░ ▒▓▒░▓▓▒░ ▓▒░     ▒▓▒░  ▓▒▒ ▓▒   ░▓▒▓ ░  ▓█▓▒▓  ▒▓▒░ ███▓      ▒   ▓▒████▓▒               
  ▒▓▓█▓▓███▓▓░   ▒▒░ ▒▒▒ ░█▓▓░▒▒░     ▒▓▒░  ▒▓▒░     ▒▓▓░ ░    ▓█▓▓  ▓▒░░█▓▓       ░░  ▓▒▒ ▒▓▓▓▒░             
   ░▒▒▓▓▓▓▓░     ▒░  ▒▒   ▓▓▒▒░▒░     ▓▒░   ░▓▒░     ▒▓▒░▒▓     ▓▒▓░ ▓▒ ░█▓▓       ░▓  ▒▓▒   ▒█▓▓░            
           ▓██▓  ░   ▒░    ▓▓▒▒░     ░▒░     ▓▒░     ▓▒░  ▒     ▒▓▓░ ▓▒  █▓▓       ▒▒  ▒▒▒ ░█░ ▓▓▒░           
            ▒██▓     ░     ░▓▒▒      ▒▒      ░▒     ░▒░  ▒▓▒    ▓▒▒▒ ▒▒  ▓█▓▒     ░░▓  ░▒░ ▒▓   ▒▓▒           
            ░ ▓██▓░         ▒▓░░                    ▒▒     ▒▒▓▒▓▓▓▒  ▒▒   ▓▓▓▒    ▓▒░   ▒   ░    ▒▒           
          ▒██▓▓▓███▓        ░▓▒░     -Hammster-    ░      ░▒▒▒▒▒    ░░    █▓▓▒▒▓▒▒░ ▓█   ▒███▒               
           ▓█▓▓▓▓█████      ░▓░░       2020                                 ▒▓▓▓▓▓ ▓███░ ▒██▓▒                
             ▒▒░▒▒▒██▓       ▒▒                                                    ▓██▓▓▓▓▒▒                  
              ░▓▓▒   ______ ░▒ ____________________________________________________   ░▓▓▒                    
                ░▒▒░        ░░                  - WELCOME -                         ░▒▒▒                      
                  ▒▓▓░     ░░                                                      ▒▓▒                        
                   ▒▒░                                                             ▒▒░                        
               ▒   ▓░                  Name:   Hans Koch                           ▓▒   ▒                     
                ▒  ▒▒         Fav Languages:   JS, C++, Rust                       ░▓  ▒                      
                ▒  ▒                    Job:   Wizard                              ▒   ▒                      
                ▒  ▓░     Development Field:   Lowlevel, Web and Game Dev          ▓▒  ▒                       
                   ░              Also does:   Art (Pixel + Vector)                 ░                          
                 ▒ ▒                                                               ▒ ▒                        
                   ▒                                                               ░                          
                                                                                                              
                   ░                           ░▒▒░  ░▒▒░                          ░                          
                                    ░▓█▓     ▒▒▒▒▒░  ░▒▒▓▒░     ██▓                                           
                                    ▓████▒  ▒▓▓▒░      ▒▒▓█   ▓████░                                          
                        ░▒░▒▒ ░     ▒▓▓▓███░ ▓▓▓   ▒▒  ▒▓▓▓ ▒████▓▓                                           
                           ░ ▒▒▒▓▓▒▒▓█▒ ░███▓▓▓▓▓      █▓▓▓▓██▓ ▒▓▓▒░▒▒▓░▒▒░▒░░░ ░                            
                               ░░▒▒▓▓█▒   ▓██▓▓▓█▓▒▓▓▒▓█▓▓▓██▒  ▒█▓▓█▒▓▒▒▒ ░░                                 
                                           ░░ ▓██████████░ ▒      ░                                           
                                               ░▓▒▒▒▓▒▒▒                                                      
                                                                                                              
                                                                                                              

windows-terminal-shaders's People

Contributors

hammster avatar mrange avatar rbeesley avatar rodneykoolman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windows-terminal-shaders's Issues

ENABLE_NOISE not used in CRT

Hi,

In #define you use ENABLE_NOISE and in the if statement you replaced it by ENABLE_GRAIN. Hence the user can not use noise option. It is always disable.

Here is my fix. I added options to control scanline.

// Data provided by Windows Terminal
Texture2D shaderTexture;
SamplerState samplerState;

cbuffer PixelShaderSettings {
	float  Time;
	float  Scale;
	float2 Resolution;
	float4 Background;
};

// Settings
#define GRAIN_INTENSITY 0.052
// colors are RGBA, value between 0.0f and 1.0f or more for intensity
// #define TINT_COLOR float4(1, 0.7f, 0, 0) // yeloow
#define TINT_COLOR float4(0,1.0f,0.4f,0) // green
// #define TINT_COLOR float4(0,0.7f,1.0f,0) // blue
#define ENABLE_SCANLINES 1
#define ENABLE_REFRESHLINE 1
#define ENABLE_NOISE 1
#define ENABLE_CURVE 0
#define ENABLE_TINT 1
#define DEBUG 0
// line speed. default is 5, little is faster. minimum is 0.1
#define REFRESH_SPEED 5
// line thickness. default is 0.03f
#define LINE_THICKNESS 0.01f
// line opacity. default is 5.0f
#define LINE_OPACITY 10.15f

// Grain Lookup Table
#define a0  0.151015505647689
#define a1 -0.5303572634357367
#define a2  1.365020122861334
#define b0  0.132089632343748
#define b1 -0.7607324991323768

static const float4 tint = TINT_COLOR;
static const float4 scanlineTint = float4(0.6f, 0.6f, 0.6f, 0.0f);

float permute(float x)
{
	x *= (34 * x + 1);
	return 289 * frac(x * 1 / 289.0f);
}

float rand(inout float state)
{
	state = permute(state);
	return frac(state / 41.0f);
}

float4 mainImage(float2 tex) : TARGET
{
	float2 xy = tex.xy;

	#if ENABLE_CURVE
	// TODO: add control variable for transform intensity
	xy -= 0.5f;				// offcenter screen
	float r = xy.x * xy.x + xy.y * xy.y; 	// get ratio
	xy *= 4.2f + r;				// apply ratio
	xy *= 0.25f;				// zoom
	xy += 0.5f;				// move back to center

	// TODO: add monitor visuals and make colors static consts
	// Outter Box
	if(xy.x < -0.025f || xy.y < -0.025f) return float4(0, 0, 0, 0);
	if(xy.x > 1.025f  || xy.y > 1.025f)  return float4(0, 0, 0, 0);
	// Bazel
	if(xy.x < -0.015f || xy.y < -0.015f) return float4(0.03f, 0.03f, 0.03f, 0.0f);
	if(xy.x > 1.015f  || xy.y > 1.015f)  return float4(0.03f, 0.03f, 0.03f, 0.0f);
	// Screen Border
	if(xy.x < 0.001f  || xy.y < 0.001f)  return float4(0.0f, 0.0f, 0.0f, 0.0f);
	if(xy.x > 0.999f  || xy.y > 0.999f)  return float4(0.0f, 0.0f, 0.0f, 0.0f);
	#endif

	float4 color = shaderTexture.Sample(samplerState, xy);

	#if DEBUG
	if(xy.x < 0.5f) return color;
	#endif

	#if ENABLE_REFRESHLINE
	float timeOver = fmod(Time / REFRESH_SPEED, 1);
	float refreshLineColorTint = timeOver - xy.y;
	if(xy.y > timeOver && xy.y - LINE_THICKNESS < timeOver ) color.rgb += (refreshLineColorTint * LINE_OPACITY);
	#endif

	#if ENABLE_SCANLINES
	// TODO: fixing the precision issue so that scanlines are always 1px
	if(floor(xy.y * 1000) % 2) color *= scanlineTint;
	#endif

	#if ENABLE_TINT
	float grayscale = (color.r + color.g + color.b) / 3.f;
	color = float4(grayscale, grayscale, grayscale, 0);
	color *= tint;
	#endif

	#if ENABLE_NOISE
	float3 m = float3(tex, Time % 5 / 5) + 1.;
	float state = permute(permute(m.x) + m.y) + m.z;

	float p = 0.95 * rand(state) + 0.025;
	float q = p - 0.5;
	float r2 = q * q;

	float grain = q * (a2 + (a1 * r2 + a0) / (r2 * r2 + b1 * r2 + b0));
	color.rgb += GRAIN_INTENSITY * grain;
	#endif

	return color;
}

float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET
{
	return mainImage(tex);
}

Key Binding Not Toggling Shader

I don't know if this is a Terminal problem or the shader pipeline problem, but Shift + F11 is not toggling the shader to turn off (it is stuck on).

PS: I know key bindings are working in general because the Shift + F10 does invoke focus mode.

Just to make sure there isn't a syntax or command issue, here's the section from my settings.json

image

How do I change the color?

I have installed it, but I would like to change the default CRT to Green or Ember Monochrome.
How do I do that?

Hue Shift text contrast option

Would it be possible to have the Hue Shift shader offset the color of different contiguous sections in such a way as to preserve relative visual contrast?

The example would be to reduce the whiteness of the symbols within the larger colored segments below, to preserve their visibility while within the brighter yellow and green parts of the hue rotation:
image

I'm not sure if it's feasible at all, so please disregard if it isn't.

No CRT distortion

When I use this with the latest Terminal, I don't see any CRT distortion at all. Not sure if I missed a step, or if that is broken.

This is all that should be needed, AFAIK:

#define ENABLE_CURVE 1

Pete

Glowing Text

Would it be possible to mix this with the Experimental Retro Effects that come preinstalled with windows terminal?

Cursor misalignment

When you use the cursor to select some text, it seems to be out of alignment.

keybindings

    "keybindings":
    [
    // It's recommended to add those two toggles for ease of use
    {
      "command": "toggleFocusMode",
      "keys": "shift+f11"
    },
    {
      "command": "toggleShaderEffects",
      "keys": "shift+f10"
    }
    ]

it doesn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.