FXHyperbolicStaticParticle

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==
 +
A variant of FXHyperbolicStatic that falls off around the edges like smoke. Better for particle effects, such as energy balls or energy generators.
  
 +
==Usage==
 +
See FXHyperbolicStatic.
 +
 +
<ShaderLab - FX/HyperbolicStaticParticle >//
 +
// Shader: "FX/HyperbolicStaticParticle"
 +
// 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.
 +
// This shader has been adapted for use in particle systems.
 +
//
 +
 +
Shader "FX/HyperbolicStaticParticle" {
 +
 +
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);
 +
color *= 1 - clamp(2*distance(i.texcoord.xy, float2(0.5, 0.5)), 0, 1);
 +
return half4( color, 1 );
 +
}
 +
ENDCG
 +
 +
    }
 +
}
 +
Fallback "Transparent/Diffuse"
 +
}
 +
</shaderlab>

Revision as of 19:12, 19 October 2009

Description

A variant of FXHyperbolicStatic that falls off around the edges like smoke. Better for particle effects, such as energy balls or energy generators.

Usage

See FXHyperbolicStatic.

<ShaderLab - FX/HyperbolicStaticParticle >// // Shader: "FX/HyperbolicStaticParticle" // 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. // This shader has been adapted for use in particle systems. //

Shader "FX/HyperbolicStaticParticle" {

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); color *= 1 - clamp(2*distance(i.texcoord.xy, float2(0.5, 0.5)), 0, 1); return half4( color, 1 ); } ENDCG

   }

} Fallback "Transparent/Diffuse" } </shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox