Search Results

Saturday, October 29, 2011

GLSL Electricity Shader

So, awhile ago, I was using RenderMonkey, a GLSL shader tool, and it shipped with a pre-made electricity shader. I have since readapted it to work with the BGE. :D
You can find a video of it below.




Requires Blender 2.5+ to work. Here's the download.

EDIT: Aaaand I forgot that the shader relies on a noise texture and didn't pack it in. -_-
I fixed the downloads.

Mirror 1 - PasteAll
Mirror 2 - MediaFire

5 comments:

  1. The audio quality sounds much better now in the video with that new microphone.

    Unfortunately, the script doesn't seem to be working for me in the original file. Not exactly sure what's going on there, but the texture effect remains static (no pun intended) and doesn't change instead of acting like electricity, as it does in this video. Pretty cool effect, though.

    Here's an image of what's going on in my file:
    http://i.imgur.com/DsGfL.png

    ReplyDelete
  2. Doh. Totally forgot to pack the noise texture in. X( I'll upload the fixed version.

    ReplyDelete
  3. Had a play last night to try and make it work on a sphere or other shapes...

    Not much success, but did find if you replace (in vertex shader)
    vtexcoord = position.xyz;
    with
    vtexcoord = gl_MultiTexCoord0.xy;
    and (in frag shader)
    vec4 color = vec4(0.965, 0.634, 1.0, 1.0); //
    purple
    with
    vec4 color = vec4(0.965, 0.5, 0.0, 1.0); //fire?

    it would be reasonable for a low flame? ^_^

    ReplyDelete
  4. @SolarLune: Thanks for posting the update, works nicely!

    @Saeblundr: Just tried that out, it's a pretty interesting modification. I've been messing around with the code as well and came up with a similar effect.

    In the Vertex Shader:
    vtexcoord = position.xy;
    vtexcoord.y -= 1; // add this line to make the flame start at the bottom of the plane

    Changing -= to += would make the flame switch to the top side and face down.
    Also, changing the order of "xy" to "yx" in "position.xy" of the code above rotates the effect 90 degrees.

    ReplyDelete
  5. That's VERY interesting. I should experiment with this as well.

    @Riyuzakisan - Your code that sets vtexcoord = position.xy doesn't make the flame start at the bottom of the plane for me... I wonder what's wrong?

    ReplyDelete