Shader特效——实现“闪电”【GLSL】

 

效果图

 

核心代码与详解:

uniform float time_0_X;
uniform vec4 color;
uniform sampler3D Noise;

uniform float glowStrength;
uniform float height;
uiform float glowFallOff;
uniform float speed;
uniform float sampleDist;
uniform float ambientGlow;
uniform float ambientGlowHeightScale;
uniform float vertNoise

void main(void)
{
   //vec2 texCoord = vec2(2.* (gl_FragCoord.x - 256.)/ 512., 
   //2. * (gl_FragCoord.y - 256.)/ 512.);
   
   vec2 texCoord = vec2(clamp(2.* (gl_FragCoord.x - 256.)/ 512., -1., 1.), 
                        clamp(2.* (gl_FragCoord.y - 256.)/ 512., -1., 1.));
  
 // 噪声采样的垂直位置
   vec2 t = vec2(speed * time_0_X * .5871 
                 - vertNoise * abs(texCoord.y), spe

你可能感兴趣的:(Shader,ShaderJoy,——,Shader,实例详解)