FXHyperbolicStatic

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
m (Reverted edits by Joseph05408 (Talk); changed back to last version by Tsphillips)
Line 1: Line 1:
 +
==Description==
 +
This is a special effects shader that resembles a force field.
 +
<p>
  
 +
 +
==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==
 +
<shaderlab>//
 +
// 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"
 +
}
 +
</shaderlab>

Revision as of 19:12, 19 October 2009

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

<shaderlab>// // 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

  1. pragma vertex vert
  2. pragma fragment frag
  3. pragma fragmentoption ARB_fog_exp2
  4. 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" }

</shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox