you may find this neon glow effect is what your after nothing quite like janbos pack
but with the right texture overlay it will light up around ship etc aswell if that's what
you want
// Project: 3D neon lights shader demo
// Created: 2018-07-25
// show all errors
SetErrorMode(2)
#constant green = MakeColor(0,255,0)
#constant white = MakeColor(255,255,255)
#constant screenWidth=1920
#constant screenHeight=1080
SetWindowSize(screenWidth,screenHeight,0)
Setvirtualresolution(screenWidth,screenHeight)
// set variables for camera's starting position
carID=1
SetCameraPosition(1,0,100,-250)
SetFogMode( 1 )
SetFogColor(10,10,10)
SetFogRange(6,16)
//loadObject(carId,"car.obj")
//SetObjectScale(carId,0.5,0.5,0.5)
box=CreateObjectBox(150,150,150)
createShader()
SetObjectImage(box,createBoxImage(),0)
SetObjectImage(box,createTriangleImage(),1)
//createShader()
Shader=LoadShader( "neon.vs","neon.ps" )
SetObjectShader(box,Shader)
lightint#=1.0
lightson=1
SetShaderConstantByName(Shader,"lightint",lightint#,0.0,0.0,0.0)
SetShaderConstantByName(Shader,"lightson",lightson*1.0,0.0,0.0,0.0)
do
RotateObjectLocalY(box,.5)
//SetShaderConstantByName(Shader,"pointPos",1,1,1,1)
//SetShaderConstantByName(Shader,"myColor",r#,g#,b#,0.02) //red green blue factor
if GetRawKeyState(49)=1
lightint#=lightint#-0.01
if lightint#<0.0 then lightint#=0.0
SetShaderConstantByName(Shader,"lightint",lightint#,0.0,0.0,0.0)
endif
if GetRawKeyState(50)=1
lightint#=lightint#+0.01
if lightint#>1.0 then lightint#=1.0
SetShaderConstantByName(Shader,"lightint",lightint#,0.0,0.0,0.0)
endif
if GetRawKeypressed(76)=1
lightson=1-lightson
SetShaderConstantByName(Shader,"lightson",lightson*1.0,0.0,0.0,0.0)
endif
//SetShaderConstantByName(Shader,"lightint",lightint#,0.0,0.0,0.0)
//SetShaderConstantByName(Shader,"lightson",lightson*1.0,0.0,0.0,0.0)
print("Press L to toggle lights")
print("Use 1 and 2 to increase/decrease light")
print ("Current value "+str(lightint#))
sync()
loop
function createBoxImage()
rem draw a triangle image used for the player sprite on radar
SetClearColor(0,0,0)
ClearScreen()
Render()
DrawBox(0,0,10,10,white,white,white,white,1)
swap()
img = getimage(0,0,10,10)
SetImageTransparentColor(img,0,0,0)
endfunction img
function createTriangleImage()
rem draw a triangle image used for the player sprite on radar
SetClearColor(0,0,0)
ClearScreen()
Render()
DrawLine(5,0,9,9,green,green)
DrawLine(1,8,8,8,green,green)
DrawLine(1,9,5,0,green,green)
//DrawLine(5,0,5,9,green,green)
//draw these if you want it filled
DrawLine(4,0,8,9,green,green)
DrawLine(0,9,8,9,green,green)
DrawLine(0,9,4,0,green,green)
//DrawBox(4,1,6,8,green,green,green,green,1)
swap()
img = getimage(0,0,10,10)
SetImageTransparentColor(img,0,0,0)
endfunction img
function createShader()
file = OpenToWrite("neon.vs")
WriteLine(file,"attribute highp vec3 position;")
WriteLine(file,"attribute mediump vec3 normal;")
WriteLine(file,"attribute mediump vec2 uv;")
WriteLine(file,"varying highp vec3 posVarying;")
WriteLine(file,"varying mediump vec3 normalVarying;")
WriteLine(file,"varying mediump vec2 uvVarying;")
WriteLine(file,"varying mediump vec3 lightVarying;")
WriteLine(file,"uniform highp mat3 agk_WorldNormal;")
WriteLine(file,"uniform highp mat4 agk_World;")
WriteLine(file,"uniform highp mat4 agk_ViewProj;")
WriteLine(file,"uniform mediump vec4 uvBounds0;")
WriteLine(file,"mediump vec3 GetVSLighting( mediump vec3 normal, highp vec3 pos );")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file," uvVarying = uv * uvBounds0.xy + uvBounds0.zw;")
WriteLine(file," highp vec4 pos = agk_World * vec4(position,1.0);")
WriteLine(file," gl_Position = agk_ViewProj * pos;")
WriteLine(file," mediump vec3 norm = normalize(agk_WorldNormal * normal);")
WriteLine(file," posVarying = pos.xyz;")
WriteLine(file," normalVarying = norm;")
WriteLine(file," lightVarying = GetVSLighting( norm, posVarying );")
WriteLine(file,"}")
CloseFile(file)
//pixel shader
file = OpenToWrite("neon.ps")
WriteLine(file,"uniform sampler2D texture0;")
WriteLine(file,"uniform sampler2D texture1;")
WriteLine(file,"varying highp vec3 posVarying;")
WriteLine(file,"varying mediump vec3 normalVarying;")
WriteLine(file,"varying mediump vec2 uvVarying;")
WriteLine(file,"varying mediump vec3 lightVarying;")
WriteLine(file,"mediump vec3 GetPSLighting( mediump vec3 normal, highp vec3 pos );")
WriteLine(file,"mediump vec3 ApplyFog( mediump vec3 color, highp vec3 pointPos );")
WriteLine(file,"uniform vec4 myColor;")
WriteLine(file,"uniform mediump vec4 agk_MeshDiffuse;")
WriteLine(file,"mediump vec4 colorResult;")
WriteLine(file,"uniform float lightint;")
WriteLine(file,"uniform float lightson;")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file," mediump vec3 norm = normalize(normalVarying);")
WriteLine(file," mediump vec3 light = lightVarying + GetPSLighting( norm, posVarying );")
WriteLine(file," vec4 colorA = texture2D(texture0, uvVarying);")
WriteLine(file," vec4 colorB = texture2D(texture1, uvVarying);")
WriteLine(file," if (lightson < 1.0) {")
WriteLine(file," colorResult = vec4(colorA * vec4(light,1.0))*lightint;")
WriteLine(file," } else {")
WriteLine(file," if (colorB.a > 0.0) {")
WriteLine(file," colorResult = vec4 ((colorA * vec4(light,1.0))*lightint) + (colorB*colorB.a);")
WriteLine(file," } else {")
WriteLine(file," colorResult =vec4(colorA * vec4(light,1.0))*lightint;")
WriteLine(file," }")
WriteLine(file," }")
WriteLine(file,"gl_FragColor = colorResult;")
WriteLine(file,"}")
CloseFile(file)
endfunction
fubar