FXHyperbolicStatic

From Unify Community Wiki
Jump to: navigation, search

Contents

Description

This is a special effects shader that resembles a force field.

Usage

Adjust the color for the color of the field. Rate adjusts the oscillation / movement rate. The opacity of the color determines the field strength. Full opacity looks like static, almost no opacity (mostly alpha) looks like diagonal bars. Desaturate the color for additional transparency.

Caveats

I have no idea what graphics cards it will or won't work on. Also, moving the camera can cause something resembling flicker in the form of moiré patterns.

ShaderLab - FXHyperbolicStatic.shader

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


//
// Shader: "FX/Hyperbolic Static"
// Version: v1.0
// Written by: Thomas Phillips
//
// Anyone is free to use this shader for non-commercial or commercial projects.
//
// Description:
// Generic force field effect.
// Play with color, opacity, and rate for different effects.
//

Shader "FX/Hyperbolic Static" {
	
Properties {
	_Color ("Color Tint", Color) = (1,1,1,1)
	_Rate ("Oscillation Rate", Range (1, 300)) = 300
}

SubShader {
	
	ZWrite Off
	Tags { "Queue" = "Transparent" }
	Blend One One

	Pass {

CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#include "UnityCG.cginc"

float4 _Color;
float _Rate;

struct v2f {
	V2F_POS_FOG;
	float4 texcoord : TEXCOORD0;
};

v2f vert (appdata_base v)
{
	v2f o;
	PositionFog( v.vertex, o.pos, o.fog );
	o.texcoord = v.texcoord;
	return o;
}

half4 frag (v2f i) : COLOR
{
	float3 color;
	float m;
	m = _Time[0]*_Rate + ((i.texcoord[0]+i.texcoord[1])*5000000*_Color.a*_Color.a);
	m = sin(m) * 0.5;
	color = float3(m*_Color.r, m*_Color.g, m*_Color.b);
	return half4( color, 1 );
}
ENDCG

    }
}
Fallback "Transparent/Diffuse"
}

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Tools