lightning and fog shader

i know nothing about shaders other than there is alot of them i dont understand and i was wondering how to make a fog or lightning bckground or even both please help

@Ray_Spahn - please don’t start a new thread for every comment

I’ve written an ebook on shaders here

https://www.dropbox.com/sh/mr2yzp07vffskxt/AACqVnmzpAKOkNDWENPmN4psa

Please take note that you need to be reasonably competent in Codea, and you will also need some basic understanding of C. Shaders are not for beginners!

This is the class i use to draw random lightning bolts from my shmup space ship ( as weapon )

The code was mainly grabbed out of some code samples going over the forum.
Maybe it’s a good starting point as it was for me

PlayerLightning = class()

function PlayerLightning:init(pos,pos2,Nplayer,beamtype)
    self.pos = pos
    self.target = pos2
    self.x = self.pos.x 
    self.y = self.pos.y + 30
    self.player = Nplayer
    self.beamtype = beamtype or 0
    self.type = 9
    self.timer = 255
    self.pow =  0.3
    self.powerupval = 0
    self.variation = vec2(260,100)
    table.insert(self.points,vec2(self.pos.x,self.pos.y))
    for i = 1,10 do
        table.insert(
            self.points,
            vec2(
                self.points[i].x+(math.random()-.5)*self.variation.x,
               self.points[i].y+math.random()*self.variation.y
            ))
    end
end

function PlayerLightning:draw()
    self.timer = self.timer - 15
    pushStyle()
    fill(255,255,255)
    stroke(math.random(100,120),30, math.random(120,255), self.timer)
    strokeWidth(3)
    for i,v in ipairs(self.points) do
        if self.points[i+1] then
            line(v.x,v.y,self.points[i+1].x,self.points[i+1].y)
        end
    end
    
    popStyle()
    
end