Posted: 11th May 2018 15:07
I'm getting in love with this shader effect since long time ago.

Hehe, I searched for this page quite a long time, thanks!

+1 for a request for janbos shader pack!
Best universal multiple shader integration so far.
Foam on Coastlines would be awesome.
Posted: 11th May 2018 17:59
You make it hard for me
I already looked into this, but I see two problems which is the texture needed for the foam pattern and the shader is designed for a tessellated plane which vertices are displaced (the waves moving the vertices of a tiled plane mesh ...you all saw the link above).
For the plane I would need to generate a grid mesh which actually isn't a problem for me ... maybe I could abuse AGK's terrain mesh for this.
The problem is I can't use the old shader... what is with backwards compatibility !?

The shader would need information for DuDv,Normal,Depth,Reflection,Refraction,Foam,Shadow cascade 1,cascade 2, cascade 3 and cascade 4 which is already two more that the maximum allowed textures for GLSL ES of 8 textures.
But I can think of several ways around a 4th Texture used by me, which would disable the ability to cast shadows on the water.
? I could try to generate a foam texture i.e. calculate the foam completely in the shader and give some parameters to tweak it, but neither is it fast nor is it a good solution for artists to play with strange float values.
? I could calculate the DuDv map from the Normal map as the DuDv map normally is the derivative of the Normalmap. So I have a free texture space which could be used for the foam mask.
? A DuDv map is the direction of the waves encoded in the Red and Green channel so there are two channels left, blue and alpha can be used for the foam as it also takes up only two channels. (combining them would be up to the artist)

