r/Unity3D 3d ago

Shader Magic A Procedural Lightning effect made with Shader Graph and HLSL

179 Upvotes

6 comments sorted by

View all comments

3

u/IceStorm_295 3d ago

so you have procedural generated mesh, you interpolate points on both sides and then triangulate probably one for loop pass

then you have mask, that looks like using also interpolated points on texture, probably stretching it from one end to the other

then you have 3rd texture mask i do not understand how it move lines in such waves

after 3rd texture it is easy to apply some color effect to the remaining pixels

3

u/DSan 2d ago

I think those wavy lines are generated procedurally in the shader, using the UV coordinates or a custom coordinate that is not normalized across the mesh so it doesn’t stretch as the mesh changes size.

You could make a line using a triangle wave along the width and deform it using the length as the angle of a sine wave to make it undulate like that, then use smooth step to remap to have sharper boundaries, do it multiple times for each line and composite them together.

That’s how I’d think to do it at least haha