GLSL shader example

Hexagonal Energy Shield

Use the sphere normal for a bright Fresnel-like rim, then overlay a procedural honeycomb approximation and a moving pulse band. The grid is projected, not geometry.

Live example

Edit the code and the preview updates as you type.

What to observe

Hexagonal Energy Shield.

Mechanism

Use the sphere normal for a bright Fresnel-like rim, then overlay a procedural honeycomb approximation and a moving pulse band. The grid is projected, not geometry.

The controlling code

float r=length(p);if(r<.72){float z=sqrt(.72*.72-r*r);vec3 n=normalize(vec3(p,z));vec2 q=p*12.,size=vec2(1.7320508,1.);vec2 a=mod(q,size)-size*.5,b=mod(q-size*.5,size)-size*.5,g=abs(dot(a,a)<dot(b,b)?a:b);float hex=1.-smoothstep(.43,.48,max(dot(g,vec2(.8660254,.5)),g.y));float rim=pow(1.-n.z,3.);float pulse=exp(-pow((p.y-sin(u_time)*.7)*20.,2.));c+=vec3(.05,.65,1.)*(rim*2.+(1.-hex)*.35+pulse)*(0.4+u_parameter);}

Experiment

Change q=p*12. to q=p*6.. The projected honeycomb becomes coarser, while the spherical boundary at r = 0.72 and the moving horizontal pulse keep their positions.

Debugging and cost

The rim pow(1.-n.z,3.) is derived from the front hemisphere's normal, not from a 3D mesh. Change its exponent 3. to 6. to concentrate brightness nearer the silhouette without adding geometry or texture lookups.

Built-in functions used

Learn it step by step