Of course its not impossible but also not trivial.
You all are programmers too so:
Which way should I use ?
Do I create a new shader and command set for it ?
Or can you life with changing a preprocessor variable in the shader code ? ( like: #define Foam=0 // 1; #ifdef (Foam=1){do stuff} )
Posted: 12th May 2018 14:08
Hi all!

Could anyone help me out with a 3D sun shader to be used in Tier 1?
Something like this:
https://www.youtube.com/watch?v=UHEgO6JfCrs

It would be nice if I could also change the color/temperature of the sun similar to the one in the video by changing a single value or have a few variation at least like red, yellow, blue and white.
I would like to target Windows and Android but HTML5 (WebGL) also would be nice if possible.
The corona and atmosphere is not that important but would be nice.
I would even pay for it but only through official channels like itch.io, tgc store or Steam for example.

Thank you in advance.
Posted: 12th May 2018 18:33
Those water and sun shaders are looking awesome.
Posted: 12th May 2018 19:30
Could anyone help me out with a 3D sun shader to be used in Tier 1?

Huh, those corona bursts look like particles but I can't think of a way to achieve it with AGK's particle effects.
But with some random planes stuck to the sphere with a nice transparent corona texture should also look good.
The sun sphere itself is just a noise mask that maps a color ramp, similar to my dissolve shader.
The color ramp is probably the Hue from HSV color model which is altered by the slider.

+1 for a request for janbos shader pack!

Working on it
Posted: 12th May 2018 19:42
Do I create a new shader and command set for it ?


Yes, please no compiler directives, sure it would be easier to create a new set than if-else the existing shader.
Posted: 12th May 2018 20:42
sure it would be easier to create a new set than if-else the existing shader

don't you mean: "it would be easier to if-else the existing shader than create a new set"

I find it hard to say when a feature is big enough to create a new command set.
I could add some commands so it generates a tesselated plane, code in the shader and some commands to alter the appearance of the foam.
So without a new shader and command set from pond and lake to rough sea water with a few parameters.
On the other hand it does make some sense to split them into two so I can better focus on their individual attributes, if you know what I mean.
Not sure through.
Maybe we discuss this on the shader pack thread
Posted: 12th May 2018 23:28
ut with some random planes stuck to the sphere with a nice transparent corona texture should also look good.

Yes a 3d plane with some transparent texture around the sun would be fine too. But need to make sure the planes are not rendered on the side of the sun that is facing the camera to avoid weird lines across the surface of the sun.

he color ramp is probably the Hue from HSV color model which is altered by the slider.

Well, unfortunately I have no clue about this staff, I tried to look in to how to write shader code but I did find it too complicated
So would you be able to look in to this? it seems you have some idea how to replicate that shader. In case it depends on money, feel free to PM me with the price but as I mentioned I prefer to pay through a public store and I don't expect this to be a private, exclusive work for me, once it done, you can sell it also to whoever you want.
Posted: 17th May 2018 2:50
Jukuma produced a great anaglyph stereoscopic shader https://forum.thegamecreators.com/thread/213006

EDITED

I had a problem converting his shader to use light and fog but think I now have it working

+ Code Snippet
// Project: Anaglyph 
// Created: 2014-12-19

// set window properties
SetWindowSize( 0, 0, -1 )

// set display properties
DevW = GetDeviceWidth()
DevH = GetDeviceHeight()
SetVirtualResolution( DevW, DevH )
SetOrientationAllowed( 0, 0, 1, 1 )

// set event buttons
SetPrintSize( 16 )
AddVirtualButton( 1, 56, 24, 16 )
SetVirtualButtonColor( 1, 64, 255, 64 )
AddVirtualButton( 2, 74, 24, 16 )
SetVirtualButtonColor( 2, 64, 255, 64 )
AddVirtualButton( 3, 56, 40, 16 )
SetVirtualButtonColor( 3, 64, 255, 64 )
AddVirtualButton( 4, 74, 40, 16 )
SetVirtualButtonColor( 4, 64, 255, 64 )
AddVirtualButton( 5, 56, 56, 16 )
SetVirtualButtonColor( 5, 64, 255, 64 )
AddVirtualButton( 6, 74, 56, 16 )
SetVirtualButtonColor( 6, 64, 255, 64 )
AddVirtualButton( 7, DevW - 8, 8, 16 )
SetVirtualButtonColor( 7, 255, 32, 32 )

// allocation global
type ktype
	sx#, sy#, sz#, ex#, ey#, ez#
endtype
dim k[250] as ktype

global CamX# = 5.00
global CamY# = 1.00
global CamZ# = 2.50 

// make 3d objects
for o = 1 to 250
    select Random( 1, 5)
		case 1:
			CreateObjectBox( o, 100, 100, 100)
		endcase
		case 2:
			CreateObjectPlane( o, 100, 100 )
		endcase
		case 3:
			CreateObjectSphere( o, 100, 32, 32 )
		endcase
		case 4:
			CreateObjectCylinder( o, 50, 50, 32)
		  endcase
		case 5:
			CreateObjectCone( o, 100, 100, 32 )
		endcase
    endselect
    SetObjectColor(o,255,255,255,180)
next o

// set cam 
SetCameraRange( 1, 1, 3000 )
SetCameraPosition( 1, 0, 0, 0 )
SetCameraRotation( 1, 0, 0, 0 )

// pre post process
CreateShader()
Quad = CreateObjectQuad()
Stereo = LoadShader( "Anaglyph.vs", "Anaglyph.ps" )
CreateRenderImage( 1, DevW, DevH, 0, 0 )
CreateRenderImage( 2, DevW, DevH, 0, 0 )

repeat
  	Update(0)

	// left render
	SetRenderToImage( 1, -1 )
	ClearScreen()
	SetCameraPosition( 1, -CamX#, -CamY#, -CamZ# )

	DrawObj3D( DevW, DevH )  	
	
	// right render
 	SetRenderToImage( 2, -1 )
	ClearScreen()
	SetCameraPosition( 1, CamX#, CamY#, CamZ# )

	Render3D()
	
	// post process
	SetRenderToScreen()
	SetObjectImage( Quad, 1, 0 )
	SetObjectImage( Quad, 2, 1 )
	SetObjectShader( Quad, Stereo)
	DrawObject( Quad )

	// 2d stuff
	PrintC( "FPS: " )
	Print( Trunc( ScreenFPS() ) )
	PrintC( "CamX < >: " )
	Print( CamX# )
	PrintC( "CamY < >: " )
	Print( CamY# )
	PrintC( "CamZ < >: " )
	Print( CamZ# )

	Render2DFront() 
	
	Esc = VButton()
	
	Swap()
until GetRawKeyPressed(32)
end

function VButton()
	for i = 1 to 7
		if GetVirtualButtonState( i )
			select i
				case 1:
					CamX# = CamX# - 0.01
				endcase
				case 2:
					CamX# = CamX# + 0.01
				endcase
				case 3:
					CamY# = CamY# - 0.01
				endcase
				case 4:
					CamY# = CamY# + 0.01
				endcase
				case 5:
					CamZ# = CamZ# - 0.01
				endcase
				case 6:
					CamZ# = CamZ# + 0.01
				endcase
				case 7:
					Esc = 1
				endcase
			endselect
		endif 
	next i
endfunction Esc

function CosInt(a#, b#, c#)
	f# = ( 1 - cos( c# * 180.0 ) ) / 2
	r# = a# * ( 1 - f# ) + b# * f#
endfunction  r#

function DrawObj3D( w, h )
	for o = 1 to 250
		if Abs( k[o].sx# - k[o].ex# ) < 5 or Abs( k[o].sy# - k[o].ey# ) < 5 or Abs( k[o].sz# - k[o].ez# ) < 5
			k[o].ex# = Random( 0, w * 2 ) - w
			k[o].ey# = Random( 0, h * 2 ) - h
			k[o].ez# = Random( 0, 3000)
		endif
		k[o].sx# = CosInt( k[o].sx#, k[o].ex#, 0.05 )
		k[o].sy# = CosInt( k[o].sy#, k[o].ey#, 0.05 )
		k[o].sz# = CosInt( k[o].sz#, k[o].ez#, 0.05 )
		SetObjectPosition( o, k[o].sx#, k[o].sy#, k[o].sz# )
		SetObjectRotation( o, k[o].sx# * 0.3, k[o].sy# * 0.3, k[o].sz# * 0.3 )  
		DrawObject( o )
	next o
endfunction
function createShader()
file = OpenToWrite("Anaglyph.vs")
WriteLine(file,"attribute vec3 position;")
WriteLine(file,"attribute mediump vec3 normal;")
WriteLine(file,"varying vec2 uvVarying;")
WriteLine(file,"varying highp vec3 posVarying;")
WriteLine(file,"varying mediump vec3 lightVarying;")
WriteLine(file,"uniform vec4 uvBounds0;")
WriteLine(file,"uniform float agk_invert;")
WriteLine(file,"uniform highp mat3 agk_WorldNormal;")
WriteLine(file,"uniform highp mat4 agk_World;")
WriteLine(file,"mediump vec3 GetVSLighting( mediump vec3 normal, highp vec3 pos );")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file,"gl_Position = vec4(position.xy * vec2(1, agk_invert), 0.5, 1.0);")
WriteLine(file,"uvVarying = (position.xy * vec2(0.5, -0.5) + 0.5) * uvBounds0.xy + uvBounds0.zw;") 
WriteLine(file,"mediump vec3 norm = normalize(agk_WorldNormal * normal);")
WriteLine(file,"highp vec4 pos = agk_World * vec4(position,1.0);")
WriteLine(file,"posVarying = pos.xyz;")
WriteLine(file,"lightVarying = GetVSLighting( norm, posVarying );")
WriteLine(file,"}")
CloseFile(file)


file = OpenToWrite("Anaglyph.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 mediump vec4 agk_MeshDiffuse;")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file,"mediump vec3 norm = normalize(normalVarying);")
WriteLine(file,"mediump vec3 light = lightVarying + GetPSLighting( norm, posVarying );")
WriteLine(file,"vec3 LColor = texture2D(texture0, uvVarying).xyz*light;")
WriteLine(file,"vec3 RColor = texture2D(texture1, uvVarying).xyz*light;") 
WriteLine(file,"vec3 Color;") 
WriteLine(file,"Color.r = 0.299 * LColor.r + 0.587 * LColor.g + 0.114 * LColor.b;")
WriteLine(file,"Color.g = RColor.g;")
WriteLine(file,"Color.b = RColor.b;")
WriteLine(file,"Color = clamp(Color,0.0,1.0);") //restricts color range
WriteLine(file,"Color = ApplyFog(Color, posVarying );")
WriteLine(file,"gl_FragColor = vec4(Color,1.0)* agk_MeshDiffuse;")
WriteLine(file,"}")
CloseFile(file)
endfunction
Posted: 17th May 2018 19:11
I don't like being the bearer of bad messages but your changes to the shader won't do anything for the box,sphere and other actual objects.
The shader is applied to the quad object which is like a temporary object just for the fullscreen shader which jukuma uses to mix the red and blue color from the two camera positions.
This should work with lighting and fog without any changes
Posted: 17th May 2018 22:36
Thanks Janbo for some reason I thought it may change the default shader for the other objects
but silly me ofcourse it only changes the one shader crazy I know.

I just got so caught up with the fact the shader didn't account for light fog and shadows I didn't
stop and think did it need them. Ohwell it was a task to do and I made the adjustments and it still
worked so it might help with other shaders I want to modify to account for these factors.
Posted: 18th May 2018 0:32
Just for clarify, I love your work but,

Of course its not impossible but also not trivial.


Monhs ago I sent to you this link, and did a post with my own suggestion, but I'm trying to get feedback for the community .

Maybe with some support it can be done by myself.

Water is not just a ripple effect, just remind that. As I said in the past the water effects deserve his own pack/s in the most part of the 3d engines.
Posted: 18th May 2018 0:34
The support may start maybe being positive
Posted: 18th May 2018 12:38
Monhs ago I sent to you this link

Yes you did, and I looked over it but I guess I wasn't ready for this at the time and had to many other things needing my attention.
Now I temporarily implemented it in the current water shader just to see how things go.
So, I want to give you this feature but am not sure how to split the water shader up.
I don't just want another copy of the Water shader but with the caustics feature, I want differences...
best would be if I can make a water shader aiming for weak devices and one with all features aiming at fast mobiles and PC.
I feel like the current water shader is to demanding for some mobile devices so thats something I want to address too.

Water needs distortion thats for sure... so it would go into the shader for weaker devices.
I also think screen space reflection isn't too demanding, so thats in too.
Now I could make a third shader which is using vertex displacement for ocean waves plus caustics.
just thinking out loud: I now get the impression I should leave the current shader as is for pool and lakes as there isn't much need for caustics then make another one for oceans and one for mobile ?
Is that what you wanted ?
Posted: 18th May 2018 13:09
The current water shader is awesome. It's nothing related with the ShaderPack, I'm using your watter effect and is enough for me, so I love and recommend this pack. Because is the best to polish our games.

Your work around shaders is excellent , so any opinion from you is always valuable for me. What I learned of shaders was on this thread and learning from your threads and ShaderPack, both opened my mind about glsl

Is that what you wanted ?


Yourself said it's needs different shaders, it remembers me what I was saying.

As I said in the past, the water effects deserve his own pack/s in the most part of the 3d engines.


So just give thanks all the contributors, specially that pack from janbo which is the best reference for me.

I won't nothing just post some feedback.
Posted: 18th May 2018 13:11
About the time, Your time is Yours and just I could say thanks for the big effort
Posted: 18th May 2018 18:30
Alright then I'll try my best.
Today I played with gerstner waves to distort the terrain mesh. Works good except of some culling problems, but I'll get there...
If you have some more questions, please ask away
Posted: 18th May 2018 20:36
Today I played with gerstner waves to distort the terrain mesh.

Curious how that works out as i tried a parabola effect with memblocks but when i tried to animate it the frame rates went out the window
+ Code Snippet
// Project: Parabola
// Created: 2018-04-06

// show all errors
SetErrorMode(2)
#constant screenWidth=1024
#constant screenHeight=768
#constant mapX=1024
#constant mapY=50
#constant mapZ=512

  
SetWindowSize(screenWidth,screenHeight,0)
Setvirtualresolution(screenWidth,screenHeight)
SetScissor(0,0,0,0)
SetCameraRange( 1, 0.1, 900000 )
SetGlobal3DDepth(10000)


type _heights
	meshposition
	height
    PointX
    PointZ
endtype

rem for sine cosine calculations
#constant centreX=5
#constant yPosition=1
#constant amplitude=150
//#constant speedX#=.1251
#constant WaveWidth=10
#constant frequency#=15



global TerrainImageID
global TerrainObjectID

TerrainImageID=createtexture(32,32, makecolor(0,200,0),155)
Image1=createtexture(512,512, makecolor(200,200,200),5)
//Image1=createtexture(512,512, makecolor(200,200,200),255) //creates like a grass over terrain

saveImage(image1,"height.png")
DeleteImage(image1):rem DeleteObject(mem)
 
// create the terrain object from a height map
TerrainObjectID=CreateObjectFromHeightMap( "height.png", mapX,mapY, mapZ, 0, 0 )
//TerrainObjectID=CreateObjectBox(mapX,1,mapZ)

SetObjectCollisionMode( TerrainObjectID, 1 ) //On needed for object raycasting
SetObjectImage( TerrainObjectID, TerrainImageID, 0 )
SetObjectTransparency(TerrainObjectID,0)
TerrainMemblock= CreateMemblockFromObjectMesh(TerrainObjectID,1)

rem num=mapX*126
maxIndices=GetMemblockInt(terrainMemblock,0)
maxX=(SQRT(maxIndices))
Dim heights[maxIndices] as _heights
meshposition=0:num=0:pointX=0:pointZ=0
for num = 0 to maxIndices //max vertices
        pointX=pointX+1
        if pointX>maxX 
			pointX=1
			pointZ=PointZ+1
		endif
        // add to array
        heights[num].height=1
        heights[num].meshposition=meshposition
		heights[num].PointX=pointX   
        heights[num].PointZ=pointZ    
        
        inc meshposition
next num



//setupArray()  
//SetCameraRange(1,1,2000 ) 
SetCameraPosition(1, 805, 378, -41)
  
steps = -1  
do
    checkCameraMovement()
      
    pointerState=GetRawMouseLeftState() 
	if GetRawMouseRightPressed()
		for i = 0 to maxIndices-1 //max vertices -1
			xWave#=Cos(heights[i].PointX)*(wavewidth/2)+centreX:xWave2#=Cos(heights[i].PointZ)*(wavewidth/2)+centreX
			yWave#=Sin(xWave#*frequency#)*(amplitude)+yposition:yWave2#=Sin(xWave2#*frequency#)*(amplitude)+yposition			
			SetMeshMemblockVertexPosition(TerrainMemblock,heights[i].meshposition,GetMeshMemblockVertexX(TerrainMemblock,i),GetMeshMemblockVertexY(TerrainMemblock,i)+(yWave#+ywave2#),GetMeshMemblockVertexZ(TerrainMemblock,i))
			rem used for the animation
			heights[i].pointX=heights[i].pointX+1
			if heights[i].pointX>maxX 
				heights[i].pointX=1
			endif
		next
		SetObjectMeshFromMemblock(TerrainObjectID,1,TerrainMemblock)         
	endif
    //endif
    // show some information
    Print( "FPS: " + str(ScreenFPS(),1) )
    Print( "Polygons: " + str(GetPolygonsDrawn()))
    print("vertices="+str(GetMemblockInt(terrainMemblock,0)))
    print("Arrows move camera")
    print("Click right mouse to apply sine curve")
    sync()
      
loop


function checkCameraMovement()
  
if GetRawKeyState(37) then MoveCameraLocalX(1,-5) //Left
if GetRawKeyState(39) then MoveCameraLocalX(1,5) //Right
if GetRawKeyState(38) then MoveCameraLocalZ(1,5) //Forward
if GetRawKeyState(40) then MoveCameraLocalZ(1,-5) //Backward
if GetRawKeyState(87) then MoveCameraLocalY(1,-5) //87 W
if GetRawKeyState(83) then MoveCameraLocalY(1,5) //87 S
if GetRawKeyState(65) then RotateCameraLocalY(1,1)
if GetRawKeyState(68) then RotateCameraLocalY(1,-1)
  
// if cameray#<(blocksizey*10) then cameray#=(blocksizey*10)
if GetRawKeyPressed(27) then end

endfunction
  
  

  
function resetTerrain (msblk as integer) 
  
    count = GetMemblockInt( msblk ,0 )
    for i = 0 to count  
        SetMeshMemblockVertexPosition(msblk,i,GetMeshMemblockVertexX(msblk,i),0,GetMeshMemblockVertexZ(msblk,i)) //make it flat
    next
    SetObjectMeshFromMemblock(TerrainObjectID,1,msblk)
Endfunction

// 102, 51, 0
// Function to create a texture
//
// Inputs - Sizex - size of the texture to create - width
//          Sizey - size of the texture to create - height
//          Color - is the main color of the image
//          Denisity - is a the depth of the texture - the lower the value, the more detail. higher value = no detail
// 
// Returns the image for the resulting texture
//
// EG. CreateTexture ( 100, 100,  makecolor(0,0,255), 100)
//          This could create a DEEP water effect texture?
    
function createtexture(sizex# as float, sizey# as float, color, density as integer)
    swap()
    drawbox(0,0,sizex#, sizey#, color, color,color,color, 1)
    render()
    img = getimage(0,0,sizex#, sizey#)
        
    memblockid = CreateMemblockFromImage (img)
    imgwidth = GetMemblockInt(memblockid, 0)
    imgheight = GetMemblockInt(memblockid, 4)
        
    size=GetMemblockSize(memblockid)
    for offset=12 to size-4 step 4
          
        r=GetMemblockByte(memblockid, offset)
        g=GetMemblockByte(memblockid, offset+1)
        b=GetMemblockByte(memblockid, offset+2)
        a=GetMemblockByte(memblockid, offset+3)
                
            
        strength=random(1,density)
    
        SetMemblockByte (memblockid, offset, r-strength)
        SetMemblockByte (memblockid, offset+1, g-strength)
        SetMemblockByte (memblockid, offset+2, b-strength )
        SetMemblockByte (memblockid, offset+3, a-strength)
    next
    deleteimage (img)
    img = CreateImageFromMemblock(memblockid)
    DeleteMemblock(memblockid)
endfunction img
Posted: 21st May 2018 21:25
Well as its a visual effect only and I don't need the mesh to react to something, I can easily distort the vertices in the vertex shader.
Basically its a bunch of sinus curves layed over each other.
Posted: 30th Jun 2018 19:02
Using Pixel or Fragment Shaders
https://steamcommunity.com/sharedfiles/filedetails/?id=370165947

I converted that pixel shader to show on a 3D Plane that part works
+ Code Snippet
#constant screenWidth=1024
#constant screenHeight=768

SetWindowSize(screenWidth,screenHeight,0)
Setvirtualresolution(screenWidth,screenHeight)
// set variables for camera's starting position
pos_x# = 0
pos_y# = 50
pos_z# = 0
// orientate camera
SetCameraRotation(1,30,0,0)
SetCameraPosition(1,pos_x#,pos_y#,pos_z#)
CreateObjectPlane(2,500,500)
SetObjectRotation(2,90,0,0)
SetObjectPosition(2,0,-17,250)

createShader()
Shader=LoadShader( "Kaliset.vs","Kaliset.ps" )
SetObjectShader(2,Shader)
SetShaderConstantByName( Shader,"iResolution",500,500,0,0 )
do

    SetShaderConstantByName( Shader,"iGlobalTime",Timer()*.5,0,0,0 ) `tell the shader what time it is - so it can update its animations
    print(ScreenFPS())
    sync()
loop
function createShader()
if GetFileExists("Kaliset.vs") then DeleteFile("Kaliset.vs")		
file = OpenToWrite("Kaliset.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 vec3 iResolution; // viewport resolution (in pixels)")
WriteLine(file,"uniform float iGlobalTime; // shader playback time (in seconds)")
WriteLine(file,"uniform float iChannelTime[10]; // channel playback time (in seconds)")
WriteLine(file,"uniform vec3 iChannelResolution[10]; // channel resolution (in pixels)")
WriteLine(file,"//uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down)")
WriteLine(file,"uniform sampler2D texture0; // input channel")
WriteLine(file,"uniform vec4 iDate; // (year, month, day, time in seconds)")
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)

if GetFileExists("Kaliset.ps") then DeleteFile("Kaliset.ps")	
file = OpenToWrite("Kaliset.ps")
WriteLine(file,"uniform vec3 iResolution; // viewport resolution (in pixels)")
WriteLine(file,"uniform float iGlobalTime; // shader playback time (in seconds)")
WriteLine(file,"uniform float iChannelTime[10]; // channel playback time (in seconds)")
WriteLine(file,"")
WriteLine(file,"//uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down)")
WriteLine(file,"uniform sampler2D texture0; // input channel ")
WriteLine(file,"uniform sampler2D texture1; // input channel ")
WriteLine(file,"uniform vec4 iDate; // (year, month, day, time in seconds)")
WriteLine(file,"varying mediump vec2 uvVarying;")
WriteLine(file,"const int iterations=12;")
WriteLine(file,"void main(void)")
WriteLine(file,"{")
WriteLine(file,"//this takes the pixel we are working with to determine where it is on the screen")
//WriteLine(file,"vec2 z = gl_FragCoord.xy/iResolution.xy;")
WriteLine(file,"vec2 z = uvVarying;")
WriteLine(file,"//fixes aspect ratio in favor of symmety. comment it and see what it looks like")
WriteLine(file,"//z.y*=iResolution.y/iResolution.x;")
WriteLine(file,"//gloobywavez")
WriteLine(file,"z.x += sin(z.y*2.0+iGlobalTime * .2)/10.0;")
WriteLine(file,"//zooom")
WriteLine(file,"//z*= 1.2 + sin(iGlobalTime*.15);")
WriteLine(file,"//pan")
WriteLine(file,"//z+=vec2(sin(iGlobalTime*.2),cos(iGlobalTime*.01));")
WriteLine(file,"//rotate")
WriteLine(file,"//z=vec2(z.x*cos(iGlobalTime*.2)- z.y*sin(iGlobalTime*.2),z.y*cos(iGlobalTime*.2));")
WriteLine(file,"vec2 c=vec2(0.5, 1.1);")
WriteLine(file,"")
WriteLine(file,"float average=0.;")
WriteLine(file,"float l=length(z);")
WriteLine(file,"float prevl;")
WriteLine(file,"for (int i=0; i<iterations; i++)")
WriteLine(file,"{")
WriteLine(file,"//kaliset base form")
WriteLine(file,"z=abs(z)/dot(z,z) -c;")
WriteLine(file,"//this is another function that can be iterated to produce some different fractals")
WriteLine(file,"//comment out the previous kaliset and experiment with values with this one!!")
WriteLine(file,"//z = abs(z)/(z.x*z.y)-c;")
WriteLine(file,"prevl=l;")
WriteLine(file,"l=length(z);")
WriteLine(file,"average+=abs(l-prevl);")
WriteLine(file,"}")
WriteLine(file,"//get the average length based upon the amount of iterations elapsed. multiply it to adjust definition")
WriteLine(file,"average/=float(iterations) * 15.;")
WriteLine(file,"//color fluctuation")
WriteLine(file,"average+=iGlobalTime*0.08;")
WriteLine(file,"vec3 myColor=vec3(0.2,0.21,.62);")
WriteLine(file,"vec3 finalColor;")
WriteLine(file,"//set the colors!")
WriteLine(file,"finalColor.r = (fract(float(average)/myColor.r));")
WriteLine(file,"finalColor.g = (fract(float(average)/myColor.g));")
WriteLine(file,"finalColor.b = (fract(float(average)/myColor.b));")
WriteLine(file,"//vec4 colorResult0  = vec4(finalColor,1.0);")
WriteLine(file,"//vec4 colorResult1  = texture2D(texture1, z);") 
WriteLine(file,"gl_FragColor = vec4(finalColor,1.0);")
WriteLine(file,"//gl_FragColor = mix(colorResult0, colorResult1, colorResult1.a);")
WriteLine(file,"}") 
CloseFile(file)
endfunction

It needs tidying up but what I want to do is use that so as it uses two textures and only modifies the alpha bits
I have tried using the mix command to mix the textures but that doesn't seem to want to work. I have commented
out the way I thought mix color would have to work.

the plan is to have texture 1 created like
+ Code Snippet
function createEllipse()
	rem create an ellipse that can be used as a sprite and returns the value of the image
	rem this was only used in early versions
	SetClearColor(0,0,0)
	ClearScreen()
    Render()
    DrawBox(0,0,100,100,MakeColor(255,255,255),MakeColor(255,255,255),MakeColor(255,255,255),MakeColor(255,255,255),1)
    DrawEllipse(50,50,25,25,MakeColor(0,0,0),MakeColor(0,0,0),1)
    Swap()
    img = getimage(0,0,100,100)
    sync()
endfunction img

And use it like its some sort of lava pool