[Orxonox-commit 7485] r12091 - in data/branches/Shader_HS18: . materials programs/Example programs/Example/GLSL programs/Example/GLSL120 programs/Example/GLSL150 programs/Example/GLSL400 programs/Example/GLSLES

wiesep at orxonox.net wiesep at orxonox.net
Fri Nov 9 13:06:06 CET 2018


Author: wiesep
Date: 2018-11-09 13:06:05 +0100 (Fri, 09 Nov 2018)
New Revision: 12091

Added:
   data/branches/Shader_HS18/programs/Example/GLSL120/
   data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTexture.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTextureWithUV.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Bloom2_ps20.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/BlurH_ps20.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/BlurV_ps20.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Blur_vs.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/BrightBloom2_ps20.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/BumpMapVPTangentParity.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/DiffuseOneTexture.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_ShadowCaster.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhase.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhaseShadowCaster.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayPS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayVS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/GlassFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/GrayScale.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/HWBasicInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/HW_VTFInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/Instancing.frag
   data/branches/Shader_HS18/programs/Example/GLSL120/InstancingMisc.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.frag
   data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMapping_specular.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughVP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/ShaderInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/ShowNormals.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/ShowTangents.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/ShowUV.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/ShowUVdir3D.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2a_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex3_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex4_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/VTFInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/hdr_tonemap_util.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.frag
   data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.vert
   data/branches/Shader_HS18/programs/Example/GLSL120/shadows.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsShadowCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/AtomicFS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/AtomicGS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/AtomicVS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfFS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfGS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfVS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayFS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/PassthroughGP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/
   data/branches/Shader_HS18/programs/Example/GLSL400/ComputeCS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/RasterizationOrderFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/TessellationFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTd.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTh.glsl
   data/branches/Shader_HS18/programs/Example/GLSL400/TessellationVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSLES/
   data/branches/Shader_HS18/programs/Example/GLSLES/ASCIIFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTexture.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTextureWithUV.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Bloom2_ps20.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/BlurH_ps20.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/BlurV_ps20.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Blur_vs.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/BrightBloom2_ps20.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/BumpMapVPTangentParity.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Combine_fp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DOF_ps.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DiffuseOneTexture.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/DitherFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/EmbossedFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayPS.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayVS.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GlassFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassTexVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrassVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/GrayScale.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HWBasicInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/HW_VTFInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/HalftoneFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationWithNormalsVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationWithNormalsVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Instancing.frag
   data/branches/Shader_HS18/programs/Example/GLSLES/InstancingMisc.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/InvertFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/LaplaceFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/NightVisionFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.frag
   data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMapping_specular.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OldMovieFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/OldTV.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughVP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/PosterizeFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/Radial_Blur_FP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ShaderInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/SharpenEdgesFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ShowNormals.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ShowTangents.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ShowUV.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/ShowUVdir3D.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2_vp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2a_vp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex3_vp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex4_vp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_vp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/SwizzleGP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/TilingFP.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/VTFInstancing.vert
   data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdrFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdr_bloom.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale2x2luminence.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3brightpass.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/hdr_finalToneMapping.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/instancingVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_quad.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_scene.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverFp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/pssmVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/shadows.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsShadowCasterVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsVp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcasterfp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcastervp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceiverfp.glsles
   data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceivervp.glsles
Modified:
   data/branches/Shader_HS18/materials/Cube_Lava_Normal.material
   data/branches/Shader_HS18/materials/ToonShader.material
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/StdQuad_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/SwizzleGP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/hdr_bloom.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale2x2luminence.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3brightpass.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/hdr_finalToneMapping.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/instancingVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_quad.glsl
   data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_scene.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ASCIIFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Blur0_vs.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Blur1_vs.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Blur_ps.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Combine_fp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/DitherFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/EmbossedFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassTexVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/GrassVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HalftoneFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationWithNormalsVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HeatBlurFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/InvertFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/LaplaceFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/LightToHeatFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/NightVisionFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/OldMovieFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/OldTV.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayGS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateGS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateVS.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/PosterizeFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/Radial_Blur_FP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/SharpenEdgesFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/StdQuad_vp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/SwizzleGP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/TilingFP.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/hdr_bloom.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale2x2luminence.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3brightpass.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/hdr_finalToneMapping.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/instancingVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_quad.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_scene.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterVp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverFp.glsl
   data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverVp.glsl
   data/branches/Shader_HS18/resources.oxr
Log:
Updated programs and adjusted Material to work with GLSL>150

Modified: data/branches/Shader_HS18/materials/Cube_Lava_Normal.material
===================================================================
--- data/branches/Shader_HS18/materials/Cube_Lava_Normal.material	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/materials/Cube_Lava_Normal.material	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,441 +1,6 @@
-//------------------------
-// Basic
-//------------------------
-
-//---------------------------------------------------
-// This file includes a number of basic GPU programs
-// for use in many materials.
-//---------------------------------------------------
-
-
-// A really basic ambient pass program, support for one texture coordinate set
-vertex_program AmbientOneTextureCg cg
-{
-    source Example_Basic.cg
-    entry_point ambientOneTexture_vp
-    profiles vs_1_1 arbvp1
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-
-}
-
-vertex_program AmbientOneTextureCgSm4 cg
-{
-    source Example_Basic_sm4.cg
-    entry_point ambientOneTexture_vp
-    profiles vs_4_0
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-vertex_program AmbientOneTextureHLSL hlsl
-{
-    source Example_Basic.hlsl
-    entry_point ambientOneTexture_vp
-    target vs_4_0
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-}
-// A really basic ambient pass program, support for one texture coordinate set
-vertex_program AmbientOneTextureGLSL glsl
-{
-    source AmbientOneTexture.glsl
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-vertex_program AmbientOneTextureGLSL glsl
-{
-    source AmbientOneTexture.glsl
-    
-
-    default_params
-    {
-        param_named_auto ambient ambient_light_colour
-        param_named_auto worldViewProj worldviewproj_matrix
-    }
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-vertex_program AmbientOneTextureGLSLES glsles
-{
-    source AmbientOneTexture.glsles
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-}
-
-vertex_program AmbientOneTextureWithUVGLSLES glsles
-{
-    source AmbientOneTextureWithUV.glsles
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-}
-
-vertex_program AmbientOneTextureWithUVGLSL glsl
-{
-    source AmbientOneTextureWithUV.glsl
-    
-
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-        param_named_auto ambient ambient_light_colour
-    }
-}
-
-vertex_program AmbientOneTextureWithUV unified
-{
-    delegate AmbientOneTextureWithUVGLSL
-    delegate AmbientOneTextureWithUVGLSLES
-    delegate AmbientOneTextureHLSL
-    delegate AmbientOneTextureCg
-    delegate AmbientOneTextureCgSm4
-}
-
-vertex_program AmbientOneTextureUnified unified
-{
-    delegate AmbientOneTextureGLSL
-    delegate AmbientOneTextureGLSLES
-    delegate AmbientOneTextureHLSL
-    delegate AmbientOneTextureCg
-    delegate AmbientOneTextureCgSm4
-}
-
-fragment_program DiffuseOneTextureCg cg
-{
-    source Example_Basic.cg
-    entry_point diffuseOneTexture_fp
-    profiles ps_2_0 arbfp1
-}
-
-fragment_program DiffuseOneTextureGLSLES glsles
-{
-    source DiffuseOneTexture.glsles
-    default_params
-    {
-        param_named texMap int 0
-    }
-}
-
-fragment_program DiffuseOneTextureGLSL glsl
-{
-    source DiffuseOneTexture.glsl
-    default_params
-    {
-        param_named texMap int 0
-    }
-}
-
-fragment_program DiffuseOneTexture unified
-{
-    delegate DiffuseOneTextureGLSL
-    delegate DiffuseOneTextureGLSLES
-    delegate DiffuseOneTextureCg
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-fragment_program PassthroughFP unified
-{
-    delegate PassthroughFpGLSL
-    delegate PassthroughFpGLSLES
-    delegate PassthroughFpCgSm4
-    delegate PassthroughFpCg
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-fragment_program PassthroughFpCgSm4 cg
-{
-    entry_point main
-    source PassthroughFP_sm4.cg
-    profiles ps_4_0
-}
-
-fragment_program PassthroughFpCg cg
-{
-    entry_point mainCg
-    source PassthroughFP.cg
-    profiles ps_2_0 arbfp1
-}
-
-// A really basic ambient pass program, support for one texture coordinate set
-fragment_program PassthroughFpCgSm4ForAmbientOneTexture cg
-{
-    entry_point mainForAmbientOneTexture
-    source PassthroughFP_sm4.cg
-    profiles ps_4_0
-}
-
-
-// A really basic ambient pass program, support for one texture coordinate set
-fragment_program PassthroughFpGLSLES glsles
-{
-    source PassthroughFP.glsles
-}
-
-fragment_program PassthroughFpGLSL glsl
-{
-    source PassthroughFP.glsl
-}
-
-//------------------------
-// Bump mapping section
-//------------------------
-
-// Bump map vertex program, support for this is required
-vertex_program Lava/BumpMapVPCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point main_vp
-    profiles vs_4_0 vs_1_1 arbvp1
-}
-
-vertex_program Lava/BumpMapVPGLSLES glsles
-{
-    source Example_BumpMappingVp.glsles
-    profiles glsles
-}
-
-vertex_program Lava/BumpMapVPGLSL glsl
-{
-    source Example_BumpMappingVp.glsl
-}
-
-vertex_program Lava/BumpMapVP unified
-{
-    delegate Lava/BumpMapVPGLSL
-    delegate Lava/BumpMapVPGLSLES
-    delegate Lava/BumpMapVPCg
-}
-
-// Bump map vertex program, with tangent parity support for this is required
-vertex_program Lava/BumpMapVPTangentParityCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point main_vp
-    profiles vs_1_1 arbvp1
-    compile_arguments -DTANGENTS_HAVE_PARITY=1
-}
-
-// Bump map vertex program, with tangent parity support for this is required
-vertex_program Lava/BumpMapVPTangentParityGLSLES glsles
-{
-    source BumpMapVPTangentParity.glsles
-}
-
-vertex_program Lava/BumpMapVPTangentParityGLSL glsl
-{
-    source BumpMapVPTangentParity.glsl
-    default_params
-    {
-        param_named_auto lightDiffuse light_diffuse_colour 0 
-    }
-}
-
-vertex_program Lava/BumpMapVPTangentParity unified
-{
-    delegate Lava/BumpMapVPTangentParityGLSL
-    delegate Lava/BumpMapVPTangentParityGLSLES
-    delegate Lava/BumpMapVPTangentParityCg
-}
-
-// Bump map fragment program, support for this is optional
-fragment_program Lava/BumpMapFPCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point main_fp
-    profiles ps_4_0 ps_2_0 arbfp1 fp20
-}
-
-fragment_program Lava/BumpMapFPGLSLES glsles
-{
-    source Example_BumpMappingFp.glsles
-    profiles glsles
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named normalMap int 0
-    }
-}
-
-fragment_program Lava/BumpMapFPGLSL glsl
-{
-    source Example_BumpMappingFp.glsl
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named normalMap int 0
-    }
-}
-
-fragment_program Lava/BumpMapFP unified
-{
-    delegate Lava/BumpMapFPGLSL
-    delegate Lava/BumpMapFPGLSLES
-    delegate Lava/BumpMapFPCg
-}
-
-// Bump map vertex program shadow receiver
-vertex_program Lava/BumpMapVPShadowRcvCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point main_shadowreceiver_vp
-    profiles vs_1_1 arbvp1
-}
-
-// Bump map vertex program shadow receiver
-vertex_program Lava/BumpMapVPShadowRcvGLSLES glsles
-{
-    source Example_BumpMappingShadowRcvVp.glsles
-    profiles glsles
-}
-
-vertex_program Lava/BumpMapVPShadowRcvGLSL glsl
-{
-    source Example_BumpMappingShadowRcvVp.glsl
-
-}
-
-vertex_program Lava/BumpMapVPShadowRcv unified
-{
-    delegate Lava/BumpMapVPShadowRcvGLSL
-    delegate Lava/BumpMapVPShadowRcvGLSLES
-    delegate Lava/BumpMapVPShadowRcvCg
-}
-
-// Bump map fragment program shadow receiver, support for this is optional
-fragment_program Lava/BumpMapFPShadowRcvCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point main_shadowreceiver_fp
-    profiles ps_2_0 arbfp1 fp20
-}
-
-// Bump map fragment program shadow receiver, support for this is optional
-fragment_program Lava/BumpMapFPShadowRcvGLSLES glsles
-{
-    source Example_BumpMappingShadowRcvFp.glsles
-    profiles glsles
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named shadowMap int 0
-        param_named normalMap int 1
-    }
-}
-
-fragment_program Lava/BumpMapFPShadowRcvGLSL glsl
-{
-    source Example_BumpMappingShadowRcvFp.glsl
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named shadowMap int 0
-        param_named normalMap int 1
-    }
-}
-
-fragment_program Lava/BumpMapFPShadowRcv unified
-{
-    delegate Lava/BumpMapFPShadowRcvGLSL
-    delegate Lava/BumpMapFPShadowRcvGLSLES
-    delegate Lava/BumpMapFPShadowRcvCg
-}
-
-// Bump map with specular vertex program, support for this is required
-vertex_program Lava/BumpMapVPSpecularCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point specular_vp
-    profiles vs_4_0 vs_1_1 arbvp1
-}
-
-// Bump map with specular vertex program, support for this is required
-vertex_program Lava/BumpMapVPSpecularGLSLES glsles
-{
-    source Example_BumpMappingSpecularVp.glsles
-    profiles glsles
-}
-
-vertex_program Lava/BumpMapVPSpecularGLSL glsl
-{
-    source Example_BumpMappingSpecularVp.glsl
-}
-
-vertex_program Lava/BumpMapVPSpecular unified
-{
-    delegate Lava/BumpMapVPSpecularGLSL
-    delegate Lava/BumpMapVPSpecularGLSLES
-    delegate Lava/BumpMapVPSpecularCg
-}
-
-// Bump map fragment program, support for this is optional
-fragment_program Lava/BumpMapFPSpecularCg cg
-{
-    source Example_BumpMapping.cg
-    entry_point specular_fp
-    profiles ps_4_0 ps_2_0 arbfp1 fp20
-}
-
-// Bump map fragment program, support for this is optional
-fragment_program Lava/BumpMapFPSpecularGLSLES glsles
-{
-    source Example_BumpMappingSpecularFp.glsles
-    profiles glsles
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named normalMap int 0
-    }
-}
-
-fragment_program Lava/BumpMapFPSpecularGLSL glsl
-{
-    source Example_BumpMappingSpecularFp.glsl
-    default_params
-    {
-        // assign samplers as required by GLSL
-        param_named normalMap int 0
-    }
-}
-
-fragment_program Lava/BumpMapFPSpecular unified
-{
-    delegate Lava/BumpMapFPSpecularGLSL
-    delegate Lava/BumpMapFPSpecularGLSLES
-    delegate Lava/BumpMapFPSpecularCg
-}
-
-//------------------------
-// Material
-//------------------------
-
 // Any number of lights, diffuse
 material Cube_Lava_Normal
 {
-
-    // This is the preferred technique which uses both vertex and
-    // fragment programs, supports coloured lights
     technique
     {
         // Base ambient pass
@@ -443,38 +8,22 @@
         {
             // base colours, not needed for rendering, but as information
             // to lighting pass categorisation routine
-            ambient 1 1 1
-            diffuse 0 0 0 
-            specular 0 0 0 0 
-            // Really basic vertex program
-            // NB we don't use fixed function here because GL does not like
-            // mixing fixed function and vertex programs, depth fighting can
-            // be an issue
-            vertex_program_ref AmbientOneTextureUnified
-            {
-                param_named_auto ambient ambient_light_colour
-            }
-            fragment_program_ref PassthroughFP
-            {
-            }
-            
+            diffuse 0 0 0
         }
         // Now do the lighting pass
         // NB we don't do decal texture here because this is repeated per light
         pass perlight
         {
-            // base colours, not needed for rendering, but as information
-            // to lighting pass categorisation routine
-            ambient 0 0 0 
-            
             // do this for each light
             iteration once_per_light
-
-        
             scene_blend add
 
+            // base colours, not needed for rendering, but as information
+            // to lighting pass categorisation routine
+            ambient 0 0 0
+
             // Vertex program reference
-            vertex_program_ref Lava/BumpMapVP
+            vertex_program_ref Examples/BumpMapVP
             {
                 param_named_auto lightPosition light_position_object_space 0
                 param_named_auto worldViewProj worldviewproj_matrix
@@ -481,13 +30,13 @@
             }
 
             // Fragment program
-            fragment_program_ref Lava/BumpMapFP
+            fragment_program_ref Examples/BumpMapFP
             {
                 param_named_auto lightDiffuse light_diffuse_colour 0 
             }
 
             // texture shadow receiver program
-            shadow_receiver_vertex_program_ref Lava/BumpMapVPShadowRcv
+            shadow_receiver_vertex_program_ref Examples/BumpMapVPShadowRcv
             {
                 param_named_auto lightPosition light_position_object_space 0
                 param_named_auto worldViewProj worldviewproj_matrix
@@ -495,7 +44,7 @@
                 param_named_auto texViewProj texture_viewproj_matrix
             }
             // Additive texture shadow receiver program
-            shadow_receiver_fragment_program_ref Lava/BumpMapFPShadowRcv
+            shadow_receiver_fragment_program_ref Examples/BumpMapFPShadowRcv
             {
                 param_named_auto lightDiffuse light_diffuse_colour 0 
             }
@@ -504,77 +53,17 @@
             texture_unit normalmap
             {
                 texture Cube_Lava_NORM.jpg
-                tex_address_mode wrap
-                scale 1.0 1.0
                 colour_op replace
             }
-
         }
         
         // Decal pass
         pass decal
         {
-            // base colours, not needed for rendering, but as information
-            // to lighting pass categorisation routine
+            // hint to pass categorisation routine, that this is decal only
             lighting off
-            // Really basic vertex program
-            // NB we don't use fixed function here because GL does not like
-            // mixing fixed function and vertex programs, depth fighting can
-            // be an issue
-            vertex_program_ref AmbientOneTextureUnified
-            {
-                param_named_auto worldViewProj worldviewproj_matrix
-                param_named ambient float4 1 1 1 1
-            }
-            fragment_program_ref PassthroughFP
-            {
-            }
-
             scene_blend dest_colour zero
-            texture_unit
-            {
-                texture Cube_Lava_NORM.jpg
-                tex_address_mode wrap
-                scale 1.0 1.0
-                colour_op modulate
-            }
-
-            
+            ambient 0.5 0.5 0.5 1
         }
-
-      pass Cube_Lava
-        {
-            ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0
-            diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0
-            specular 0.5 0.5 0.5 1.0 12.5
-            emissive 0.0 0.0 0.0 1.0
-
-            alpha_to_coverage off
-            colour_write on
-            cull_hardware clockwise
-            depth_check on
-            depth_func less_equal
-            depth_write on
-            illumination_stage 
-            light_clip_planes off
-            light_scissor off
-            lighting on
-            normalise_normals off
-            polygon_mode solid
-            scene_blend one zero
-            scene_blend_op add
-            shading gouraud
-            transparent_sorting on
-
-            texture_unit 
-            {
-                texture Cube_Lava_COLOR.jpg
-                tex_address_mode wrap
-                scale 1.0 1.0
-                colour_op modulate
-            }
-        }
     }
-
-
 }

Modified: data/branches/Shader_HS18/materials/ToonShader.material
===================================================================
--- data/branches/Shader_HS18/materials/ToonShader.material	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/materials/ToonShader.material	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,11 +1,11 @@
 vertex_program toonvs glsl
 {
-	source ToonShader_vs.vert
+	source ToonShader_vs.glsl
 }
 
 fragment_program Toonps glsl
 {
-	source ToonShader_ps.frag
+	source ToonShader_ps.glsl
 }
 
 

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,13 +1,13 @@
-#version 120
-
-varying vec2 depth;
-
-void main()
-{
-	float finalDepth = depth.x / depth.y;
-
-	// just smear across all components 
-	// therefore this one needs high individual channel precision
-	gl_FragColor = vec4(finalDepth, finalDepth, finalDepth, 1.0);
-}
-
+#version 120
+
+varying vec2 depth;
+
+void main()
+{
+	float finalDepth = depth.x / depth.y;
+
+	// just smear across all components 
+	// therefore this one needs high individual channel precision
+	gl_FragColor = vec4(finalDepth, finalDepth, finalDepth, 1.0);
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,18 +1,18 @@
-#version 120
-
-uniform mat4 worldViewProj;
-uniform vec4 texelOffsets;
-
-attribute vec4 vertex;
-
-varying vec2 depth;
-
-void main()
-{
-	vec4 outPos = worldViewProj * vertex;
-	outPos.xy += texelOffsets.zw * outPos.w;
-	// fix pixel / texel alignment
-	depth = outPos.zw;
-	gl_Position = outPos;
-}
-
+#version 120
+
+uniform mat4 worldViewProj;
+uniform vec4 texelOffsets;
+
+attribute vec4 vertex;
+
+varying vec2 depth;
+
+void main()
+{
+	vec4 outPos = worldViewProj * vertex;
+	outPos.xy += texelOffsets.zw * outPos.w;
+	// fix pixel / texel alignment
+	depth = outPos.zw;
+	gl_Position = outPos;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,70 +1,70 @@
-#version 120
-
-uniform float inverseShadowmapSize;
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-uniform vec4 lightColour;
-
-uniform sampler2D shadowMap;
-uniform sampler2D normalMap;
-
-varying vec3 tangentLightDir;
-varying	vec4 oUv;
-varying	vec2 oUv2;
-
-// Expand a range-compressed vector
-vec3 expand(vec3 v)
-{
-	return (v - 0.5) * 2.0;
-}
-
-void main()
-{
-
-	// get the new normal and diffuse values
-	vec3 normal = normalize(expand(texture2D(normalMap, oUv2).xyz));
-	
-	vec4 vertexColour = clamp(dot(normal, tangentLightDir),0.0,1.0) * lightColour;
-
-
-	vec4 shadowUV = oUv;
-	// point on shadowmap
-	shadowUV.xy = shadowUV.xy / shadowUV.w;
-	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
-    
-    // gradient calculation
-  	float pixeloffset = inverseShadowmapSize;
-    vec4 depths = vec4(
-    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
-
-	vec2 differences = abs( depths.yw - depths.xz );
-	float gradient = min(gradientClamp, max(differences.x, differences.y));
-	float gradientFactor = gradient * gradientScaleBias;
-
-	// visibility function
-	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
-	float finalCenterDepth = centerdepth + depthAdjust;
-
-	// shadowUV.z contains lightspace position of current object
-#if PCF
-	// use depths from prev, calculate diff
-	depths += depthAdjust;
-	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
-	
-	final *= 0.2;
-
-	gl_FragColor = vec4(vertexColour.xyz * final, 1);
-	
-#else
-	gl_FragColor = (finalCenterDepth > shadowUV.z) ? vertexColour : vec4(0,0,0,1);
-#endif
-}
-
+#version 120
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform vec4 lightColour;
+
+uniform sampler2D shadowMap;
+uniform sampler2D normalMap;
+
+varying vec3 tangentLightDir;
+varying	vec4 oUv;
+varying	vec2 oUv2;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+
+	// get the new normal and diffuse values
+	vec3 normal = normalize(expand(texture2D(normalMap, oUv2).xyz));
+	
+	vec4 vertexColour = clamp(dot(normal, tangentLightDir),0.0,1.0) * lightColour;
+
+
+	vec4 shadowUV = oUv;
+	// point on shadowmap
+	shadowUV = shadowUV / shadowUV.w;
+	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+#if PCF
+	// use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	gl_FragColor = vec4(vertexColour.xyz * final, 1);
+	
+#else
+	gl_FragColor = (finalCenterDepth > shadowUV.z) ? vertexColour : vec4(0,0,0,1);
+#endif
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapNormalMapReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,42 +1,42 @@
-#version 120
-
-uniform mat4 world;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 lightPosition; // object space
-
-attribute vec4 vertex;
-attribute vec3 normal;
-attribute vec3 tangent;
-attribute vec4 uv0;
-
-varying vec3 tangentLightDir;
-varying	vec4 oUv;
-varying	vec2 oUv2;
-
-void main()
-{
-	vec4 worldPos = world * vertex;
-
-	// Get object space light direction 
-    vec3 lightDir = normalize(lightPosition.xyz -  (vertex.xyz * lightPosition.w));
-
-	// calculate shadow map coords
-	oUv = texViewProj * worldPos;
-
-	// pass the main uvs straight through unchanged 
-	oUv2 = uv0.xy;
-
-	// Calculate the binormal (NB we assume both normal and tangent are 
-	// already normalised) 
-	vec3 binormal = cross(normal, tangent); 
-
-	// Form a rotation matrix out of the vectors 
-	mat3 rotation = mat3(tangent, binormal, normal); 
-    
-	// Transform the light vector according to this matrix 
-	tangentLightDir = normalize(rotation * lightDir); 
-	
-	gl_Position = worldViewProj * vertex;
-}
-
+#version 120
+
+uniform mat4 world;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition; // object space
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+
+varying vec3 tangentLightDir;
+varying	vec4 oUv;
+varying	vec2 oUv2;
+
+void main()
+{
+	vec4 worldPos = world * vertex;
+
+	// Get object space light direction 
+    vec3 lightDir = normalize(lightPosition.xyz -  (vertex.xyz * lightPosition.w));
+
+	// calculate shadow map coords
+	oUv = texViewProj * worldPos;
+
+	// pass the main uvs straight through unchanged 
+	oUv2 = uv0.xy;
+
+	// Calculate the binormal (NB we assume both normal and tangent are 
+	// already normalised) 
+	vec3 binormal = cross(normal, tangent); 
+
+	// Form a rotation matrix out of the vectors 
+	mat3 rotation = mat3(tangent, binormal, normal); 
+    
+	// Transform the light vector according to this matrix 
+	tangentLightDir = normalize(rotation * lightDir); 
+	
+	gl_Position = worldViewProj * vertex;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,54 +1,54 @@
-#version 120
-
-uniform float inverseShadowmapSize;
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-
-uniform sampler2D shadowMap;
-
-varying	vec4 oUv;
-varying	vec4 outColor;
-
-void main()
-{
-	vec4 shadowUV = oUv;
-	// point on shadowmap
-	shadowUV.xy = shadowUV.xy / shadowUV.w;
-	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
-    
-    // gradient calculation
-  	float pixeloffset = inverseShadowmapSize;
-    vec4 depths = vec4(
-    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
-    	texture2D(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
-
-	vec2 differences = abs( depths.yw - depths.xz );
-	float gradient = min(gradientClamp, max(differences.x, differences.y));
-	float gradientFactor = gradient * gradientScaleBias;
-
-	// visibility function
-	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
-	float finalCenterDepth = centerdepth + depthAdjust;
-
-	// shadowUV.z contains lightspace position of current object
-#if PCF
-	// use depths from prev, calculate diff
-	depths += depthAdjust;
-	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
-	
-	final *= 0.2;
-
-	gl_FragColor = vec4(outColor.xyz * final, 1);
-	
-#else
-	gl_FragColor = (centerdepth > shadowUV.z) ? vec4(outColor.xyz,1) : vec4(0,0,0,1);
-#endif
-}
-
+#version 120
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+
+uniform sampler2D shadowMap;
+
+varying	vec4 oUv;
+varying	vec4 outColor;
+
+void main()
+{
+	vec4 shadowUV = oUv;
+	// point on shadowmap
+	shadowUV = shadowUV / shadowUV.w;
+	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+#if PCF
+	// use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	gl_FragColor = vec4(outColor.xyz * final, 1);
+	
+#else
+	gl_FragColor = (centerdepth > shadowUV.z) ? vec4(outColor.xyz,1) : vec4(0,0,0,1);
+#endif
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/DepthShadowmapReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,33 +1,33 @@
-#version 120
-
-uniform mat4 world;
-uniform mat4 worldIT;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 lightPosition;
-uniform vec4 lightColour;
-
-attribute vec4 vertex;
-attribute vec3 normal;
-
-varying	vec4 oUv;
-varying	vec4 outColor;
-
-void main()
-{
-	gl_Position = worldViewProj * vertex;
-	
-	vec4 worldPos = world * vertex;
-
-	vec3 worldNorm = (worldIT * vec4(normal, 1.0)).xyz;
-
-	// calculate lighting (simple vertex lighting)
-	vec3 lightDir = normalize(
-		lightPosition.xyz - (worldPos.xyz * lightPosition.w));
-
-	outColor = lightColour * max(dot(lightDir, worldNorm), 0.0);
-
-	// calculate shadow map coords
-	oUv = texViewProj * worldPos;
-}
-
+#version 120
+
+uniform mat4 world;
+uniform mat4 worldIT;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition;
+uniform vec4 lightColour;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+
+varying	vec4 oUv;
+varying	vec4 outColor;
+
+void main()
+{
+	gl_Position = worldViewProj * vertex;
+	
+	vec4 worldPos = world * vertex;
+
+	vec3 worldNorm = (worldIT * vec4(normal, 1.0)).xyz;
+
+	// calculate lighting (simple vertex lighting)
+	vec3 lightDir = normalize(
+		lightPosition.xyz - (worldPos.xyz * lightPosition.w));
+
+	outColor = lightColour * max(dot(lightDir, worldNorm), 0.0);
+
+	// calculate shadow map coords
+	oUv = texViewProj * worldPos;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/StdQuad_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/StdQuad_vp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/StdQuad_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,11 +1,11 @@
-varying vec2 uv;
-uniform mat4 worldViewProj;
-attribute vec2 uv0;
-
-void main()                    
-{
-	gl_Position = worldViewProj * gl_Vertex;
-	
-	uv = uv0;
-}
-
+varying vec2 uv;
+uniform mat4 worldViewProj;
+attribute vec2 uv0;
+
+void main()                    
+{
+	gl_Position = worldViewProj * gl_Vertex;
+	
+	uv = uv0;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/SwizzleGP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/SwizzleGP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/SwizzleGP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,40 +1,37 @@
-#version 120																				
-#extension GL_EXT_geometry_shader4 : enable													
-
-uniform vec4 origColor;																		
-uniform vec4 cloneColor;																	
-
-void main(void)																				
-{																							
-
-	//increment variable																	
-	int i;																					
-
-	/////////////////////////////////////////////////////////////							
-	//This example has two parts															
-	//	step a) draw the primitive pushed down the pipeline									
-	//		 there are gl_Vertices # of vertices											
-	//		 put the vertex value into gl_Position											
-	//		 use EmitVertex => 'create' a new vertex										
-	// 		use EndPrimitive to signal that you are done creating a primitive!				
-	//	step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)	
-	//		I just do the same loop, but swizzle the x and y values							
-	//	result => the line we want to draw, and the same line, but along the other axis		
-
-	//Pass-thru!																			
-	for(i=0; i< gl_VerticesIn; i++){														
-		gl_Position = gl_PositionIn[i];														
-		gl_FrontColor = origColor;															
-		EmitVertex();																		
-	}																						
-	EndPrimitive();																			
-	//New piece of geometry!  We just swizzle the x and y terms								
-	for(i=0; i< gl_VerticesIn; i++){														
-		gl_Position = gl_PositionIn[i];														
-		gl_Position.xy = gl_Position.yx;													
-		gl_FrontColor = cloneColor;															
-		EmitVertex();																		
-	}																						
-	EndPrimitive();																			
-
-}
\ No newline at end of file
+#version 120
+#extension GL_EXT_geometry_shader4 : enable
+
+uniform vec4 origColour;
+uniform vec4 cloneColour;
+
+void main(void)
+{
+    /////////////////////////////////////////////////////////////
+    //This example has two parts
+    //  step a) draw the primitive pushed down the pipeline
+    //           there are gl_Vertices # of vertices
+    //           put the vertex value into gl_Position
+    //           use EmitVertex => 'create' a new vertex
+    //          use EndPrimitive to signal that you are done creating a primitive!
+    //  step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)
+    //          I just do the same loop, but swizzle the x and y values
+    //  result => the line we want to draw, and the same line, but along the other axis
+
+    //Pass-thru!
+    int i;
+    for (i = 0; i < gl_VerticesIn; i++) {
+        gl_Position = gl_PositionIn[i];
+        gl_FrontColor = origColour;
+        EmitVertex();
+    }
+    EndPrimitive();
+
+    //New piece of geometry!  We just swizzle the x and y terms
+    for (i = 0; i < gl_VerticesIn; i++){
+        gl_Position = gl_PositionIn[i];
+        gl_Position.xy = gl_Position.yx;
+        gl_FrontColor = cloneColour;
+        EmitVertex();
+    }
+    EndPrimitive();
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/hdr_bloom.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/hdr_bloom.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/hdr_bloom.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,22 +1,22 @@
-uniform sampler2D inRTT;
-
-uniform vec4 sampleOffsets[15];
-uniform vec4 sampleWeights[15];
-
-varying vec2 uv;
-
-void main(void)
-{
-    vec4 accum = vec4(0.0, 0.0, 0.0, 1.0);
-	vec2 sampleUV;
-    
-    for( int i = 0; i < 15; i++ )
-    {
-        // Sample from adjacent points, 7 each side and central
-        sampleUV = uv + sampleOffsets[i].xy;
-        accum += sampleWeights[i] * texture2D(inRTT, sampleUV);
-    }
-    
-    gl_FragColor = accum;
-	
-}
+uniform sampler2D inRTT;
+
+uniform vec4 sampleOffsets[15];
+uniform vec4 sampleWeights[15];
+
+varying vec2 uv;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 1.0);
+	vec2 sampleUV;
+    
+    for( int i = 0; i < 15; i++ )
+    {
+        // Sample from adjacent points, 7 each side and central
+        sampleUV = uv + sampleOffsets[i].xy;
+        accum += sampleWeights[i] * texture2D(inRTT, sampleUV);
+    }
+    
+    gl_FragColor = accum;
+	
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale2x2luminence.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale2x2luminence.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale2x2luminence.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,24 +1,24 @@
-uniform sampler2D inRTT;
-uniform vec2 texelSize;
-
-varying vec2 uv;
-
-void main(void)
-{
-	
-    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
-	vec4 LUMINENCE_FACTOR  = vec4(0.27, 0.67, 0.06, 0.0);
-
-    // Get colour from source
-    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, -0.5));
-    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, 0.5));
-    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, 0.5));
-    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, -0.5));
-    
-	// Adjust the accumulated amount by lum factor
-	float lum = dot(accum, LUMINENCE_FACTOR);
-	// take average of 4 samples
-	lum *= 0.25;
-	gl_FragColor = vec4(lum, lum, lum, 1.0);
-
-}
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+
+void main(void)
+{
+	
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+	vec4 LUMINENCE_FACTOR  = vec4(0.27, 0.67, 0.06, 0.0);
+
+    // Get colour from source
+    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, -0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, 0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, 0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, -0.5));
+    
+	// Adjust the accumulated amount by lum factor
+	float lum = dot(accum, LUMINENCE_FACTOR);
+	// take average of 4 samples
+	lum *= 0.25;
+	gl_FragColor = vec4(lum, lum, lum, 1.0);
+
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,26 +1,26 @@
-uniform sampler2D inRTT;
-uniform vec2 texelSize;
-
-varying vec2 uv;
-
-void main(void)
-{
-    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
-
-    // Get colour from source
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
-    
-	// take average of 9 samples
-	accum *= 0.1111111111111111;
-
-	gl_FragColor = accum;
-
-}
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+
+    // Get colour from source
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+	gl_FragColor = accum;
+
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3brightpass.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3brightpass.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/hdr_downscale3x3brightpass.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,37 +1,37 @@
-uniform sampler2D inRTT;
-uniform sampler2D inLum;
-uniform vec2 texelSize;
-
-varying vec2 uv;
-const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
-
-// declare external function
-vec4 toneMap(in vec4 inColour, in float lum);
-
-void main(void)
-{
-    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
-
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
-    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
-    
-	// take average of 9 samples
-	accum *= 0.1111111111111111;
-
-    // Reduce bright and clamp
-    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
-
-	// Sample the luminence texture
-	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
-	
-	// Tone map result
-	gl_FragColor = toneMap(accum, lum.r);
-
-}
+uniform sampler2D inRTT;
+uniform sampler2D inLum;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
+
+// declare external function
+vec4 toneMap(in vec4 inColour, in float lum);
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+    // Reduce bright and clamp
+    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
+
+	// Sample the luminence texture
+	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
+	
+	// Tone map result
+	gl_FragColor = toneMap(accum, lum.r);
+
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/hdr_finalToneMapping.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/hdr_finalToneMapping.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/hdr_finalToneMapping.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,28 +1,28 @@
-uniform sampler2D inRTT;
-uniform sampler2D inBloom;
-uniform sampler2D inLum;
-
-varying vec2 uv;
-
-// declare external function
-vec4 toneMap(in vec4 inColour, in float lum);
-
-void main(void)
-{
-	// Get main scene colour
-    vec4 sceneCol = texture2D(inRTT, uv);
-
-	// Get luminence value
-	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
-
-	// tone map this
-	vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r);
-	
-	// Get bloom colour
-    vec4 bloom = texture2D(inBloom, uv);
-
-	// Add scene & bloom
-	gl_FragColor = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0);
-    
-}
-
+uniform sampler2D inRTT;
+uniform sampler2D inBloom;
+uniform sampler2D inLum;
+
+varying vec2 uv;
+
+// declare external function
+vec4 toneMap(in vec4 inColour, in float lum);
+
+void main(void)
+{
+	// Get main scene colour
+    vec4 sceneCol = texture2D(inRTT, uv);
+
+	// Get luminence value
+	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
+
+	// tone map this
+	vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r);
+	
+	// Get bloom colour
+    vec4 bloom = texture2D(inBloom, uv);
+
+	// Add scene & bloom
+	gl_FragColor = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0);
+    
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/instancingVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/instancingVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/instancingVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,39 +1,39 @@
-uniform vec4 worldMatrix3x4Array[240];
-uniform mat4 viewProjectionMatrix;
-uniform vec4 lightPos;
-uniform vec4 ambient;
-uniform vec4 lightDiffuseColour;
-
-void main()
-{
-
-	// transform by indexed matrix
-	// perform matrix multiplication manually since no 3x4 matrices
-	vec3 transformedPos;
-	vec3 transformedNorm;
-	int instanceOffset = int(gl_MultiTexCoord1.x) * 3;
-	for (int row = 0; row < 3; ++row)
-	{
-		vec4 matrixRow = worldMatrix3x4Array[instanceOffset + row];
-		transformedPos[row] = dot(matrixRow, gl_Vertex);
-#if SHADOW_CASTER
-#else
-		transformedNorm[row] = dot(matrixRow.xyz, gl_Normal);
-#endif
-		
-	}
-	
-	// view / projection
-	gl_Position = viewProjectionMatrix * vec4(transformedPos,1);
-	gl_TexCoord[0] = gl_MultiTexCoord0;
-    gl_FrontSecondaryColor = vec4(0);
-	
-#if SHADOW_CASTER
-	gl_FrontColor = ambient;
-#else
-	vec3 lightDir = normalize(
-		lightPos.xyz -  (transformedPos.xyz * lightPos.w));
-	gl_FrontColor = ambient + clamp(dot(lightDir, transformedNorm),0.0,1.0) * lightDiffuseColour;
-#endif
-	
-}
+uniform vec4 worldMatrix3x4Array[240];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 lightPos;
+uniform vec4 ambient;
+uniform vec4 lightDiffuseColour;
+
+void main()
+{
+
+	// transform by indexed matrix
+	// perform matrix multiplication manually since no 3x4 matrices
+	vec3 transformedPos;
+	vec3 transformedNorm;
+	int instanceOffset = int(gl_MultiTexCoord1.x) * 3;
+	for (int row = 0; row < 3; ++row)
+	{
+		vec4 matrixRow = worldMatrix3x4Array[instanceOffset + row];
+		transformedPos[row] = dot(matrixRow, gl_Vertex);
+#if SHADOW_CASTER
+#else
+		transformedNorm[row] = dot(matrixRow.xyz, gl_Normal);
+#endif
+		
+	}
+	
+	// view / projection
+	gl_Position = viewProjectionMatrix * vec4(transformedPos,1);
+	gl_TexCoord[0] = gl_MultiTexCoord0;
+    gl_FrontSecondaryColor = vec4(0);
+	
+#if SHADOW_CASTER
+	gl_FrontColor = ambient;
+#else
+	vec3 lightDir = normalize(
+		lightPos.xyz -  (transformedPos.xyz * lightPos.w));
+	gl_FrontColor = ambient + clamp(dot(lightDir, transformedNorm),0.0,1.0) * lightDiffuseColour;
+#endif
+	
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_quad.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_quad.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_quad.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,17 +1,17 @@
-uniform sampler2D rt0;
-uniform sampler2D rt1;
-uniform sampler2D rt2;
-uniform sampler2D rt3;
-
-varying vec2 uv;
-
-void main(void)
-{
-    
-    //gl_FragColor = texture2D(rt0, uv);
-    gl_FragColor = texture2D(rt1, uv);
-    //gl_FragColor = texture2D(rt2, uv);
-    //gl_FragColor = texture2D(rt3, uv);
-	
-}
-
+uniform sampler2D rt0;
+uniform sampler2D rt1;
+uniform sampler2D rt2;
+uniform sampler2D rt3;
+
+varying vec2 uv;
+
+void main(void)
+{
+    
+    //gl_FragColor = texture2D(rt0, uv);
+    gl_FragColor = texture2D(rt1, uv);
+    //gl_FragColor = texture2D(rt2, uv);
+    //gl_FragColor = texture2D(rt3, uv);
+	
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_scene.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_scene.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL/mrttestfp_scene.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,20 +1,20 @@
-// Need to enable the draw buffers extension
-#extension GL_ARB_draw_buffers : enable
-
-uniform sampler2D tex0;
-
-void main()                    
-{
-	vec4 baseColour = texture2D(tex0, gl_TexCoord[0].xy);
-
-	gl_FragData[0] = baseColour;
-
-	gl_FragData[1] = baseColour * vec4(1, 0, 0, 1);
-
-	float abs = (baseColour.r + baseColour.g + baseColour.b) * 0.333;
-	gl_FragData[2] = vec4(abs, abs, abs, 1);
-	
-	float invabs = 1.0 - abs;
-	gl_FragData[3] = vec4(invabs, invabs, invabs, 1);
-}
-
+// Need to enable the draw buffers extension
+#extension GL_ARB_draw_buffers : enable
+
+uniform sampler2D tex0;
+
+void main()                    
+{
+	vec4 baseColour = texture2D(tex0, gl_TexCoord[0].xy);
+
+	gl_FragData[0] = baseColour;
+
+	gl_FragData[1] = baseColour * vec4(1, 0, 0, 1);
+
+	float abs = (baseColour.r + baseColour.g + baseColour.b) * 0.333;
+	gl_FragData[2] = vec4(abs, abs, abs, 1);
+	
+	float invabs = 1.0 - abs;
+	gl_FragData[3] = vec4(invabs, invabs, invabs, 1);
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTexture.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTexture.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTexture.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 120
+
+uniform vec4 ambient;
+uniform mat4 worldViewProj;
+
+attribute vec4 position;
+
+varying vec4 colour;
+
+/*
+  Basic ambient lighting vertex program for GLSL
+*/
+void main()
+{
+	gl_Position = worldViewProj * position;
+	colour = ambient;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTextureWithUV.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTextureWithUV.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/AmbientOneTextureWithUV.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,20 @@
+#version 120
+
+uniform vec4 ambient;
+uniform mat4 worldViewProj;
+
+attribute vec4 position;
+attribute vec4 uv0;
+
+varying vec4 colour;
+varying vec4 ambientUV;
+
+/*
+  Basic ambient lighting vertex program for GLSL
+*/
+void main()
+{
+	gl_Position = worldViewProj * position;
+	colour = ambient;
+	ambientUV = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Bloom2_ps20.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Bloom2_ps20.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Bloom2_ps20.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+//-------------------------------
+//Bloom_ps20.glsl
+// Blends using weights the blurred image with the sharp one
+// Params:
+//   OriginalImageWeight
+//   BlurWeight
+//-------------------------------
+
+uniform sampler2D RT;
+uniform sampler2D Blur1;
+
+uniform float OriginalImageWeight;
+uniform float BlurWeight;
+varying vec2 texCoord;
+
+void main()
+{
+    vec4 sharp;
+    vec4 blur;
+
+    sharp = texture2D( RT, texCoord);
+    blur = texture2D( Blur1, texCoord);
+    
+    gl_FragColor = ( (blur * BlurWeight) + (sharp * OriginalImageWeight) );
+    //gl_FragColor = vec4(0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/BlurH_ps20.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/BlurH_ps20.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/BlurH_ps20.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,57 @@
+//-------------------------------
+//BlurH_ps20.glsl
+// Horizontal Gaussian-Blur pass
+//-------------------------------
+#version 120
+
+uniform sampler2D Blur0;
+varying vec2 texCoord;
+
+vec2 pos[11] = vec2[11]
+(
+	vec2( -5, 0),
+	vec2( -4, 0),
+	vec2( -3, 0),
+	vec2( -2, 0),
+	vec2( -1, 0),
+	vec2( 0, 0),
+	vec2( 1, 0),
+	vec2( 2, 0),
+	vec2( 3, 0),
+	vec2( 4, 0),
+	vec2( 5, 0)
+);
+
+//We use the Normal-gauss distribution formula
+//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+float samples[11] = float[11]
+(//stddev=2.0
+0.01222447,
+0.02783468,
+0.06559061,
+0.12097757,
+0.17466632,
+
+0.19741265,
+
+0.17466632,
+0.12097757,
+0.06559061,
+0.02783468,
+0.01222447
+);
+
+void main()
+{
+    vec4 retVal;
+    vec4 sum;
+    int i = 0;
+
+    sum = vec4( 0 );
+    for( i=0;i < 11; i++ )
+    {
+        sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i];
+    }
+
+    gl_FragColor = sum;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/BlurV_ps20.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/BlurV_ps20.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/BlurV_ps20.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,61 @@
+// Note, this won't work on ATI which is why it's not used
+// the issue is with the array initializers
+// no card supports GL_3DL_array_objects but it does work on nvidia, not on ATI
+//#extension GL_3DL_array_objects : enable
+#version 120
+
+//-------------------------------
+//BlurV_ps20.glsl
+// Vertical Gaussian-Blur pass
+//-------------------------------
+
+uniform sampler2D Blur0;
+varying vec2 texCoord;
+
+vec2 pos[11]  = vec2[11](
+	vec2(0.0, -5.0),
+	vec2(0.0, -4.0),
+	vec2(0.0, -3.0),
+	vec2(0.0, -2.0),
+	vec2(0.0, -1.0),
+	vec2(0.0, 0.0),
+	vec2(0.0, 1.0),
+	vec2(0.0, 2.0),
+	vec2(0.0, 3.0),
+	vec2(0.0, 4.0),
+	vec2(0.0, 5.0)
+);
+
+//We use the Normal-gauss distribution formula
+//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+float samples[11] = float[11] 
+(//stddev=2.0
+0.01222447,
+0.02783468,
+0.06559061,
+0.12097757,
+0.17466632,
+
+0.19741265,
+
+0.17466632,
+0.12097757,
+0.06559061,
+0.02783468,
+0.01222447
+);
+
+void main()
+{
+    vec4 retVal;
+    vec4 sum;
+    int i = 0;
+
+    sum = vec4( 0 );
+    for( ;i < 11; i++ )
+    {
+        sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i];
+    }
+
+    gl_FragColor = sum;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Blur_vs.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Blur_vs.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Blur_vs.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,11 @@
+varying vec2 texCoord;
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec2 uv0;
+
+void main()                    
+{
+	gl_Position = worldViewProj * vertex;
+	texCoord = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/BrightBloom2_ps20.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/BrightBloom2_ps20.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/BrightBloom2_ps20.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,28 @@
+//-------------------------------
+//BrightBloom_ps20.glsl
+// High-pass filter for obtaining lumminance
+// We use an aproximation formula that is pretty fast:
+//   f(x) = ( -3 * ( x - 1 )^2 + 1 ) * 2
+//   Color += Grayscale( f(Color) ) + 0.6
+//
+// Special thanks to ATI for their great HLSL2GLSL utility
+//     http://sourceforge.net/projects/hlsl2glsl
+//-------------------------------
+
+uniform sampler2D RT;
+varying vec2 oUv0;
+
+void main()
+{
+    vec4 tex;
+    vec4 bright4;
+    float bright;
+
+    tex = texture2D(RT, oUv0);
+    tex -= 1.00000;
+    bright4 = -6.00000 * tex * tex + 2.00000;
+    bright = dot( bright4, vec4( 0.333333, 0.333333, 0.333333, 0.000000) );
+    tex += (bright + 0.600000);
+
+    gl_FragColor = tex;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/BumpMapVPTangentParity.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/BumpMapVPTangentParity.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/BumpMapVPTangentParity.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,47 @@
+#version 120
+
+/* Bump mapping vertex program
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect.
+*/
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 tangent;
+attribute vec2 uv0;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+    // Calculate output position
+    gl_Position = worldViewProj * vertex;
+
+    // Pass the main uvs straight through unchanged
+    oUv0 = uv0;
+
+    // Calculate tangent space light vector
+    // Get object space light direction
+    // Non-normalised since we'll do that in the fragment program anyway
+    vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+    // Calculate the binormal (NB we assume both normal and tangent are
+    // already normalised)
+
+    // Fixed handedness
+    vec3 binormal = cross(normal, tangent.xyz) * tangent.www;
+
+    // Form a rotation matrix out of the vectors, column major for glsl es
+    mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+                          vec3(tangent[1], binormal[1], normal[1]),
+                          vec3(tangent[2], binormal[2], normal[2]));
+
+    // Transform the light vector according to this matrix
+    oTSLightDir = rotation * lightDir;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/DiffuseOneTexture.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/DiffuseOneTexture.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/DiffuseOneTexture.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 120
+
+uniform sampler2D texMap;
+
+varying vec4 colour;
+varying vec4 uv;
+
+/*
+  Basic fragment program using texture and diffuse colour.
+*/
+void main()
+{
+	gl_FragColor = texture2D(texMap, uv.xy) * colour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,42 @@
+#version 120
+
+mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[24]);
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ);
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ);
+
+uniform vec4 worldDualQuaternion2x4Array[24];
+uniform mat4 viewProjectionMatrix;
+uniform vec4   lightPos[2];
+uniform vec4   lightDiffuseColour[2];
+uniform vec4   ambient;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+attribute vec4 uv0;
+
+void main()
+{	
+	mat2x4 blendDQ = blendTwoWeightsAntipod(blendWeights, blendIndices, worldDualQuaternion2x4Array);
+
+	float len = length(blendDQ[0]);
+	blendDQ /= len;
+
+	vec3 blendPosition = calculateBlendPosition(vertex.xyz, blendDQ);
+		
+	//No need to normalize, the magnitude of the normal is preserved because only rotation is performed
+	vec3 blendNormal = calculateBlendNormal(normal, blendDQ);
+	
+	gl_Position =  viewProjectionMatrix * vec4(blendPosition, 1.0);
+	
+	// Lighting - support point and directional
+	vec3 lightDir0 = normalize(lightPos[0].xyz - (blendPosition * lightPos[0].w));
+	vec3 lightDir1 = normalize(lightPos[1].xyz - (blendPosition * lightPos[1].w));
+
+	gl_TexCoord[0] = uv0;
+
+	gl_FrontColor = gl_FrontMaterial.diffuse * (ambient + (clamp(dot(lightDir0, blendNormal), 0.0, 1.0) * lightDiffuseColour[0]) + 
+		(clamp(dot(lightDir1, blendNormal), 0.0, 1.0) * lightDiffuseColour[1]));			
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_ShadowCaster.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_ShadowCaster.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_ShadowCaster.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,29 @@
+#version 120
+
+mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[24]);
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ);
+
+uniform vec4 worldDualQuaternion2x4Array[24];
+uniform mat4 viewProjectionMatrix;
+uniform vec4   ambient;
+
+attribute vec4 vertex;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+//Shadow caster pass
+void main()
+{
+	mat2x4 blendDQ = blendTwoWeightsAntipod(blendWeights, blendIndices, worldDualQuaternion2x4Array);
+
+	float len = length(blendDQ[0]);
+	blendDQ /= len;
+
+	vec3 blendPosition = calculateBlendPosition(vertex.xyz, blendDQ);
+
+	// view / projection
+	gl_Position = viewProjectionMatrix * vec4(blendPosition, 1.0);
+	
+	gl_FrontColor = ambient;
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhase.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhase.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhase.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,77 @@
+#version 120
+
+mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[48]);
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ);
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ);
+
+mat3 adjointTransposeMatrix(mat3 M)
+{
+	mat3 atM;
+	atM[0][0] = M[2][2] * M[1][1] - M[2][1] * M[1][2];
+	atM[1][0] = M[2][1] * M[0][2] - M[0][1] * M[2][2];
+	atM[2][0] = M[0][1] * M[1][2] - M[0][2] * M[1][1];
+
+	atM[0][1] = M[2][0] * M[1][2] - M[2][2] * M[1][0];
+	atM[1][1] = M[2][2] * M[0][0] - M[2][0] * M[0][2];
+	atM[2][1] = M[0][2] * M[1][0] - M[0][0] * M[1][2];
+
+	atM[0][2] = M[2][1] * M[1][0] - M[2][0] * M[1][1];
+	atM[1][2] = M[0][1] * M[2][0] - M[2][1] * M[0][0];
+	atM[2][2] = M[0][0] * M[1][1] - M[0][1] * M[1][0];
+
+	return atM;
+}
+
+uniform vec4 worldDualQuaternion2x4Array[48];
+uniform vec4 scaleM[72];
+uniform mat4 viewProjectionMatrix;
+uniform vec4   lightPos[2];
+uniform vec4   lightDiffuseColour[2];
+uniform vec4   ambient;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+attribute vec4 uv0;
+
+void main()
+{	
+	//First phase - applies scaling and shearing:
+	int blendIndicesX = int(blendIndices.x) * 3;
+	int blendIndicesY = int(blendIndices.y) * 3;
+	
+	mat3x4 blendS = blendWeights.x*mat3x4(scaleM[blendIndicesX], 
+		scaleM[blendIndicesX + 1], scaleM[blendIndicesX + 2]);
+	
+	blendS += blendWeights.y*mat3x4(scaleM[blendIndicesY], 						scaleM[blendIndicesY + 1], scaleM[blendIndicesY + 2]);
+
+	mat4x3 blendF = transpose(blendS);
+
+	vec3 pass1_position = blendF * vertex;
+
+	mat3x3 blendSrotAT = adjointTransposeMatrix(mat3x3(blendF));
+	vec3 pass1_normal = normalize(blendSrotAT * normal);
+
+	//Second phase
+	mat2x4 blendDQ = blendTwoWeightsAntipod(blendWeights, blendIndices, worldDualQuaternion2x4Array);
+
+	blendDQ /= length(blendDQ[0]);
+
+	vec3 blendPosition = calculateBlendPosition(pass1_position, blendDQ);
+
+	//No need to normalize, the magnitude of the normal is preserved because only rotation is performed
+	vec3 blendNormal = calculateBlendNormal(pass1_normal, blendDQ);
+	
+	gl_Position =  viewProjectionMatrix * vec4(blendPosition, 1.0);
+
+	// Lighting - support point and directional
+	vec3 lightDir0 = normalize(lightPos[0].xyz - (blendPosition * lightPos[0].w));
+	vec3 lightDir1 = normalize(lightPos[1].xyz - (blendPosition * lightPos[1].w));
+
+	gl_TexCoord[0] = uv0;
+
+	gl_FrontColor = gl_FrontMaterial.diffuse * (ambient + (clamp(dot(lightDir0, blendNormal), 0.0, 1.0) * lightDiffuseColour[0]) + 
+		(clamp(dot(lightDir1, blendNormal), 0.0, 1.0) * lightDiffuseColour[1]));			
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhaseShadowCaster.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhaseShadowCaster.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/DualQuaternion_TwoPhaseShadowCaster.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,44 @@
+#version 120
+
+mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[48]);
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ);
+
+uniform vec4 worldDualQuaternion2x4Array[48];
+uniform vec4 scaleM[72];
+uniform mat4 viewProjectionMatrix;
+uniform vec4   ambient;
+
+attribute vec4 vertex;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+varying vec4 colour;
+
+//Shadow caster pass
+void main()
+{	
+	//First phase - applies scaling and shearing:
+	int blendIndicesX = int(blendIndices.x) * 3;
+	int blendIndicesY = int(blendIndices.y) * 3;
+	
+	mat3x4 blendS = blendWeights.x*mat3x4(scaleM[blendIndicesX], 
+		scaleM[blendIndicesX + 1], scaleM[blendIndicesX + 2]);
+	
+	blendS += blendWeights.y*mat3x4(scaleM[blendIndicesY], 						scaleM[blendIndicesY + 1], scaleM[blendIndicesY + 2]);
+
+	mat4x3 blendF = transpose(blendS);
+
+	vec3 pass1_position = blendF * vertex;
+
+	//Second phase
+	mat2x4 blendDQ = blendTwoWeightsAntipod(blendWeights, blendIndices, worldDualQuaternion2x4Array);
+
+	blendDQ /= length(blendDQ[0]);
+
+	vec3 blendPosition = calculateBlendPosition(pass1_position, blendDQ);
+	
+	gl_Position =  viewProjectionMatrix * vec4(blendPosition, 1.0);
+
+	gl_FrontColor = ambient;
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,27 @@
+#version 120
+
+uniform vec4 lightDiffuse;
+uniform sampler2D normalMap;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+    return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+    // Retrieve normalised light vector, expand from range-compressed
+    vec3 lightVec = normalize(oTSLightDir).xyz;
+
+    // Get bump map vector, again expand from range-compressed
+    vec3 bumpVec = expand(texture2D(normalMap, oUv0).xyz);
+
+    // Calculate dot product
+    gl_FragColor = lightDiffuse * dot(bumpVec, lightVec);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,32 @@
+#version 120
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+uniform sampler2D shadowMap;
+uniform sampler2D normalMap;
+uniform vec4 lightDiffuse;
+
+varying vec4 uvproj;
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// retrieve normalised light vector, expand from range-compressed
+	vec3 lightVec = expand(normalize(oTSLightDir).xyz);
+
+	// get bump map vector, again expand from range-compressed
+	vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz);
+
+	// get shadow value
+	vec3 shadow = texture2DProj(shadowMap, uvproj).xyz;
+
+	// Calculate dot product
+	gl_FragColor = vec4(shadow * lightDiffuse.xyz * dot(bumpVec, lightVec), 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingShadowRcvVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,52 @@
+#version 120
+
+/* Bump mapping vertex program for shadow receiving
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect. 
+*/
+
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+uniform mat4 worldMatrix;
+uniform mat4 texViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+
+varying vec4 uvproj;
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// Pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	// Non-normalised since we'll do that in the fragment program anyway
+	vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	vec3 binormal = cross(normal, tangent);
+	
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+
+	// Projection
+	uvproj = texViewProj * (worldMatrix * vertex);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,39 @@
+#version 120
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform sampler2D normalMap;
+
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+varying vec3 oTSHalfAngle;
+
+// NOTE: GLSL does not have the saturate function.  But it is equivalent to clamp(val, 0.0, 1.0)
+
+/* Fragment program which supports specular component */
+void main()
+{
+	// retrieve normalised light vector
+	vec3 lightVec = normalize(oTSLightDir);
+
+	// retrieve half angle and normalise
+	vec3 halfAngle = normalize(oTSHalfAngle);
+
+	// get bump map vector, again expand from range-compressed
+	vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz);
+
+	// Pre-raise the specular exponent to the eight power
+	float specFactor = pow(clamp(dot(bumpVec, halfAngle), 0.0, 1.0), 4.0);
+
+	// Calculate dot product for diffuse
+	gl_FragColor = (lightDiffuse * clamp(dot(bumpVec, lightVec), 0.0, 1.0)) + 
+			(lightSpecular * specFactor);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingSpecularVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,47 @@
+#version 120
+
+// General functions
+// parameters
+uniform vec4 lightPosition; // object space
+uniform vec3 eyePosition;   // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+varying vec3 oTSHalfAngle;
+
+/* Vertex program which includes specular component */
+void main()
+{
+	// calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// calculate tangent space light vector
+	// Get object space light direction
+	vec3 lightDir = normalize(lightPosition.xyz - (vertex * lightPosition.w).xyz);
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	vec3 binormal = cross(normal, tangent);
+	
+	// Form a rotation matrix out of the vectors
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+
+	// Calculate half-angle in tangent space
+	vec3 eyeDir = normalize(eyePosition - vertex.xyz);
+	vec3 halfAngle = normalize(eyeDir + lightDir);
+	oTSHalfAngle = rotation * halfAngle;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_BumpMappingVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,47 @@
+#version 120
+
+/* Bump mapping vertex program
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect.
+*/
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec2 uv0;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+    // Calculate output position
+    gl_Position = worldViewProj * vertex;
+
+    // Pass the main uvs straight through unchanged
+    oUv0 = uv0;
+
+    // Calculate tangent space light vector
+    // Get object space light direction
+    // Non-normalised since we'll do that in the fragment program anyway
+    vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+    // Calculate the binormal (NB we assume both normal and tangent are
+    // already normalised)
+
+    // Fixed handedness
+    vec3 binormal = cross(normal, tangent);
+
+    // Form a rotation matrix out of the vectors, column major for glsl es
+    mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+                         vec3(tangent[1], binormal[1], normal[1]),
+                         vec3(tangent[2], binormal[2], normal[2]));
+
+    // Transform the light vector according to this matrix
+    oTSLightDir = rotation * lightDir;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,37 @@
+#version 120
+
+uniform vec4 tintColour;
+uniform float noiseScale;
+uniform float fresnelBias;
+uniform float fresnelScale;
+uniform float fresnelPower;
+uniform sampler2D noiseMap;
+uniform sampler2D reflectMap;
+uniform sampler2D refractMap;
+
+varying vec3 noiseCoord;
+varying vec4 projectionCoord;
+varying vec3 eyeDir;
+varying vec3 oNormal;
+
+// Fragment program for distorting a texture using a 3D noise texture
+void main()
+{
+	// Do the tex projection manually so we can distort _after_
+	vec2 final = projectionCoord.xy / projectionCoord.w;
+
+	// Noise
+	vec3 noiseNormal = (texture2D(noiseMap, (noiseCoord.xy / 5.0)).rgb - 0.5).rbg * noiseScale;
+	final += noiseNormal.xz;
+
+	// Fresnel
+	//normal = normalize(normal + noiseNormal.xz);
+	float fresnel = fresnelBias + fresnelScale * pow(1.0 + dot(eyeDir, oNormal), fresnelPower);
+
+	// Reflection / refraction
+	vec4 reflectionColour = texture2D(reflectMap, final);
+	vec4 refractionColour = texture2D(refractMap, final) + tintColour;
+
+	// Final colour
+	gl_FragColor = mix(refractionColour, reflectionColour, fresnel);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_FresnelVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,36 @@
+#version 120
+
+attribute vec4 uv0;
+attribute vec4 position;
+attribute vec3 normal;
+
+uniform mat4 worldViewProjMatrix;
+uniform vec3 eyePosition; // object space
+uniform float timeVal;
+uniform float scale;  // the amount to scale the noise texture by
+uniform float scroll; // the amount by which to scroll the noise
+uniform float noise;  // the noise perturb as a factor of the time
+
+varying vec3 noiseCoord;
+varying vec4 projectionCoord;
+varying vec3 eyeDir;
+varying vec3 oNormal;
+
+// Vertex program for fresnel reflections / refractions
+void main()
+{
+	gl_Position = worldViewProjMatrix * position;
+	// Projective texture coordinates, adjust for mapping
+	mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0, 
+                         0.0, -0.5, 0.0, 0.0,
+                         0.0, 0.0, 0.5, 0.0,
+                         0.5, 0.5, 0.5, 1.0);
+	projectionCoord = scalemat * gl_Position;
+
+	// Noise map coords
+	noiseCoord.xy = (uv0.xy + (timeVal * scroll)) * scale;
+	noiseCoord.z = noise * timeVal;
+
+	eyeDir = normalize(position.xyz - eyePosition); 
+	oNormal = normal.rgb;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayPS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayPS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayPS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 120
+#extension GL_EXT_texture_array : enable
+
+uniform sampler2DArray TextureArrayTex;
+varying vec3 oUv;
+
+void main(void)
+{
+	vec3 texcoord;
+	texcoord = oUv;
+	texcoord.z = floor(texcoord.z);
+    vec4 c0 = texture2DArray(TextureArrayTex, texcoord);
+	texcoord.z += 1.0;
+    vec4 c1 = texture2DArray(TextureArrayTex, texcoord);
+
+	gl_FragColor = mix(c0, c1, fract(oUv.z));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayVS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayVS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Example_TextureArrayVS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,13 @@
+#version 120
+
+attribute vec3 uv0;
+attribute vec4 vertex;
+varying vec3 oUv;
+
+uniform mat4 worldViewProj;
+
+void main(void)
+{
+	gl_Position = worldViewProj * vertex;
+	oUv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/GlassFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/GlassFP.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/GlassFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,10 @@
+uniform sampler2D RT;
+uniform sampler2D NormalMap;
+varying vec2 oUv0;
+
+void main()
+{
+	vec4 normal = 2.0 * (texture2D(NormalMap, oUv0 * 2.5) - 0.5);
+
+	gl_FragColor = texture2D(RT, oUv0 + normal.xy * 0.05);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/GrayScale.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/GrayScale.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/GrayScale.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,8 @@
+uniform sampler2D RT;
+varying vec2 oUv0;
+
+void main()
+{
+    vec3 greyscale = vec3(dot(texture2D(RT, oUv0).rgb, vec3(0.3, 0.59, 0.11)));
+	gl_FragColor = vec4(greyscale, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/HWBasicInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/HWBasicInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/HWBasicInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,69 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 120
+
+//Vertex input
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 uv0;
+attribute vec4 uv1;
+attribute vec4 uv2;
+attribute vec4 uv3;
+attribute vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	varying vec2 depth;
+#else
+	varying vec2 _uv0;
+	varying vec3 oNormal;
+	varying vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		varying vec4 oLightSpacePos;
+	#endif
+#endif
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	mat4 worldMatrix;
+	worldMatrix[0] = uv1;
+	worldMatrix[1] = uv2;
+	worldMatrix[2] = uv3;
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	vec4 worldPos		= vertex * worldMatrix;
+	vec3 worldNorm		= normal * mat3(worldMatrix);
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/HW_VTFInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/HW_VTFInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/HW_VTFInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,131 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 120
+
+//Vertex input
+attribute vec4 vertex;
+attribute vec3 normal;
+
+#ifdef BONE_TWO_WEIGHTS
+	attribute vec4 blendWeights;
+#endif
+
+attribute vec4 uv0;
+attribute vec4 uv1;
+attribute vec4 uv2;
+	
+#if BONE_MATRIX_LUT
+	attribute vec4 uv3;
+	attribute vec4 uv4;
+	attribute vec4 uv5;
+#endif
+
+attribute vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform sampler2D matrixTexture;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	varying vec2 depth;
+#else
+	varying vec2 _uv0;
+	varying vec3 oNormal;
+	varying vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		varying vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos;
+	vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	mat2x4 blendDQ;	
+	blendDQ[0] = texture2D( matrixTexture, vec2(uv1.x, 0.0) + uv2.xy );
+	blendDQ[1] = texture2D( matrixTexture, vec2(uv1.y, 0.0) + uv2.xy );
+#ifdef BONE_TWO_WEIGHTS
+	mat2x4 blendDQ2;
+	blendDQ2[0] = texture2D( matrixTexture, vec2(uv1.z, 0.0) + uv2.xy );
+	blendDQ2[1] = texture2D( matrixTexture, vec2(uv1.w, 0.0) + uv2.xy );
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	worldMatrix[0] = texture2D( matrixTexture, uv1.xw + uv2.xy );
+	worldMatrix[1] = texture2D( matrixTexture, uv1.yw + uv2.xy );
+	worldMatrix[2] = texture2D( matrixTexture, uv1.zw + uv2.xy );
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+#if BONE_MATRIX_LUT
+	mat4 worldCompMatrix;
+	worldCompMatrix[0] = uv3;
+	worldCompMatrix[1] = uv4;
+	worldCompMatrix[2] = uv5;
+	worldCompMatrix[3] = vec4( 0, 0, 0, 1 );
+	
+	worldPos =  worldPos * worldCompMatrix;
+	worldNorm = worldNorm * mat3(worldCompMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Instancing.frag
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Instancing.frag	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Instancing.frag	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,66 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+
+uniform sampler2D diffuseMap;
+
+uniform vec4	lightPosition;
+uniform vec3	cameraPosition;
+uniform vec3 	lightAmbient;
+uniform vec3	lightDiffuse;
+uniform vec3	lightSpecular;
+uniform vec4	lightAttenuation;
+uniform float	lightGloss;
+
+#if DEPTH_SHADOWRECEIVER
+uniform float invShadowMapSize;
+uniform sampler2DShadow shadowMap;
+
+//declare external function
+//vec4 calcDepthShadow(in vec4 inColour, in float lum);
+float calcDepthShadow(sampler2DShadow shadowMap, vec4 uv, float invShadowMapSize);
+#endif
+
+varying vec2 _uv0;
+varying vec3 oNormal;
+varying vec3 oVPos;
+#if DEPTH_SHADOWRECEIVER
+	varying vec4 oLightSpacePos;
+#endif
+
+//---------------------------------------------
+//Main Pixel Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 color = texture2D( diffuseMap, _uv0 );
+
+	float fShadow = 1.0;
+#if DEPTH_SHADOWRECEIVER
+	fShadow = calcDepthShadow( shadowMap, oLightSpacePos, invShadowMapSize );
+#endif
+
+	vec4 baseColour = texture2D( diffuseMap, _uv0 );
+
+	//Blinn-Phong lighting
+	vec3 normal	= normalize( oNormal );
+	vec3 lightDir		= lightPosition.xyz - oVPos * lightPosition.w;
+	vec3 eyeDir			= normalize( cameraPosition - oVPos );
+
+	float fLength	= length( lightDir );
+	lightDir			= normalize( lightDir );
+
+	float NdotL	= max( 0.0, dot( normal, lightDir ) );
+	vec3 halfVector		= normalize(lightDir + eyeDir);
+	float HdotN	= max( 0.0, dot( halfVector, normal ) );
+	
+	vec3 ambient  = lightAmbient * baseColour.xyz;
+	vec3 diffuse  = lightDiffuse * NdotL * baseColour.xyz;
+	vec3 specular = lightSpecular * pow( HdotN, lightGloss );
+	
+	vec3 directLighting = (diffuse + specular) * fShadow;
+	
+	gl_FragColor = vec4( directLighting + ambient, baseColour.a );
+	//gl_FragColor = baseColour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/InstancingMisc.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/InstancingMisc.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/InstancingMisc.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,62 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 120
+
+//Vertex input
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform mat4 worldMatrix;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	varying vec2 depth;
+#else
+	varying vec2 _uv0;
+	varying vec3 oNormal;
+	varying vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		varying vec4 oLightSpacePos;
+	#endif
+#endif
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos		= vertex * worldMatrix;
+	vec3 worldNorm		= normal * mat3(worldMatrix);
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.frag
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.frag	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.frag	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,71 @@
+/*********************************************************************NVMH3****
+Copyright NVIDIA Corporation 2003
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
+BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
+WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
+BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
+ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Comments:
+	Simple ocean shader with animated bump map and geometric waves
+	Based partly on "Effective Water Simulation From Physical Models", GPU Gems
+
+11 Aug 05: converted from HLSL to GLSL by Jeff Doyle (nfz) to work in Ogre
+
+******************************************************************************/
+
+
+uniform sampler2D NormalMap;
+uniform samplerCube EnvironmentMap;
+uniform vec4 deepColor;
+uniform vec4 shallowColor;
+uniform vec4 reflectionColor;
+uniform float reflectionAmount;
+uniform float reflectionBlur;
+uniform float waterAmount;
+uniform float fresnelPower;
+uniform float fresnelBias;
+uniform float hdrMultiplier;
+
+varying mat3 rotMatrix; // first row of the 3x3 transform from tangent to cube space
+varying vec2 bumpCoord0;
+varying vec2 bumpCoord1;
+varying vec2 bumpCoord2;
+varying vec3 eyeVector;
+
+
+void main(void)
+{
+	// sum normal maps
+	// sample from 3 different points so no texture repetition is noticeable
+    vec4 t0 = texture2D(NormalMap, bumpCoord0) * 2.0 - 1.0;
+    vec4 t1 = texture2D(NormalMap, bumpCoord1) * 2.0 - 1.0;
+    vec4 t2 = texture2D(NormalMap, bumpCoord2) * 2.0 - 1.0;
+    vec3 N = t0.xyz + t1.xyz + t2.xyz;
+
+    N = normalize(rotMatrix * N);
+
+	// reflection
+    vec3 E = normalize(eyeVector);
+    vec3 R = reflect(E, N);
+    // Ogre conversion for cube map lookup
+    R.z = -R.z;
+
+    vec4 reflection = textureCube(EnvironmentMap, R, reflectionBlur);
+    // cheap hdr effect
+    reflection.rgb *= (reflection.r + reflection.g + reflection.b) * hdrMultiplier;
+
+	// fresnel
+    float facing = 1.0 - dot(-E, N);
+    float fresnel = clamp(fresnelBias + pow(facing, fresnelPower), 0.0, 1.0);
+
+    vec4 waterColor = mix(shallowColor, deepColor, facing) * waterAmount;
+
+    reflection = mix(waterColor,  reflection * reflectionColor, fresnel) * reflectionAmount;
+    gl_FragColor = waterColor + reflection;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/Ocean2GLSL.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,92 @@
+/*********************************************************************NVMH3****
+Copyright NVIDIA Corporation 2003
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
+BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
+WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
+BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
+ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Comments:
+	Simple ocean shader with animated bump map and geometric waves
+	Based partly on "Effective Water Simulation From Physical Models", GPU Gems
+
+11 Aug 05: converted from HLSL to GLSL by Jeff Doyle (nfz) to work in Ogre
+
+******************************************************************************/
+
+uniform vec3 eyePosition;
+uniform float BumpScale;
+uniform vec2 textureScale;
+uniform vec2 bumpSpeed;
+uniform float time;
+uniform float waveFreq;
+uniform float waveAmp;
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec4 uv0;
+
+varying mat3 rotMatrix; //  transform from tangent to obj space
+varying vec2 bumpCoord0;
+varying vec2 bumpCoord1;
+varying vec2 bumpCoord2;
+varying vec3 eyeVector;
+
+// wave functions
+struct Wave {
+  float freq;  // 2*PI / wavelength
+  float amp;   // amplitude
+  float phase; // speed * 2*PI / wavelength
+  vec2 dir;
+};
+
+
+void main(void)
+{
+	#define NWAVES 2
+
+	Wave wave[NWAVES];
+
+	wave[0] = Wave( waveFreq, waveAmp, 0.5, vec2(-1, 0) );
+	wave[1] = Wave( 3.0 * waveFreq, 0.33 * waveAmp, 1.7, vec2(-0.7, 0.7) );
+
+    vec4 P = vertex;
+
+	// sum waves
+	float ddx = 0.0, ddy = 0.0;
+	float deriv;
+	float angle;
+
+	// wave synthesis using two sine waves at different frequencies and phase shift
+	for(int i = 0; i<NWAVES; ++i)
+	{
+		angle = dot(wave[i].dir, P.xz) * wave[i].freq + time * wave[i].phase;
+		P.y += wave[i].amp * sin( angle );
+		// calculate derivate of wave function
+		deriv = wave[i].freq * wave[i].amp * cos(angle);
+		ddx -= deriv * wave[i].dir.x;
+		ddy -= deriv * wave[i].dir.y;
+	}
+
+	// compute the 3x3 transform from tangent space to object space
+	// compute tangent basis
+    vec3 T = normalize(vec3(1.0, ddy, 0.0)) * BumpScale;
+    vec3 B = normalize(vec3(0.0, ddx, 1.0)) * BumpScale;
+    vec3 N = normalize(vec3(ddx, 1.0, ddy));
+
+	rotMatrix = mat3(T, B, N);
+
+	gl_Position = worldViewProj * P;
+
+	// calculate texture coordinates for normal map lookup
+	bumpCoord0.xy = uv0.xy * textureScale + time * bumpSpeed;
+	bumpCoord1.xy = uv0.xy * textureScale * 2.0 + time * bumpSpeed * 4.0;
+	bumpCoord2.xy = uv0.xy * textureScale * 4.0 + time * bumpSpeed * 8.0;
+
+	eyeVector = P.xyz - eyePosition; // eye position in vertex space
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,41 @@
+#version 120
+
+uniform vec3 lightDiffuse;
+uniform vec3 lightSpecular;
+uniform vec4 scaleBias;
+
+uniform sampler2D normalHeightMap;
+uniform sampler2D diffuseMap;
+
+varying vec3 oEyeDir;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oUv0;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+    return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+    // Get the height using the tex coords
+    float height = texture2D(normalHeightMap, oUv0.xy).a;
+
+    // Calculate displacement
+    float displacement = (height * scaleBias.x) + scaleBias.y;
+
+    vec3 uv2 = vec3(oUv0.xy, 1.0);
+
+    // calculate the new tex coord to use for normal and diffuse
+    vec2 newTexCoord = ((oEyeDir * displacement) + uv2).xy;
+
+    // get the new normal and diffuse values
+    vec3 normal = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+    vec3 diffuse = texture2D(diffuseMap, newTexCoord).xyz;
+    vec3 specular = pow(clamp(dot(normal, oHalfAngle), 0.0, 1.0), 32.0) * lightSpecular;
+
+    vec3 col = diffuse * (clamp(dot(normal, oLightDir), 0.0, 1.0) * lightDiffuse) + specular;
+    gl_FragColor = vec4(col, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,68 @@
+#version 120
+
+uniform vec4 lightDiffuse;
+uniform vec4 scaleBias;
+uniform vec4 spotParams;
+uniform vec4 lightDiffuse1;
+uniform vec4 spotParams1;
+
+uniform sampler2D normalHeightMap;
+uniform sampler2D diffuseMap;
+uniform sampler2D shadowMap1;
+uniform sampler2D shadowMap2;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec3 tangentSpotDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+	// get the height using the tex coords
+	float height = texture2D(normalHeightMap, oUv0.xy).a;
+	// scale and bias factors	
+	float scale = scaleBias.x;
+	float bias = scaleBias.y;
+
+	// calculate displacement	
+	float displacement = (height * scale) + bias;
+	//float displacement = (height * 0.04) - 0.02;
+	
+	vec3 scaledEyeDir = tangentEyeDir * displacement;
+	
+	// calculate the new tex coord to use for normal and diffuse
+	vec2 newTexCoord = (scaledEyeDir + oUv0.xyz).xy;
+	
+	// get the new normal and diffuse values
+	vec3 normal = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+	vec4 diffuse = texture2D(diffuseMap, newTexCoord);
+	
+	vec4 col1 = diffuse * clamp(dot(normal, tangentLightDir[0]),0.0,1.0) * lightDiffuse;
+	// factor in spotlight angle
+	float rho = clamp(dot(tangentSpotDir[0], tangentLightDir[0]),0.0,1.0);
+	// factor = (rho - cos(outer/2) / cos(inner/2) - cos(outer/2)) ^ falloff
+	float spotFactor = pow(
+		clamp(rho - spotParams.y,0.0,1.0) / (spotParams.x - spotParams.y), spotParams.z);
+	col1 = col1 * spotFactor;
+	vec4 col2 = diffuse * clamp(dot(normal, tangentLightDir[1]),0.0,1.0) * lightDiffuse1;
+	// factor in spotlight angle
+	rho = clamp(dot(tangentSpotDir[1], tangentLightDir[1]),0.0,1.0);
+	// factor = (rho - cos(outer/2) / cos(inner/2) - cos(outer/2)) ^ falloff
+	spotFactor = pow(
+		clamp(rho - spotParams1.y,0.0,1.0) / (spotParams1.x - spotParams1.y), spotParams1.z);
+	col2 = col2 * spotFactor;
+
+	// shadow textures
+	col1 = col1 * texture2DProj(shadowMap1, shadowUV[0]);
+	col2 = col2 * texture2DProj(shadowMap2, shadowUV[1]);
+
+	gl_FragColor = col1 + col2;
+
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingShadowsVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,60 @@
+#version 120
+
+uniform vec4 lightPosition; // object space 
+uniform vec4 lightPosition1; // object space 
+uniform vec4 eyePosition;   // object space 
+uniform vec4 spotDirection; // object space
+uniform vec4 spotDirection1; // object space
+uniform mat4 worldViewProj; // not actually used but here for compat with HLSL
+uniform mat4 worldMatrix;
+uniform mat4 texViewProj1;
+uniform mat4 texViewProj2;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec3 tangentSpotDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+attribute vec3 tangent;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 uv0;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+
+	vec4 worldPos = worldMatrix * position;
+
+    oUv0 = uv0;
+
+	shadowUV[0] = texViewProj1 * worldPos;
+	shadowUV[1] = texViewProj2 * worldPos;
+
+	// calculate tangent space light vector 
+	// Get object space light direction 
+    vec3 lightDir = normalize(lightPosition.xyz -  (position.xyz * lightPosition.w));
+	vec3 lightDir1 = normalize(lightPosition1.xyz -  (position.xyz * lightPosition1.w));
+	
+	vec3 eyeDir = (eyePosition - position).xyz; 
+
+	// Calculate the binormal (NB we assume both normal and tangent are 
+	// already normalised) 
+	vec3 binormal = cross(normal, tangent); 
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+    
+	// Transform the light vector according to this matrix 
+	tangentLightDir[0] = normalize(rotation * lightDir); 
+	tangentLightDir[1] = normalize(rotation * lightDir1); 
+	// Invert the Y on the eye dir since we'll be using this to alter UVs and
+	// GL has Y inverted
+	tangentEyeDir = normalize(rotation * eyeDir) * vec3(1.0, -1.0, 1.0); 
+
+	tangentSpotDir[0] = normalize(rotation * -spotDirection.xyz);
+	tangentSpotDir[1] = normalize(rotation * -spotDirection1.xyz);	
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMappingVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,47 @@
+#version 120
+
+uniform vec4 lightPosition; // object space
+uniform vec3 eyePosition;   // object space
+uniform mat4 worldViewProj; // not actually used but here for compat with HLSL
+
+varying vec3 oEyeDir;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oUv0;
+
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+attribute vec4 position;
+
+/* Vertex program that moves light and eye vectors into texture tangent space at vertex */
+
+void main()
+{
+    // Calculate output position
+    gl_Position = worldViewProj * position;
+
+    // Pass the main uvs straight through unchanged
+    oUv0 = uv0;
+
+    vec3 lightDir = lightPosition.xyz - (position.xyz * lightPosition.w);
+
+    vec3 eyeDir = eyePosition - position.xyz;
+
+    // Calculate the binormal (NB we assume both normal and tangent are
+    // already normalised)
+    // NB looks like nvidia cross params are BACKWARDS to what you'd expect
+    // this equates to NxT, not TxN
+    vec3 localbinormal = cross(tangent, normal);
+
+    // Form a rotation matrix out of the vectors, column major for glsl es
+	mat3 TBN = mat3(vec3(tangent[0], localbinormal[0], normal[0]),
+						vec3(tangent[1], localbinormal[1], normal[1]),
+						vec3(tangent[2], localbinormal[2], normal[2]));
+    
+
+    // Transform the light vector according to this matrix
+    oLightDir = normalize(TBN * lightDir);
+    oEyeDir = normalize(TBN * eyeDir);
+    oHalfAngle = normalize(oEyeDir + oLightDir);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMapping_specular.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMapping_specular.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/OffsetMapping_specular.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,46 @@
+#version 120
+
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform vec4 scaleBias;
+uniform float exponent;
+uniform sampler2D normalHeightMap;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+vec4 lit(float NdotL, float NdotH, float m) {
+
+  float ambient = 1.0;
+  float diffuse = max(NdotL, 0.0);
+  float specular = step(0.0, NdotL) * max(NdotH * m, 0.0);
+
+  return vec4(ambient, diffuse, specular, 1.0);
+}
+
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+/*
+  Pixel Shader for doing bump mapping with parallax plus diffuse and specular lighting by masterfalcon
+*/
+void main()
+{
+	float height = texture2D(normalHeightMap, oUv0.xy).a;
+	float displacement = (height * scaleBias.x) + scaleBias.y;
+	vec2 newTexCoord = ((tangentEyeDir * displacement) + oUv0.xyz).xy;
+	vec3 bumpVec = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+	vec3 N = normalize(bumpVec);
+
+	vec3 halfAngle = normalize(tangentEyeDir + tangentLightDir[0]); 
+	float NdotL = dot(normalize(tangentLightDir[0]), N);
+	float NdotH = dot(normalize(halfAngle), N); 
+
+	vec4 Lit = lit(NdotL, NdotH, exponent);
+	
+	gl_FragColor = lightDiffuse * Lit.y + lightSpecular * Lit.z;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughFP.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,9 @@
+varying vec4 colour;
+
+/*
+  Basic ambient lighting fragment program for GLSL.
+*/
+void main()
+{
+	gl_FragColor = colour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughVP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughVP.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/PassthroughVP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,9 @@
+uniform mat4 WorldViewProj;
+attribute vec4 vertex;
+
+
+void main()
+{
+    // Transform the vertex (ModelViewProj matrix).
+    gl_Position = WorldViewProj*vertex;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/ShaderInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/ShaderInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/ShaderInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,117 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 120
+
+//Vertex input
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+//uniform mat4x3 worldMatrix3x4Array[80];
+#ifdef ST_DUAL_QUATERNION
+uniform vec4 worldDualQuaternion2x4Array[240];
+#else
+uniform vec4 worldMatrix3x4Array[240]; //240 = 80*3
+#endif
+
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	varying vec2 depth;
+#else
+	varying vec2 _uv0;
+	varying vec3 oNormal;
+	varying vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		varying vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+vec4 worldPos;
+vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	int idx = int(blendIndices[0]) * 2;
+	mat2x4 blendDQ;
+	blendDQ[0] = worldDualQuaternion2x4Array[idx];
+	blendDQ[1] = worldDualQuaternion2x4Array[idx + 1];
+#ifdef BONE_TWO_WEIGHTS
+	int idx2 = int(blendIndices[1]) * 2;
+	mat2x4 blendDQ2;
+ 	blendDQ2[0] = worldDualQuaternion2x4Array[idx2];
+	blendDQ2[1] = worldDualQuaternion2x4Array[idx2 + 1];
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	int idx = int(blendIndices[0]) * 3;
+	worldMatrix[0] = worldMatrix3x4Array[idx];
+	worldMatrix[1] = worldMatrix3x4Array[idx + 1];
+	worldMatrix[2] = worldMatrix3x4Array[idx + 2];
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/ShowNormals.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/ShowNormals.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/ShowNormals.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 120
+
+attribute vec4 position;
+attribute vec3 normal;
+
+varying vec4 oUv0;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+    gl_Position = worldViewProj * position;
+    oUv0 = vec4(normal, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/ShowTangents.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/ShowTangents.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/ShowTangents.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 120
+
+attribute vec4 position;
+attribute vec3 tangent;
+
+varying vec4 oUv0;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	oUv0 = vec4(tangent, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/ShowUV.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/ShowUV.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/ShowUV.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,10 @@
+#version 120
+
+varying vec2 ambientUV;
+
+// Basic fragment program to display UV
+void main()
+{
+	// wrap values using fract
+	gl_FragColor = vec4(fract(ambientUV.x), fract(ambientUV.y), 0.0, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/ShowUVdir3D.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/ShowUVdir3D.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/ShowUVdir3D.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,10 @@
+#version 120
+
+varying vec4 oUv0;
+
+// Basic fragment program to display 3d uv
+void main()
+{
+	vec3 n = normalize(oUv0.xyz);
+	gl_FragColor = vec4(n.x, n.y, n.z, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2_vp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,15 @@
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2a_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2a_vp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex2a_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,16 @@
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    oUv0 = uv0;
+    oUv1 = -vertex.xy;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex3_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex3_vp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex3_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,19 @@
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec2 oUv2;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+    oUv2 = oUv0;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex4_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex4_vp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/StdQuad_Tex4_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,21 @@
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec2 oUv2;
+varying vec2 oUv3;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+    oUv2 = oUv0;
+    oUv3 = oUv0;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/VTFInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/VTFInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/VTFInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,113 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 120
+
+//Vertex input
+attribute vec4 vertex;
+attribute vec3 normal;
+
+#ifdef BONE_TWO_WEIGHTS
+	attribute vec4 blendWeights;
+#endif
+
+attribute vec4 uv0;
+attribute vec4 uv1;
+attribute vec4 uv2;
+attribute vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform sampler2D matrixTexture;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	varying vec2 depth;
+#else
+	varying vec2 _uv0;
+	varying vec3 oNormal;
+	varying vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		varying vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos;
+	vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	mat2x4 blendDQ;	
+	blendDQ[0] = texture2D( matrixTexture, uv1.xy );
+	blendDQ[1] = texture2D( matrixTexture, uv1.zy );
+#ifdef BONE_TWO_WEIGHTS
+	mat2x4 blendDQ2;
+	blendDQ2[0] = texture2D( matrixTexture, uv2.xy );
+	blendDQ2[1] = texture2D( matrixTexture, uv2.zw );
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	worldMatrix[0] = texture2D( matrixTexture, uv1.xy );
+	worldMatrix[1] = texture2D( matrixTexture, uv1.zw );
+	worldMatrix[2] = texture2D( matrixTexture, uv2.xy );
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/hdr_tonemap_util.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/hdr_tonemap_util.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/hdr_tonemap_util.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,29 @@
+const float MIDDLE_GREY = 0.72;
+const float FUDGE = 0.001;
+const float L_WHITE = 1.5;
+
+/** Tone mapping function 
+ at note Only affects rgb, not a
+ at param inColour The HDR colour
+ at param lum The scene lumninence 
+ at returns Tone mapped colour
+*/
+vec4 toneMap(in vec4 inColour, in float lum)
+{
+	// From Reinhard et al
+	// "Photographic Tone Reproduction for Digital Images"
+	
+	// Initial luminence scaling (equation 2)
+    inColour.rgb *= MIDDLE_GREY / (FUDGE + lum);
+
+	// Control white out (equation 4 nom)
+    inColour.rgb *= (1.0 + inColour.rgb / L_WHITE);
+
+	// Final mapping (equation 4 denom)
+	inColour.rgb /= (1.0 + inColour.rgb);
+	
+	return inColour;
+
+}
+
+

Added: data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.frag
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.frag	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.frag	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,45 @@
+// oceanGLSL.frag
+// fragment program for Ocean water simulation
+// 05 Aug 2005
+// adapted for Ogre by nfz
+// converted from HLSL to GLSL
+// original shader source from Render Monkey 1.6 Reflections Refractions.rfx
+
+// 06 Aug 2005: moved uvw calculation from fragment program into vertex program 
+
+uniform float fadeBias;
+uniform float fadeExp;
+uniform vec4 waterColor;
+uniform sampler3D Noise;
+uniform samplerCube skyBox;
+
+varying vec3 uvw;
+varying vec3 oNormal;
+varying vec3 vVec;
+
+void main(void)
+{
+   vec3 noisy = texture3D(Noise, uvw).xyz;
+   
+   // convert to signed noise
+   vec3 bump = 2.0 * noisy - 1.0;
+   bump.xz *= 0.15;
+   // Make sure the normal always points upwards
+   // note that Ogres y axis is vertical (RM Z axis is vertical)
+   bump.y = 0.8 * abs(bump.y) + 0.2;
+   // Offset the surface normal with the bump
+   bump = normalize(oNormal + bump);
+
+   // Find the reflection vector
+   vec3 normView = normalize(vVec);
+   vec3 reflVec = reflect(normView, bump);
+   // Ogre has z flipped for cubemaps
+   reflVec.z = -reflVec.z;
+   vec4 refl = textureCube(skyBox, reflVec);
+
+   // set up for fresnel calc
+   float lrp = 1.0 - dot(-normView, bump);
+   
+   // Interpolate between the water color and reflection for fresnel effect
+   gl_FragColor = mix(waterColor, refl, clamp(fadeBias + pow(lrp, fadeExp), 0.0, 1.0) );
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/oceanGLSL.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,35 @@
+// oceanGLSL.vert
+// vertex program for Ocean water simulation
+// 05 Aug 2005
+// adapted for Ogre by nfz
+// converted from HLSL to GLSL
+// original shader source from Render Monkey 1.6 Reflections Refractions.rfx
+
+// 06 Aug 2005: moved uvw calculation from fragment program into vertex program 
+
+uniform vec3 scale;
+uniform vec3 eyePosition;
+uniform vec2 waveSpeed;
+uniform float noiseSpeed;
+uniform float time_0_X;
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+
+varying vec3 uvw;
+varying vec3 oNormal;
+varying vec3 vVec;
+
+void main(void)
+{
+   gl_Position = worldViewProj * vertex;
+   
+   //  the view vector needs to be in vertex space
+   vVec = vertex.xyz - eyePosition;
+   oNormal = normal;
+   // uvw is the calculated uvw coordinates based on vertex position
+   uvw = vertex.xyz * scale.xyz;
+   uvw.xz += waveSpeed * time_0_X;
+   uvw.y += uvw.z + noiseSpeed * time_0_X;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/shadows.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/shadows.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/shadows.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,146 @@
+/* Copyright Torus Knot Software Ltd 2012-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+Adapted by Matias N. Goldberg (Dark Sylinc) to GLSL based on the Cg file shadows.cg
+*/
+
+// Simple PCF 
+// Number of samples in one dimension (square for total samples)
+#define NUM_SHADOW_SAMPLES_1D 2.0
+#define SHADOW_FILTER_SCALE 1.0
+
+#define SHADOW_SAMPLES NUM_SHADOW_SAMPLES_1D*NUM_SHADOW_SAMPLES_1D
+
+vec4 offsetSample(vec4 uv, vec2 offset, float invMapSize)
+{
+	return vec4(uv.xy + offset * invMapSize * uv.w, uv.z, uv.w);
+}
+
+float calcDepthShadow(sampler2DShadow shadowMap, vec4 uv, float invShadowMapSize)
+{
+	// 4-sample PCF
+	
+	float shadow = 0.0;
+	float offset = (NUM_SHADOW_SAMPLES_1D/2.0 - 0.5) * SHADOW_FILTER_SCALE;
+	for (float y = -offset; y <= offset; y += SHADOW_FILTER_SCALE)
+		for (float x = -offset; x <= offset; x += SHADOW_FILTER_SCALE)
+		{
+			float depth = vec4(shadow2DProj(shadowMap, offsetSample(uv, vec2(x, y), invShadowMapSize))).x;
+			if (depth >= 1.0 || depth >= uv.z)
+				shadow += 1.0;
+		}
+
+	shadow /= SHADOW_SAMPLES;
+
+	return shadow;
+}
+
+
+float calcSimpleShadow(sampler2DShadow shadowMap, vec4 shadowMapPos)
+{
+	return vec4(shadow2DProj(shadowMap, shadowMapPos)).x;
+}
+
+float calcPSSMDepthShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	float shadow;
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.3, 0.0, 0, 0);
+		shadow = calcDepthShadow(shadowMap0, lsPos0, invShadowmapSize0);
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0, 0.3, 0, 0);
+		shadow = calcDepthShadow(shadowMap1, lsPos1, invShadowmapSize1);
+	}
+	else
+	{
+		splitColour = vec4(0.0, 0.0, 0.3, 0);
+		shadow = calcDepthShadow(shadowMap2, lsPos2, invShadowmapSize2);
+	}
+
+	return shadow;
+}
+
+float calcPSSMSimpleShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	float shadow;
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.3, 0.0, 0, 0);
+		shadow = calcSimpleShadow(shadowMap0, lsPos0);
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0, 0.3, 0, 0);
+		shadow = calcSimpleShadow(shadowMap1, lsPos1);
+	}
+	else
+	{
+		splitColour = vec4(0.0, 0.0, 0.3, 0);
+		shadow = calcSimpleShadow(shadowMap2, lsPos2);
+	}
+
+	return shadow;
+}
+
+
+
+vec3 calcPSSMDebugShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		//splitColour = vec4(0.3, 0.0, 0, 0);
+		//splitColour = lsPos0 / lsPos0.w;
+		splitColour.rgb = vec4(shadow2DProj(shadowMap0, lsPos0)).xxx;
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		//splitColour = vec4(0, 0.3, 0, 0);
+		//splitColour = lsPos1 / lsPos1.w;
+		splitColour.rgb = vec4(shadow2DProj(shadowMap1, lsPos1)).xxx;
+	}
+	else
+	{
+		//splitColour = vec4(0.0, 0.0, 0.3, 0);
+		//splitColour = lsPos2 / lsPos2.w;
+		splitColour.rgb = vec4(shadow2DProj(shadowMap2, lsPos2)).xxx;
+	}
+
+	return splitColour.rgb;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsShadowCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsShadowCasterVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsShadowCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,33 @@
+#version 120
+// Example GLSL program for skinning with two bone weights per vertex
+
+attribute vec4 vertex;
+attribute vec4 uv0;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+uniform mat4x3 worldMatrix3x4Array[24];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 ambient;
+
+void main()
+{
+	vec3 blendPos = vec3(0,0,0);
+
+	for (int bone = 0; bone < 2; ++bone)
+	{
+        // ATI GLSL compiler can't handle indexing an array within an array so calculate the inner index first
+		int idx = int(blendIndices[bone]);
+
+		// now weight this into final
+		float weight = blendWeights[bone];
+		blendPos += worldMatrix3x4Array[idx]* vertex * weight;
+	}
+
+	// apply view / projection to position
+	gl_Position = viewProjectionMatrix * vec4(blendPos, 1);
+	
+	gl_FrontSecondaryColor = vec4(0,0,0,0);
+	gl_FrontColor = ambient;
+	gl_TexCoord[0] = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL120/skinningTwoWeightsVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,50 @@
+#version 120
+// Example GLSL program for skinning with two bone weights per vertex
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 uv0;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+// ogre <> glsl notation is transposed
+uniform mat4x3 worldMatrix3x4Array[24];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 lightPos[2];
+uniform vec4 lightDiffuseColour[2];
+uniform vec4 ambient;
+
+void main()
+{
+	vec3 blendPos = vec3(0.0, 0.0, 0.0);
+	vec3 blendNorm = vec3(0.0, 0.0, 0.0);
+
+	for (int bone = 0; bone < 2; ++bone)
+	{
+        // ATI GLSL compiler can't handle indexing an array within an array so calculate the inner index first
+		int idx = int(blendIndices[bone]);
+
+		// now weight this into final
+		float weight = blendWeights[bone];
+		blendPos += worldMatrix3x4Array[idx]* vertex * weight;
+
+		mat3 worldRotMatrix = mat3(worldMatrix3x4Array[idx]);
+		blendNorm += (worldRotMatrix * normal) * weight;
+	}
+
+	blendNorm = normalize(blendNorm);
+
+	// apply view / projection to position
+	gl_Position = viewProjectionMatrix * vec4(blendPos, 1.0);
+
+	// simple vertex lighting model
+	vec3 lightDir0 = normalize(
+		lightPos[0].xyz -  (blendPos * lightPos[0].w));
+	vec3 lightDir1 = normalize(
+		lightPos[1].xyz -  (blendPos * lightPos[1].w));
+
+	gl_FrontColor = gl_FrontMaterial.diffuse * (ambient + (clamp(dot(lightDir0, blendNorm), 0.0, 1.0) * lightDiffuseColour[0]) +
+		(clamp(dot(lightDir1, blendNorm), 0.0, 1.0) * lightDiffuseColour[1]));
+
+	gl_TexCoord[0] = uv0;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ASCIIFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ASCIIFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ASCIIFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,37 +1,37 @@
-#version 150
-
-in vec4 pos;
-in vec2 oUv0;
-out vec4 fragColour;
-
-uniform sampler2D RT;
-uniform sampler3D chars;
-uniform vec2 numTiles;
-uniform vec2 iNumTiles;
-uniform vec2 iNumTiles2;
-uniform vec4 lum;
-uniform float charBias;
-
-void main()
-{
-    vec3 local;
-
-	//sample RT
-	local.xy = mod(oUv0, iNumTiles);
-	vec2 middle = oUv0 - local.xy;
-	local.xy = local.xy * numTiles;
-	
-	//iNumTiles2 = iNumTiles / 2
-	middle = middle + iNumTiles2;
-	vec4 c = texture(RT, middle);
-	
-	//multiply luminance by charbias , beacause not all slices of the ascii
-	//volume texture are used
-	local.z = dot(c , lum)*charBias;
-	
-	//fix to brighten the dark pixels with small characters
-	//c *= lerp(2.0,1.0, local.z);
-	
-	c *= texture(chars, local);
-	fragColour = c;
-}
+#version 150
+
+in vec4 pos;
+in vec2 oUv0;
+out vec4 fragColour;
+
+uniform sampler2D RT;
+uniform sampler3D chars;
+uniform vec2 numTiles;
+uniform vec2 iNumTiles;
+uniform vec2 iNumTiles2;
+uniform vec4 lum;
+uniform float charBias;
+
+void main()
+{
+    vec3 local;
+
+	//sample RT
+	local.xy = mod(oUv0, iNumTiles);
+	vec2 middle = oUv0 - local.xy;
+	local.xy = local.xy * numTiles;
+	
+	//iNumTiles2 = iNumTiles / 2
+	middle = middle + iNumTiles2;
+	vec4 c = texture(RT, middle);
+	
+	//multiply luminance by charbias , beacause not all slices of the ascii
+	//volume texture are used
+	local.z = dot(c , lum)*charBias;
+	
+	//fix to brighten the dark pixels with small characters
+	//c *= lerp(2.0,1.0, local.z);
+	
+	c *= texture(chars, local);
+	fragColour = c;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/AtomicFS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/AtomicFS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/AtomicFS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,94 @@
+#version 430
+
+out vec4 fragColour;
+
+uniform vec4 ColourMe[2] = vec4[](vec4(0,0,0,0),vec4(0,0,1,0));
+
+uniform bool pretty_colours;
+uniform bool image_load_store;
+
+uniform uint colour_factor[3];
+
+uniform switches 
+{
+    bool awesome;
+    // float R;
+    // vec2 GB;
+};
+
+// buffer colors
+// {
+//     float R;
+//     // vec2 GB;
+// };
+uniform colors
+{
+    float R;
+    // vec2 GB;
+};
+
+uniform more_switches
+{
+    bool more_awesome;
+} moswitch;
+
+layout(binding = 0, offset = 4) uniform atomic_uint atom_counter;
+// layout(binding = 0) uniform atomic_uint atom_counter2;
+
+// layout(binding = 0, r32ui) coherent uniform uimage2D image_data;
+layout(binding = 0, rgba8) coherent uniform image2D image_data;
+
+// Pixel shader
+void main()
+{
+    // for (int i = 0; i < 3; i++) {
+    //     uint counter = atomicCounterIncrement(atom_counter[i]);
+    // }
+
+    //uint counter = atomicCounterIncrement(atom_counter);
+
+    // uint counter2 = atomicCounterIncrement(atom_counter2);
+    // uint counter4eva = atomicCounterIncrement(atom_counter[1]);
+
+    if (pretty_colours)
+    {
+        // Test basic setting integer vectors.
+        fragColour = ColourMe[0] + ColourMe[1]; // + counter / 4E9;
+    }
+    else if (image_load_store)
+    {
+        vec4 in_colour = imageLoad(image_data, ivec2(0));
+        // ivec2 frag_coord = ivec2(clamp(gl_FragCoord.x,0,256),
+        //                          clamp(gl_FragCoord.y,0,256));
+        // vec4 in_colour = imageLoad(image_data, frag_coord);
+
+        //imageStore(image_data, ivec2(0), vec4(0,0,1,1));
+
+        // Test image load/store and atomic counters.
+        //fragColour = vec4(in_colour,0,0,1);
+        fragColour = in_colour;
+    }
+    else 
+    {
+        // Test uint, bool, and atomic counters.
+        //fragColour =  counter / 4E9 + vec4(float(colour_factor[0]) / 100, float(colour_factor[1]) / 100, float(colour_factor[2]) / 100, 1);
+        if (awesome)
+        {
+            // midnight green
+            // fragColour = vec4(0, 0.28, 0.32, 1);
+            fragColour = vec4(R, 0.28, 0.32, 1);
+        }
+        else if (moswitch.more_awesome)
+        {
+            // jade
+            fragColour = vec4(0, 0.65, 0.41, 1);
+        }
+        else
+        {
+            fragColour = vec4(1,1,1,1);
+        }
+    }
+
+    // fragColour = vec4(1,1,1,1);
+    // fragColour = mycolour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/AtomicGS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/AtomicGS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/AtomicGS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,24 @@
+#version 150
+
+// Trivial GLSL geometry shader that doubles a mesh.
+
+uniform mat4 WorldViewProj;
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 6) out;
+ 
+void main(void) 
+{
+    for (int i = 0; i < gl_in.length(); ++i) {
+        gl_Position = WorldViewProj * gl_in[i].gl_Position;
+        EmitVertex();
+    }
+    EndPrimitive();
+
+    for (int i = 0; i < gl_in.length(); ++i) {
+        const vec4 world_offset = vec4(50, 50, 50, 0);
+        gl_Position = WorldViewProj * (gl_in[i].gl_Position + world_offset);
+        EmitVertex();
+    }
+    EndPrimitive();
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/AtomicVS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/AtomicVS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/AtomicVS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,11 @@
+#version 150
+
+in vec4 vertex;
+
+uniform mat4 WorldViewProj;
+
+void main()
+{
+    //gl_Position = WorldViewProj * vertex;
+    gl_Position = vertex;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Blur0_vs.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Blur0_vs.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Blur0_vs.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,20 +1,25 @@
-#version 150
-
-out vec2 texCoord[5];
-in vec4 vertex;
-
-uniform mat4 worldViewProj;
-in vec2 uv0;
-
-void main()                    
-{
-	gl_Position = worldViewProj * vertex;
-	
-	texCoord[0]  = uv0;
-	
-	const float size = 0.01;
-	texCoord[1] = texCoord[0] + vec2(1.0, 0.0)*size;
-	texCoord[2] = texCoord[0] + vec2(2.0, 0.0)*size;
-	texCoord[3] = texCoord[0] + vec2(-1.0, 0.0)*size;
-	texCoord[4] = texCoord[0] + vec2(-2.0, 0.0)*size;
-}
+#version 150
+
+in vec4 vertex;
+// in vec2 uv0;
+out vec2 texCoord[5];
+
+// uniform mat4 worldViewProj;
+
+void main()
+{
+    // gl_Position = worldViewProj * vertex;
+
+    // texCoord[0]  = uv0;
+
+    vec2 inPos = sign(vertex.xy);
+    gl_Position = vec4(inPos.xy, 0.0, 1.0);
+
+    texCoord[0]  = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
+
+    const float size = 0.01;
+    texCoord[1] = texCoord[0] + vec2(1.0, 0.0) * size;
+    texCoord[2] = texCoord[0] + vec2(2.0, 0.0) * size;
+    texCoord[3] = texCoord[0] + vec2(-1.0, 0.0) * size;
+    texCoord[4] = texCoord[0] + vec2(-2.0, 0.0) * size;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Blur1_vs.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Blur1_vs.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Blur1_vs.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,20 +1,25 @@
-#version 150
-
-uniform mat4 worldViewProj;
-
-out vec2 texCoord[5];
-in vec4 vertex;
-in vec2 uv0;
-
-void main()
-{
-	gl_Position = worldViewProj * vertex;
-	
-	texCoord[0]  = uv0;
-	
-	const float size = 0.01;
-	texCoord[1] = texCoord[0] + vec2(0.0, 1.0)*size;
-	texCoord[2] = texCoord[0] + vec2(0.0, 2.0)*size;
-	texCoord[3] = texCoord[0] + vec2(0.0, -1.0)*size;
-	texCoord[4] = texCoord[0] + vec2(0.0, -2.0)*size;
-}
+#version 150
+
+in vec4 vertex;
+// in vec2 uv0;
+out vec2 texCoord[5];
+
+// uniform mat4 worldViewProj;
+
+void main()
+{
+    // gl_Position = worldViewProj * vertex;
+
+    // texCoord[0]  = uv0;
+
+    vec2 inPos = sign(vertex.xy);
+    gl_Position = vec4(inPos.xy, 0.0, 1.0);
+
+    texCoord[0]  = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
+
+    const float size = 0.01;
+    texCoord[1] = texCoord[0] + vec2(0.0, 1.0) * size;
+    texCoord[2] = texCoord[0] + vec2(0.0, 2.0) * size;
+    texCoord[3] = texCoord[0] + vec2(0.0, -1.0) * size;
+    texCoord[4] = texCoord[0] + vec2(0.0, -2.0) * size;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Blur_ps.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Blur_ps.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Blur_ps.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,18 +1,18 @@
-#version 150
-
-uniform sampler2D tex0;
-
-in vec2 texCoord[5];
-
-out vec4 fragColour;
-
-void main()
-{
-	vec4 sum = texture(tex0, texCoord[0]) + 
-			   texture(tex0, texCoord[1]) +
-			   texture(tex0, texCoord[2]) + 
-			   texture(tex0, texCoord[3]) +
-			   texture(tex0, texCoord[4]);
-	fragColour = sum / 5.0;
-}
-
+#version 150
+
+uniform sampler2D tex0;
+
+in vec2 texCoord[5];
+
+out vec4 fragColour;
+
+void main()
+{
+	vec4 sum = texture(tex0, texCoord[0]) + 
+			   texture(tex0, texCoord[1]) +
+			   texture(tex0, texCoord[2]) + 
+			   texture(tex0, texCoord[3]) +
+			   texture(tex0, texCoord[4]);
+	fragColour = sum / 5.0;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,9 +1,9 @@
-#version 150
-
-in vec2 NDotV;
-out vec4 fragColour;
-
-void main()
-{
-   fragColour = vec4(NDotV.x / 2.0);
-}
+#version 150
+
+in vec2 NDotV;
+out vec4 fragColour;
+
+void main()
+{
+   fragColour = vec4(NDotV.x / 2.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ColdCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,15 +1,15 @@
-#version 150
-
-uniform mat4 worldViewProj;
-uniform vec3 eyePosition;
-in vec4 position;
-in vec4 normal;
-out vec2 NDotV;
-
-void main()
-{
-   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
-   eyeDir = normalize(eyeDir);
-   gl_Position = worldViewProj * position;
-   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
-}
+#version 150
+
+uniform mat4 worldViewProj;
+uniform vec3 eyePosition;
+in vec4 position;
+in vec4 normal;
+out vec2 NDotV;
+
+void main()
+{
+   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
+   eyeDir = normalize(eyeDir);
+   gl_Position = worldViewProj * position;
+   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Combine_fp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Combine_fp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Combine_fp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,16 +1,16 @@
-#version 150
-
-uniform sampler2D RT;
-uniform sampler2D Sum;
-uniform float blur;
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main()
-{
-   vec4 render = texture(RT, oUv0);
-   vec4 sum = texture(Sum, oUv0);
-
-   fragColour = mix(render, sum, blur);
-}
+#version 150
+
+uniform sampler2D RT;
+uniform sampler2D Sum;
+uniform float blur;
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main()
+{
+    vec4 render = texture(RT, oUv0);
+    vec4 sum = texture(Sum, oUv0);
+
+    fragColour = mix(render, sum, blur);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,150 +1,150 @@
-#version 150
-/* Copyright Torus Knot Software Ltd 2000-2013
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-in vec3 diffuseUV;
-uniform sampler2D diffuseMap;
-uniform vec3 materialAmbient;
-
-#if !SHADOWCASTER
-in vec3 col;
-#endif
-#if DEPTH_SHADOWCASTER
-in float depth;
-#endif
-
-#if DEPTH_SHADOWRECEIVER
-in vec4 lightSpacePos0;
-in vec4 lightSpacePos1;
-in vec4 lightSpacePos2;
-uniform sampler2D shadowMap0;
-uniform sampler2D shadowMap1;
-uniform sampler2D shadowMap2;
-uniform float inverseShadowmapSize0;
-uniform float inverseShadowmapSize1;
-uniform float inverseShadowmapSize2;
-uniform vec4 pssmSplitPoints;
-#endif
-	
-#if SHADOWCASTER
-uniform vec3 shadowColour;
-#endif
-#if FOG
-uniform vec3 fogColour;
-#endif
-
-out vec4 fragColour;
-
-// Number of samples in one dimension (square for total samples)
-#define NUM_SHADOW_SAMPLES_1D 2.0
-#define SHADOW_FILTER_SCALE 1
-
-#define SHADOW_SAMPLES NUM_SHADOW_SAMPLES_1D*NUM_SHADOW_SAMPLES_1D
-
-vec4 offsetSample(vec4 uv, vec2 offset, float invMapSize)
-{
-	return vec4(uv.xy + offset * invMapSize * uv.w, uv.z, uv.w);
-}
-
-float calcDepthShadow(sampler2D shadowMap, vec4 uv, float invShadowMapSize)
-{
-	// 4-sample PCF
-	
-	float shadow = 0.0;
-	float offset = (NUM_SHADOW_SAMPLES_1D/2 - 0.5) * SHADOW_FILTER_SCALE;
-	for (float y = -offset; y <= offset; y += SHADOW_FILTER_SCALE)
-		for (float x = -offset; x <= offset; x += SHADOW_FILTER_SCALE)
-		{
-			float depth = textureProj(shadowMap, offsetSample(uv, vec2(x, y), invShadowMapSize)).x;
-			if (depth >= 1 || depth >= uv.z)
-				shadow += 1.0;
-		}
-
-	shadow /= SHADOW_SAMPLES;
-
-	return shadow;
-}
-
-float calcPSSMDepthShadow(sampler2D shadowMap0, sampler2D shadowMap1, sampler2D shadowMap2, 
-						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
-						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
-						   vec4 pssmSplitPoints, float camDepth)
-{
-
-	float shadow;
-	vec4 splitColour;
-	// calculate shadow
-	if (camDepth <= pssmSplitPoints.y)
-	{
-		splitColour = vec4(0.3, 0.0, 0, 0);
-		shadow = calcDepthShadow(shadowMap0, lsPos0, invShadowmapSize0);
-	}
-	else if (camDepth <= pssmSplitPoints.z)
-	{
-		splitColour = vec4(0, 0.3, 0, 0);
-		shadow = calcDepthShadow(shadowMap1, lsPos1, invShadowmapSize1);
-	}
-	else
-	{
-		splitColour = vec4(0.0, 0.0, 0.3, 0);
-		shadow = calcDepthShadow(shadowMap2, lsPos2, invShadowmapSize2);
-	}
-
-	return shadow;
-}
-
-void main()
-{
-    // look up the diffuse map layer
-    vec4 texDiffuse = texture(diffuseMap, diffuseUV.xy);
-    
-#if SHADOWCASTER
-#  if DEPTH_SHADOWCASTER
-	// early-out with depth (we still include alpha for those cards that support it)
-	fragColour = vec4(depth, depth, depth, 1);
-#  else
-	fragColour = vec4(shadowColour.xyz, texDiffuse.a);
-#  endif
-
-#else
-    // compute the ambient contribution (pulled from the diffuse map)
-    vec3 vAmbient = texDiffuse.xyz * materialAmbient.xyz;
-    vec3 vColor3 = texDiffuse.rgb * col.rgb;
-
-#  if DEPTH_SHADOWRECEIVER
-	float camDepth = diffuseUV.z;
-	float shadow = calcPSSMDepthShadow(shadowMap0, shadowMap1, shadowMap2, 
-		lightSpacePos0, lightSpacePos1, lightSpacePos2,
-		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
-		pssmSplitPoints, camDepth);
-	vColor3 *= shadow;
-#  endif
-
-    fragColour = vec4(vColor3 + vAmbient, texDiffuse.a);
-    
-#  if FOG
-    // if fog is active, interpolate between the unfogged color and the fog color
-    // based on vertex shader fog value
-    fragColour.rgb = mix(vColor.rgb, fogColour, diffuseUV.z).rgb;
-#  endif
-
-#endif
-}
+#version 150
+/* Copyright Torus Knot Software Ltd 2000-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+in vec3 diffuseUV;
+uniform sampler2D diffuseMap;
+uniform vec3 materialAmbient;
+
+#if !SHADOWCASTER
+in vec3 col;
+#endif
+#if DEPTH_SHADOWCASTER
+in float depth;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+in vec4 lightSpacePos0;
+in vec4 lightSpacePos1;
+in vec4 lightSpacePos2;
+uniform sampler2D shadowMap0;
+uniform sampler2D shadowMap1;
+uniform sampler2D shadowMap2;
+uniform float inverseShadowmapSize0;
+uniform float inverseShadowmapSize1;
+uniform float inverseShadowmapSize2;
+uniform vec4 pssmSplitPoints;
+#endif
+	
+#if SHADOWCASTER
+uniform vec3 shadowColour;
+#endif
+#if FOG
+uniform vec3 fogColour;
+#endif
+
+out vec4 fragColour;
+
+// Number of samples in one dimension (square for total samples)
+#define NUM_SHADOW_SAMPLES_1D 2.0
+#define SHADOW_FILTER_SCALE 1
+
+#define SHADOW_SAMPLES NUM_SHADOW_SAMPLES_1D*NUM_SHADOW_SAMPLES_1D
+
+vec4 offsetSample(vec4 uv, vec2 offset, float invMapSize)
+{
+	return vec4(uv.xy + offset * invMapSize * uv.w, uv.z, uv.w);
+}
+
+float calcDepthShadow(sampler2D shadowMap, vec4 uv, float invShadowMapSize)
+{
+	// 4-sample PCF
+	
+	float shadow = 0.0;
+	float offset = (NUM_SHADOW_SAMPLES_1D/2 - 0.5) * SHADOW_FILTER_SCALE;
+	for (float y = -offset; y <= offset; y += SHADOW_FILTER_SCALE)
+		for (float x = -offset; x <= offset; x += SHADOW_FILTER_SCALE)
+		{
+			float depth = textureProj(shadowMap, offsetSample(uv, vec2(x, y), invShadowMapSize)).x;
+			if (depth >= 1 || depth >= uv.z)
+				shadow += 1.0;
+		}
+
+	shadow /= SHADOW_SAMPLES;
+
+	return shadow;
+}
+
+float calcPSSMDepthShadow(sampler2D shadowMap0, sampler2D shadowMap1, sampler2D shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	float shadow;
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.3, 0.0, 0, 0);
+		shadow = calcDepthShadow(shadowMap0, lsPos0, invShadowmapSize0);
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0, 0.3, 0, 0);
+		shadow = calcDepthShadow(shadowMap1, lsPos1, invShadowmapSize1);
+	}
+	else
+	{
+		splitColour = vec4(0.0, 0.0, 0.3, 0);
+		shadow = calcDepthShadow(shadowMap2, lsPos2, invShadowmapSize2);
+	}
+
+	return shadow;
+}
+
+void main()
+{
+    // look up the diffuse map layer
+    vec4 texDiffuse = texture(diffuseMap, diffuseUV.xy);
+    
+#if SHADOWCASTER
+#  if DEPTH_SHADOWCASTER
+	// early-out with depth (we still include alpha for those cards that support it)
+	fragColour = vec4(depth, depth, depth, 1);
+#  else
+	fragColour = vec4(shadowColour.xyz, texDiffuse.a);
+#  endif
+
+#else
+    // compute the ambient contribution (pulled from the diffuse map)
+    vec3 vAmbient = texDiffuse.xyz * materialAmbient.xyz;
+    vec3 vColor3 = texDiffuse.rgb * col.rgb;
+
+#  if DEPTH_SHADOWRECEIVER
+	float camDepth = diffuseUV.z;
+	float shadow = calcPSSMDepthShadow(shadowMap0, shadowMap1, shadowMap2, 
+		lightSpacePos0, lightSpacePos1, lightSpacePos2,
+		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
+		pssmSplitPoints, camDepth);
+	vColor3 *= shadow;
+#  endif
+
+    fragColour = vec4(vColor3 + vAmbient, texDiffuse.a);
+    
+#  if FOG
+    // if fog is active, interpolate between the unfogged color and the fog color
+    // based on vertex shader fog value
+    fragColour.rgb = mix(vColor.rgb, fogColour, diffuseUV.z).rgb;
+#  endif
+
+#endif
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowObjectVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,95 +1,95 @@
-#version 150
-/* Copyright Torus Knot Software Ltd 2000-2013
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#define BIAS 0
-
-in vec4 position;
-in vec3 normal;
-in vec4 uv0;
-
-uniform mat4 worldViewProj;
-uniform vec4 lightPosition;
-uniform vec3 lightDiffuse;
-#if FOG
-uniform vec2 fogParams;		// x = fog start, y = fog distance
-#endif
-
-#if DEPTH_SHADOWCASTER
-uniform vec4 depthRange; // x = min, y = max, z = range, w = 1/range
-out float depth;
-#endif
-
-#if DEPTH_SHADOWRECEIVER
-uniform vec4 depthRange0; // x = min, y = max, z = range, w = 1/range
-uniform vec4 depthRange1; // x = min, y = max, z = range, w = 1/range
-uniform vec4 depthRange2; // x = min, y = max, z = range, w = 1/range
-uniform mat4 texWorldViewProjMatrix0;
-uniform mat4 texWorldViewProjMatrix1;
-uniform mat4 texWorldViewProjMatrix2;
-out vec4 lightSpacePos0;
-out vec4 lightSpacePos1;
-out vec4 lightSpacePos2;
-#endif
-
-#if !SHADOWCASTER
-out vec3 col;
-#endif
-
-out vec3 diffuseUV;
-
-void main()
-{
-    // project position to the screen
-    gl_Position = worldViewProj * position;
-
-#if !SHADOWCASTER
-	// Get object space light direction
-	vec3 lightDir = normalize(lightPosition.xyz - (position.xyz * lightPosition.w).xyz);
-	col = lightDiffuse.xyz * max(dot(lightDir, normal.xyz), 0.0);
-#  if FOG
-    diffuseUV.z = linearFog(gl_Position.z, fogParams.x, fogParams.y);
-#  endif
-
-#endif
-
-    // pass through other texcoords exactly as they were received
-    diffuseUV.xy = uv0.xy;
-
-#if DEPTH_SHADOWCASTER
-	depth = (BIAS + gl_Position.z - depthRange.x) * depthRange.w;
-#endif
-
-#if DEPTH_SHADOWRECEIVER
-	// Calculate the position of vertex in light space
-	lightSpacePos0 = texWorldViewProjMatrix0 * position;
-	lightSpacePos1 = texWorldViewProjMatrix1 * position;
-	lightSpacePos2 = texWorldViewProjMatrix2 * position;
-
-	// make linear
-	lightSpacePos0.z = (lightSpacePos0.z - depthRange0.x) * depthRange0.w;
-	lightSpacePos1.z = (lightSpacePos1.z - depthRange1.x) * depthRange1.w;
-	lightSpacePos2.z = (lightSpacePos2.z - depthRange2.x) * depthRange2.w;
-
-	// pass cam depth
-	diffuseUV.z = gl_Position.z;
-#endif
-}
+#version 150
+/* Copyright Torus Knot Software Ltd 2000-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#define BIAS 0
+
+in vec4 position;
+in vec3 normal;
+in vec4 uv0;
+
+uniform mat4 worldViewProj;
+uniform vec4 lightPosition;
+uniform vec3 lightDiffuse;
+#if FOG
+uniform vec2 fogParams;		// x = fog start, y = fog distance
+#endif
+
+#if DEPTH_SHADOWCASTER
+uniform vec4 depthRange; // x = min, y = max, z = range, w = 1/range
+out float depth;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform vec4 depthRange0; // x = min, y = max, z = range, w = 1/range
+uniform vec4 depthRange1; // x = min, y = max, z = range, w = 1/range
+uniform vec4 depthRange2; // x = min, y = max, z = range, w = 1/range
+uniform mat4 texWorldViewProjMatrix0;
+uniform mat4 texWorldViewProjMatrix1;
+uniform mat4 texWorldViewProjMatrix2;
+out vec4 lightSpacePos0;
+out vec4 lightSpacePos1;
+out vec4 lightSpacePos2;
+#endif
+
+#if !SHADOWCASTER
+out vec3 col;
+#endif
+
+out vec3 diffuseUV;
+
+void main()
+{
+    // project position to the screen
+    gl_Position = worldViewProj * position;
+
+#if !SHADOWCASTER
+	// Get object space light direction
+	vec3 lightDir = normalize(lightPosition.xyz - (position.xyz * lightPosition.w).xyz);
+	col = lightDiffuse.xyz * max(dot(lightDir, normal.xyz), 0.0);
+#  if FOG
+    diffuseUV.z = linearFog(gl_Position.z, fogParams.x, fogParams.y);
+#  endif
+
+#endif
+
+    // pass through other texcoords exactly as they were received
+    diffuseUV.xy = uv0.xy;
+
+#if DEPTH_SHADOWCASTER
+	depth = (BIAS + gl_Position.z - depthRange.x) * depthRange.w;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+	// Calculate the position of vertex in light space
+	lightSpacePos0 = texWorldViewProjMatrix0 * position;
+	lightSpacePos1 = texWorldViewProjMatrix1 * position;
+	lightSpacePos2 = texWorldViewProjMatrix2 * position;
+
+	// make linear
+	lightSpacePos0.z = (lightSpacePos0.z - depthRange0.x) * depthRange0.w;
+	lightSpacePos1.z = (lightSpacePos1.z - depthRange1.x) * depthRange1.w;
+	lightSpacePos2.z = (lightSpacePos2.z - depthRange2.x) * depthRange2.w;
+
+	// pass cam depth
+	diffuseUV.z = gl_Position.z;
+#endif
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,18 +1,18 @@
-#version 150
-
-in vec2 depth;
-//out vec4 fragColour;
-
-void main()
-{
-#if LINEAR_RANGE
-	float finalDepth = depth.x;
-#else
-	float finalDepth = depth.x;// / depth.y;
-#endif
-	// just smear across all components 
-	// therefore this one needs high individual channel precision
-//	fragColour = vec4(finalDepth, finalDepth, finalDepth, 1);
-	gl_FragDepth = finalDepth;
-}
-
+#version 150
+
+in vec2 depth;
+//out vec4 fragColour;
+
+void main()
+{
+#if LINEAR_RANGE
+	float finalDepth = depth.x;
+#else
+	float finalDepth = depth.x;// / depth.y;
+#endif
+	// just smear across all components 
+	// therefore this one needs high individual channel precision
+//	fragColour = vec4(finalDepth, finalDepth, finalDepth, 1);
+	gl_FragDepth = finalDepth;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,25 +1,25 @@
-#version 150
-
-uniform mat4 worldViewProj;
-uniform vec4 texelOffsets;
-uniform vec4 depthRange;
-
-in vec4 vertex;
-out vec2 depth;
-
-void main()
-{
-	gl_Position = worldViewProj * vertex;
-
-	// fix pixel / texel alignment
-	gl_Position.xy += texelOffsets.zw * gl_Position.w;
-	// linear depth storage
-	// offset / scale range output
-#if LINEAR_RANGE
-	depth.x = (gl_Position.z - depthRange.x) * depthRange.w;
-#else
-	depth.x = gl_Position.z;
-#endif
-	depth.y = gl_Position.w;
-}
-
+#version 150
+
+uniform mat4 worldViewProj;
+uniform vec4 texelOffsets;
+uniform vec4 depthRange;
+
+in vec4 vertex;
+out vec2 depth;
+
+void main()
+{
+	gl_Position = worldViewProj * vertex;
+
+	// fix pixel / texel alignment
+	gl_Position.xy += texelOffsets.zw * gl_Position.w;
+	// linear depth storage
+	// offset / scale range output
+#if LINEAR_RANGE
+	depth.x = (gl_Position.z - depthRange.x) * depthRange.w;
+#else
+	depth.x = gl_Position.z;
+#endif
+	depth.y = gl_Position.w;
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,82 +1,82 @@
-#version 150
-
-uniform float inverseShadowmapSize;
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-uniform float shadowFuzzyWidth;
-uniform vec4 lightColour;
-
-uniform sampler2D shadowMap;
-uniform sampler2D normalMap;
-
-in vec3 tangentLightDir;
-in vec4 oUv0;
-in vec4 oUv1;
-out vec4 fragColour;
-
-// Expand a range-compressed vector
-vec3 expand(vec3 v)
-{
-	return (v - 0.5) * 2.0;
-}
-
-void main()
-{
-	// get the new normal and diffuse values
-	vec3 normal = normalize(expand(texture(normalMap, oUv1.xy).xyz));
-	
-	vec4 vertexColour = clamp(dot(normal, tangentLightDir),0.0,1.0) * lightColour;
-
-	vec4 shadowUV = oUv0;
-	// point on shadowmap
-#if LINEAR_RANGE
-	shadowUV.xy = shadowUV.xy / shadowUV.w;
-#else
-	shadowUV = shadowUV / shadowUV.w;
-#endif
-	float centerdepth = texture(shadowMap, shadowUV.xy).x;
-    
-    // gradient calculation
-  	float pixeloffset = inverseShadowmapSize;
-    vec4 depths = vec4(
-    	texture(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
-
-	vec2 differences = abs( depths.yw - depths.xz );
-	float gradient = min(gradientClamp, max(differences.x, differences.y));
-	float gradientFactor = gradient * gradientScaleBias;
-
-	// visibility function
-	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
-	float finalCenterDepth = centerdepth + depthAdjust;
-
-	// shadowUV.z contains lightspace position of current object
-
-#if FUZZY_TEST
-	// fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
-	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
-	float visibility = saturate(1 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
-
-	fragColour = vertexColour * visibility;
-#else
-	// hard test
-#if PCF
-	// use depths from prev, calculate diff
-	depths += depthAdjust;
-	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
-	
-	final *= 0.2;
-
-	fragColour = vec4(vertexColour.xyz * final, 1);
-#else
-	fragColour = (finalCenterDepth > shadowUV.z) ? vertexColour : vec4(0,0,0,1);
-#endif
-#endif
-}
+#version 150
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform float shadowFuzzyWidth;
+uniform vec4 lightColour;
+
+uniform sampler2D shadowMap;
+uniform sampler2D normalMap;
+
+in vec3 tangentLightDir;
+in vec4 oUv0;
+in vec4 oUv1;
+out vec4 fragColour;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+	// get the new normal and diffuse values
+	vec3 normal = normalize(expand(texture(normalMap, oUv1.xy).xyz));
+	
+	vec4 vertexColour = clamp(dot(normal, tangentLightDir),0.0,1.0) * lightColour;
+
+	vec4 shadowUV = oUv0;
+	// point on shadowmap
+#if LINEAR_RANGE
+	shadowUV.xy = shadowUV.xy / shadowUV.w;
+#else
+	shadowUV = shadowUV / shadowUV.w;
+#endif
+	float centerdepth = texture(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+
+#if FUZZY_TEST
+	// fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
+	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
+	float visibility = saturate(1 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
+
+	fragColour = vertexColour * visibility;
+#else
+	// hard test
+#if PCF
+	// use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	fragColour = vec4(vertexColour.xyz * final, 1);
+#else
+	fragColour = (finalCenterDepth > shadowUV.z) ? vertexColour : vec4(0,0,0,1);
+#endif
+#endif
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapNormalMapReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,50 +1,50 @@
-#version 150
-
-in vec3 tangent;
-in vec3 normal;
-in vec4 vertex;
-in vec4 uv1;
-
-uniform mat4 world;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 lightPosition; // object space
-uniform vec4 shadowDepthRange;
-
-out vec3 tangentLightDir;
-out vec4 oUv0;
-out vec4 oUv1;
-
-void main()
-{
-	gl_Position = worldViewProj * vertex;
-	
-	vec4 worldPos = world * vertex;
-
-	// Get object space light direction 
-    vec3 lightDir = normalize(lightPosition.xyz - (vertex.xyz * lightPosition.w));
-
-	// calculate shadow map coords
-	oUv0 = texViewProj * worldPos;
-#if LINEAR_RANGE
-	// adjust by fixed depth bias, rescale into range
-	oUv0.z = (oUv0.z - shadowDepthRange.x) * shadowDepthRange.w;
-#endif
-
-	// pass the main uvs straight through unchanged 
-	oUv1 = uv1;
-
-	// Calculate the binormal (NB we assume both normal and tangent are 
-	// already normalised) 
-	vec3 binormal = cross(normal, tangent); 
-
-	// Form a rotation matrix out of the vectors 
-	mat3 rotation = mat3(tangent, binormal, normal); 
-//	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
-//						vec3(tangent[1], binormal[1], normal[1]),
-//						vec3(tangent[2], binormal[2], normal[2]));
-
-	// Transform the light vector according to this matrix 
-	tangentLightDir = normalize(rotation * lightDir); 
-}
-
+#version 150
+
+in vec3 tangent;
+in vec3 normal;
+in vec4 vertex;
+in vec4 uv1;
+
+uniform mat4 world;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition; // object space
+uniform vec4 shadowDepthRange;
+
+out vec3 tangentLightDir;
+out vec4 oUv0;
+out vec4 oUv1;
+
+void main()
+{
+	gl_Position = worldViewProj * vertex;
+	
+	vec4 worldPos = world * vertex;
+
+	// Get object space light direction 
+    vec3 lightDir = normalize(lightPosition.xyz - (vertex.xyz * lightPosition.w));
+
+	// calculate shadow map coords
+	oUv0 = texViewProj * worldPos;
+#if LINEAR_RANGE
+	// adjust by fixed depth bias, rescale into range
+	oUv0.z = (oUv0.z - shadowDepthRange.x) * shadowDepthRange.w;
+#endif
+
+	// pass the main uvs straight through unchanged 
+	oUv1 = uv1;
+
+	// Calculate the binormal (NB we assume both normal and tangent are 
+	// already normalised) 
+	vec3 binormal = cross(normal, tangent); 
+
+	// Form a rotation matrix out of the vectors 
+	mat3 rotation = mat3(tangent, binormal, normal); 
+//	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+//						vec3(tangent[1], binormal[1], normal[1]),
+//						vec3(tangent[2], binormal[2], normal[2]));
+
+	// Transform the light vector according to this matrix 
+	tangentLightDir = normalize(rotation * lightDir); 
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,64 +1,64 @@
-#version 150
-
-uniform float inverseShadowmapSize;
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-uniform float shadowFuzzyWidth;
-
-uniform sampler2D shadowMap;
-out vec4 fragColour;
-in vec4 shadowUV;
-in vec4 oColour;
-
-void main()
-{
-	float centerdepth = texture(shadowMap, shadowUV.xy).x;
-    
-    // gradient calculation
-  	float pixeloffset = inverseShadowmapSize;
-    vec4 depths = vec4(
-    	texture(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
-    	texture(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
-
-	vec2 differences = abs( depths.yw - depths.xz );
-	float gradient = min(gradientClamp, max(differences.x, differences.y));
-	float gradientFactor = gradient * gradientScaleBias;
-
-	// visibility function
-	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
-	float finalCenterDepth = centerdepth + depthAdjust;
-
-	// shadowUV.z contains lightspace position of current object
-
-#if FUZZY_TEST
-	// fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
-	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
-	float visibility = saturate(1 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
-
-	fragColour = vertexColour * visibility;
-#else
-	// hard test
-#if PCF
-	// use depths from prev, calculate diff
-	depths += depthAdjust;
-	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
-	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
-	
-	final *= 0.2;
-
-	fragColour = vec4(oColour.xyz * final, 1);
-	
-#else
-	fragColour = (finalCenterDepth > shadowUV.z) ? oColour : vec4(0.5,0,0,1);
-#endif
-
-#endif
-   
-}
-
+#version 150
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform float shadowFuzzyWidth;
+
+uniform sampler2D shadowMap;
+out vec4 fragColour;
+in vec4 shadowUV;
+in vec4 oColour;
+
+void main()
+{
+	float centerdepth = texture(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
+    	texture(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+
+#if FUZZY_TEST
+	// fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
+	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
+	float visibility = saturate(1 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
+
+	fragColour = vertexColour * visibility;
+#else
+	// hard test
+#if PCF
+	// use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	fragColour = vec4(oColour.xyz * final, 1);
+	
+#else
+	fragColour = (finalCenterDepth > shadowUV.z) ? oColour : vec4(0.5,0,0,1);
+#endif
+
+#endif
+   
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DepthShadowmapReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,39 +1,39 @@
-#version 150
-
-uniform mat4 world;
-uniform mat4 worldIT;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 lightPosition;
-uniform vec4 lightColour;
-uniform vec4 shadowDepthRange;
-
-in vec4 position;
-in vec3 normal;
-in vec4 ambient;
-
-out vec4 shadowUV;
-out vec4 oColour;
-
-void main()
-{
-	gl_Position = worldViewProj * position;
-	vec4 worldPos = world * position;
-	vec3 worldNorm = (worldIT * vec4(normal, 1)).xyz;
-
-	// calculate lighting (simple vertex lighting)
-	vec3 lightDir = normalize(
-		lightPosition.xyz - (worldPos.xyz * lightPosition.w));
-
-	oColour = lightColour * max(dot(lightDir, worldNorm), 0.0);
-
-	// calculate shadow map coords
-	shadowUV = texViewProj * worldPos;
-#if LINEAR_RANGE
-	// adjust by fixed depth bias, rescale into range
-//	shadowUV.z = (shadowUV.z - shadowDepthRange.x) * shadowDepthRange.w;
-	shadowUV.xy = shadowUV.xy / shadowUV.w;
-#else
-	shadowUV = shadowUV / shadowUV.w;
-#endif
-}
+#version 150
+
+uniform mat4 world;
+uniform mat4 worldIT;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition;
+uniform vec4 lightColour;
+uniform vec4 shadowDepthRange;
+
+in vec4 position;
+in vec3 normal;
+in vec4 ambient;
+
+out vec4 shadowUV;
+out vec4 oColour;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	vec4 worldPos = world * position;
+	vec3 worldNorm = (worldIT * vec4(normal, 1)).xyz;
+
+	// calculate lighting (simple vertex lighting)
+	vec3 lightDir = normalize(
+		lightPosition.xyz - (worldPos.xyz * lightPosition.w));
+
+	oColour = lightColour * max(dot(lightDir, worldNorm), 0.0);
+
+	// calculate shadow map coords
+	shadowUV = texViewProj * worldPos;
+#if LINEAR_RANGE
+	// adjust by fixed depth bias, rescale into range
+//	shadowUV.z = (shadowUV.z - shadowDepthRange.x) * shadowDepthRange.w;
+	shadowUV.xy = shadowUV.xy / shadowUV.w;
+#else
+	shadowUV = shadowUV / shadowUV.w;
+#endif
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/DitherFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/DitherFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/DitherFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,18 +1,18 @@
-#version 150
-
-uniform sampler2D RT;
-uniform sampler2D noise;
-in vec2 oUv0;
-
-out vec4 fragColour;
-
-void main()
-{
-	float c = dot(texture(RT, oUv0), vec4(0.30, 0.11, 0.59, 0.00));
-	float n = texture(noise, oUv0).r * 2.0 - 1.0;
-	c += n;
-
-	c = step(c, 0.5);
-
-	fragColour = vec4(c,c,c,1.0);
-}
+#version 150
+
+uniform sampler2D RT;
+uniform sampler2D noise;
+in vec2 oUv0;
+
+out vec4 fragColour;
+
+void main()
+{
+	float c = dot(texture(RT, oUv0), vec4(0.30, 0.11, 0.59, 0.00));
+	float n = texture(noise, oUv0).r * 2.0 - 1.0;
+	c += n;
+
+	c = step(c, 0.5);
+
+	fragColour = vec4(c,c,c,1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/EmbossedFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/EmbossedFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/EmbossedFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,16 +1,16 @@
-#version 150
-
-uniform sampler2D RT;
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main()
-{
-    vec4 Color;
-    Color.a = 1.0;
-    Color.rgb = vec3(0.5);
-    Color -= texture( RT, oUv0 - 0.001)*2.0;
-    Color += texture( RT, oUv0 + 0.001)*2.0;
-    Color.rgb = vec3((Color.r+Color.g+Color.b)/3.0);
-    fragColour = Color;
-}
+#version 150
+
+uniform sampler2D RT;
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main()
+{
+    vec4 Color;
+    Color.a = 1.0;
+    Color.rgb = vec3(0.5);
+    Color -= texture( RT, oUv0 - 0.001)*2.0;
+    Color += texture( RT, oUv0 + 0.001)*2.0;
+    Color.rgb = vec3((Color.r+Color.g+Color.b)/3.0);
+    fragColour = Color;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,33 +1,33 @@
-#version 150
-
-/* Cel shading fragment program for single-pass rendering */
-uniform vec4 diffuse;
-uniform vec4 specular;
-uniform sampler1D diffuseRamp;
-uniform sampler1D specularRamp;
-uniform sampler1D edgeRamp;
-
-in float diffuseIn;
-in float specularIn;
-in float edge;
-
-out vec4 fragColour;
-
-/*uniform lighting
-{
-	vec4 diffuse;
-	vec4 specular;
-} LightingParams;*/
-
-void main()
-{
-	// Step functions from textures
-	float diffuseStep = texture(diffuseRamp, diffuseIn).x;
-	float specularStep = texture(specularRamp, specularIn).x;
-	float edgeStep = texture(edgeRamp, edge).x;
-
-	fragColour = edgeStep * ((diffuse * diffuseStep) + 
-                            (specular * specularStep));
-//	fragColour = edgeStep * ((LightingParams.diffuse * diffuseStep) + 
-//                        (LightingParams.specular * specularStep));
-}
+#version 150
+
+/* Cel shading fragment program for single-pass rendering */
+uniform vec4 diffuse;
+uniform vec4 specular;
+uniform sampler1D diffuseRamp;
+uniform sampler1D specularRamp;
+uniform sampler1D edgeRamp;
+
+in float diffuseIn;
+in float specularIn;
+in float edge;
+
+out vec4 fragColour;
+
+/*uniform lighting
+{
+	vec4 diffuse;
+	vec4 specular;
+} LightingParams;*/
+
+void main()
+{
+	// Step functions from textures
+	float diffuseStep = texture(diffuseRamp, diffuseIn).x;
+	float specularStep = texture(specularRamp, specularIn).x;
+	float edgeStep = texture(edgeRamp, edge).x;
+
+	fragColour = edgeStep * ((diffuse * diffuseStep) + 
+                            (specular * specularStep));
+//	fragColour = edgeStep * ((LightingParams.diffuse * diffuseStep) + 
+//                        (LightingParams.specular * specularStep));
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Example_CelShadingVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,50 +1,50 @@
-#version 150
-
-/* Cel shading vertex program for single-pass rendering
-   In this program, we want to calculate the diffuse and specular
-   ramp components, and the edge factor (for doing simple outlining)
-   For the outlining to look good, we need a pretty well curved model.
-*/
-// Parameters
-in vec4 vertex;
-in vec3 normal;
-
-uniform vec3 lightPosition; // object space
-uniform vec3 eyePosition;   // object space
-uniform vec4 shininess;
-uniform mat4 worldViewProj;
-
-//uniform transform
-//{
-//	vec4 shininess;
-//} MaterialShininess;
-
-out float diffuseIn;
-out float specularIn;
-out float edge;
-
-void main()
-{
-	// calculate output position
-	gl_Position = worldViewProj * vertex;
-
-	// calculate light vector
-	vec3 N = normalize(normal);
-	vec3 L = normalize(lightPosition - vertex.xyz);
-	
-	// Calculate diffuse component
-	diffuseIn = max(dot(N, L) , 0.0);
-
-	// Mask off specular if diffuse is 0
-	if (diffuseIn == 0.0)
-	    specularIn = 0.0;
-
-    // Calculate specular component
-    vec3 E = normalize(eyePosition - vertex.xyz);
-    vec3 H = normalize(L + E);
-    specularIn = pow(max(dot(N, H), 0.0), shininess.x);
-//    specularIn = pow(max(dot(N, H), 0.0), MaterialShininess.shininess.x);
-
-	// Edge detection, dot eye and normal vectors
-	edge = max(dot(N, E), 0.0);
-}
+#version 150
+
+/* Cel shading vertex program for single-pass rendering
+   In this program, we want to calculate the diffuse and specular
+   ramp components, and the edge factor (for doing simple outlining)
+   For the outlining to look good, we need a pretty well curved model.
+*/
+// Parameters
+in vec4 vertex;
+in vec3 normal;
+
+uniform vec3 lightPosition; // object space
+uniform vec3 eyePosition;   // object space
+uniform vec4 shininess;
+uniform mat4 worldViewProj;
+
+//uniform transform
+//{
+//	vec4 shininess;
+//} MaterialShininess;
+
+out float diffuseIn;
+out float specularIn;
+out float edge;
+
+void main()
+{
+	// calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// calculate light vector
+	vec3 N = normalize(normal);
+	vec3 L = normalize(lightPosition - vertex.xyz);
+	
+	// Calculate diffuse component
+	diffuseIn = max(dot(N, L) , 0.0);
+
+	// Mask off specular if diffuse is 0
+	if (diffuseIn == 0.0)
+	    specularIn = 0.0;
+
+    // Calculate specular component
+    vec3 E = normalize(eyePosition - vertex.xyz);
+    vec3 H = normalize(L + E);
+    specularIn = pow(max(dot(N, H), 0.0), shininess.x);
+//    specularIn = pow(max(dot(N, H), 0.0), MaterialShininess.shininess.x);
+
+	// Edge detection, dot eye and normal vectors
+	edge = max(dot(N, E), 0.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,15 +1,15 @@
-#version 150
-
-uniform sampler2D diffuseMap;
-
-in vec4 oUv0;
-in vec4 oColour;
-
-out vec4 fragColour;
-
-/// grass_vp ambient
-void main()
-{	
-    vec4 texColor = texture(diffuseMap, oUv0.xy);
-    fragColour = vec4(oColour.rgb, texColor.a);
-}
+#version 150
+
+uniform sampler2D diffuseMap;
+
+in vec4 oUv0;
+in vec4 oColour;
+
+out vec4 fragColour;
+
+/// grass_vp ambient
+void main()
+{	
+    vec4 texColor = texture(diffuseMap, oUv0.xy);
+    fragColour = vec4(oColour.rgb, texColor.a);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassAmbientVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,39 +1,39 @@
-#version 150
-
-
-uniform mat4 worldViewProj;
-uniform vec4 ambient;
-uniform vec4 offset;
-
-in vec4 position;
-in vec4 normal;
-in vec4 uv0;
-
-out vec4 oUv0;
-out vec4 oColour;
-
-/// grass_vp ambient
-void main()
-{	
-     // Position
-	vec4 mypos = position;
-	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
-	mypos = mypos + offset * factor;
-  	gl_Position = worldViewProj * mypos;
-    // Texture Coord
-	oUv0.xy = uv0.xy;      
-    /*
-    // Normal
-    // Make vec from vertex to camera
-    vec4 EyeVec = camObjPos - mypos;
-    // Dot the v to eye and the normal to see if they point
-    //  in the same direction or opposite
-    float aligned = dot(normal, EyeVec); // -1..1
-    // If aligned is negative, we need to flip the normal
-    if (aligned < 0)  
-        normal = -normal;  
-    //oNormal = normal; 
-    */
-    // Color    
-	oColour = ambient; 
-}
+#version 150
+
+
+uniform mat4 worldViewProj;
+uniform vec4 ambient;
+uniform vec4 offset;
+
+in vec4 position;
+in vec4 normal;
+in vec4 uv0;
+
+out vec4 oUv0;
+out vec4 oColour;
+
+/// grass_vp ambient
+void main()
+{	
+     // Position
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+  	gl_Position = worldViewProj * mypos;
+    // Texture Coord
+	oUv0.xy = uv0.xy;      
+    /*
+    // Normal
+    // Make vec from vertex to camera
+    vec4 EyeVec = camObjPos - mypos;
+    // Dot the v to eye and the normal to see if they point
+    //  in the same direction or opposite
+    float aligned = dot(normal, EyeVec); // -1..1
+    // If aligned is negative, we need to flip the normal
+    if (aligned < 0)  
+        normal = -normal;  
+    //oNormal = normal; 
+    */
+    // Color    
+	oColour = ambient; 
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,25 +1,25 @@
-#version 150
-
-uniform sampler2D diffuseMap;
-
-in vec4 oUv0;
-in vec2 oDepth;
-
-out vec4 fragColour;
-
-//////////////////////// GRASS SHADOW CASTER
-void main()
-{	
-	float alpha = texture(diffuseMap, oUv0.xy).a;
-	if (alpha > 0.001)
-    {
-       fragColour = vec4(1.0, 1.0, 1.0, 0.0);
-    }
-    else
-    {
-        float finalDepth = oDepth.x / oDepth.y;
-        // just smear across all components 
-        // therefore this one needs high individual channel precision
-        fragColour = vec4(vec3(finalDepth), 1.0);
-    }
-}
+#version 150
+
+uniform sampler2D diffuseMap;
+
+in vec4 oUv0;
+in vec2 oDepth;
+
+out vec4 fragColour;
+
+//////////////////////// GRASS SHADOW CASTER
+void main()
+{	
+	float alpha = texture(diffuseMap, oUv0.xy).a;
+	if (alpha > 0.001)
+    {
+       fragColour = vec4(1.0, 1.0, 1.0, 0.0);
+    }
+    else
+    {
+        float finalDepth = oDepth.x / oDepth.y;
+        // just smear across all components 
+        // therefore this one needs high individual channel precision
+        fragColour = vec4(vec3(finalDepth), 1.0);
+    }
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,29 +1,29 @@
-#version 150
-
-uniform mat4 worldViewProj;
-uniform vec4 offset;
-uniform vec4 texelOffsets;
-
-in vec4 position;
-in vec4 uv0;
-
-out vec4 oUv0;
-out vec2 oDepth;
-
-//////////////////////// GRASS SHADOW CASTER
-// Shadow caster vertex program.
-void main()
-{
-	vec4 mypos = position;
-	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
-	mypos = mypos + offset * factor;
-	gl_Position = worldViewProj * mypos;
-
-	// fix pixel / texel alignment
-	gl_Position.xy += texelOffsets.zw * gl_Position.w;
-    
-	oDepth.x = gl_Position.z;
-	oDepth.y = gl_Position.w;
-  
-  	oUv0 = uv0;
-}
+#version 150
+
+uniform mat4 worldViewProj;
+uniform vec4 offset;
+uniform vec4 texelOffsets;
+
+in vec4 position;
+in vec4 uv0;
+
+out vec4 oUv0;
+out vec2 oDepth;
+
+//////////////////////// GRASS SHADOW CASTER
+// Shadow caster vertex program.
+void main()
+{
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+
+	// fix pixel / texel alignment
+	gl_Position.xy += texelOffsets.zw * gl_Position.w;
+    
+	oDepth.x = gl_Position.z;
+	oDepth.y = gl_Position.w;
+  
+  	oUv0 = uv0;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,23 +1,23 @@
-#version 150
-
-////////////////////////////// MOVING GRASS
-// Vertex program to wave some grass about
-// Assumes UV texture coords of v==0 indicates the top of the grass
-uniform sampler2D diffuseMap;
-
-in vec4 oUv0;
-in vec4 oColour;
-
-out vec4 fragColour;
-
-void main()
-{	
-    vec4 texColor = texture(diffuseMap, oUv0.xy);
-    fragColour = vec4(texColor.rgb * oColour.rgb, texColor.a); 
-
-    // Do manual alpha rejection
-    if (texColor.a < 0.58)
-    {
-        discard;
-    }
-}
+#version 150
+
+////////////////////////////// MOVING GRASS
+// Vertex program to wave some grass about
+// Assumes UV texture coords of v==0 indicates the top of the grass
+uniform sampler2D diffuseMap;
+
+in vec4 oUv0;
+in vec4 oColour;
+
+out vec4 fragColour;
+
+void main()
+{	
+    vec4 texColor = texture(diffuseMap, oUv0.xy);
+    fragColour = vec4(texColor.rgb * oColour.rgb, texColor.a); 
+
+    // Do manual alpha rejection
+    if (texColor.a < 0.58)
+    {
+        discard;
+    }
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,41 +1,41 @@
-#version 150
-
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-uniform sampler2D shadowMap;
-uniform sampler2D diffuseMap;
-uniform vec4 vertexLight;
-
-in vec4 oUv0;
-in vec4 oShadowUV;
-
-out vec4 fragColour;
-
-//////////////////////// GRASS SHADOW RECEIVER
-void main()
-{
-    if (oShadowUV.z > 0.0)
-    {
-       vec4 diffuse = texture(diffuseMap, oUv0.xy);
-       if (diffuse.a > 0.001)
-       {
-            fragColour = vec4(0.0);
-       }
-       else
-       {
-            vec4 normShadowUV = oShadowUV / oShadowUV.w;
-            vec4 shadowDepths = texture(shadowMap, normShadowUV.xy);
-
-            float gradientFactor = gradientClamp * gradientScaleBias;
-            float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x;
-            float centerdepth = shadowDepths.x + depthAdjust;
-
-            fragColour = (centerdepth > normShadowUV.z) ? vec4(vertexLight.rgb, diffuse.a) : vec4(0.0, 0.0, 0.0, diffuse.a);
-       }
-    }
-    else
-    {
-        fragColour = vec4(0.0);
-    }
-}
+#version 150
+
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform sampler2D shadowMap;
+uniform sampler2D diffuseMap;
+uniform vec4 vertexLight;
+
+in vec4 oUv0;
+in vec4 oShadowUV;
+
+out vec4 fragColour;
+
+//////////////////////// GRASS SHADOW RECEIVER
+void main()
+{
+    if (oShadowUV.z > 0.0)
+    {
+       vec4 diffuse = texture(diffuseMap, oUv0.xy);
+       if (diffuse.a > 0.001)
+       {
+            fragColour = vec4(0.0);
+       }
+       else
+       {
+            vec4 normShadowUV = oShadowUV / oShadowUV.w;
+            vec4 shadowDepths = texture(shadowMap, normShadowUV.xy);
+
+            float gradientFactor = gradientClamp * gradientScaleBias;
+            float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x;
+            float centerdepth = shadowDepths.x + depthAdjust;
+
+            fragColour = (centerdepth > normShadowUV.z) ? vec4(vertexLight.rgb, diffuse.a) : vec4(0.0, 0.0, 0.0, diffuse.a);
+       }
+    }
+    else
+    {
+        fragColour = vec4(0.0);
+    }
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,54 +1,54 @@
-#version 150
-
-uniform mat4 world;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 camObjPos;
-uniform vec4 objSpaceLight;
-uniform vec4 lightColour;
-uniform vec4 offset;
-
-in vec4 position;
-in vec4 normal;
-in vec4 uv0;
-
-out vec4 oShadowUV;
-out vec3 oUv0;
-out vec4 oColour;
-
-//////////////////////// GRASS SHADOW RECEIVER
-void main()
-{	    
-	vec4 mypos = position;
-	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
-	mypos = mypos + offset * factor;
-	gl_Position = worldViewProj * mypos;
-	oUv0.xy = uv0.xy;    
-    // Transform position to world space
-	vec4 worldPos = world * mypos;
-	// calculate shadow map coords
-	oShadowUV = texViewProj * worldPos;
-       
-    // Make vec from vertex to camera
-    vec4 EyeVec = camObjPos - mypos;
-    // Dot the v to eye and the normal to see if they point
-    // in the same direction or opposite
-    float alignedEye = dot(normal, EyeVec); // -1..1
-    // If aligned is negative, we need to flip the normal
-	vec4 myNormal = normal;
-    if (alignedEye < 0.0)
-        myNormal = -normal;
-    //oNormal = normal;
-    
-  	// get vertex light direction (support directional and point)
-	vec3 lightVec = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
-    // Dot the v to light and the normal to see if they point
-    // in the same direction or opposite
-    float alignedLight = dot(myNormal.xyz, lightVec); // -1..1
-    // If aligned is negative, shadowing/lighting is not possible.
-    oUv0.z = (alignedLight < 0.0) ? 0.0 : 1.0 ;
-         
-    float diffuseFactor = max(alignedLight, 0.0);
-	//oColour = diffuseFactor * lightColour;    
-	oColour = lightColour;    
-}
+#version 150
+
+uniform mat4 world;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 camObjPos;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+in vec4 position;
+in vec4 normal;
+in vec4 uv0;
+
+out vec4 oShadowUV;
+out vec3 oUv0;
+out vec4 oColour;
+
+//////////////////////// GRASS SHADOW RECEIVER
+void main()
+{	    
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+	oUv0.xy = uv0.xy;    
+    // Transform position to world space
+	vec4 worldPos = world * mypos;
+	// calculate shadow map coords
+	oShadowUV = texViewProj * worldPos;
+       
+    // Make vec from vertex to camera
+    vec4 EyeVec = camObjPos - mypos;
+    // Dot the v to eye and the normal to see if they point
+    // in the same direction or opposite
+    float alignedEye = dot(normal, EyeVec); // -1..1
+    // If aligned is negative, we need to flip the normal
+	vec4 myNormal = normal;
+    if (alignedEye < 0.0)
+        myNormal = -normal;
+    //oNormal = normal;
+    
+  	// get vertex light direction (support directional and point)
+	vec3 lightVec = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
+    // Dot the v to light and the normal to see if they point
+    // in the same direction or opposite
+    float alignedLight = dot(myNormal.xyz, lightVec); // -1..1
+    // If aligned is negative, shadowing/lighting is not possible.
+    oUv0.z = (alignedLight < 0.0) ? 0.0 : 1.0 ;
+         
+    float diffuseFactor = max(alignedLight, 0.0);
+	//oColour = diffuseFactor * lightColour;    
+	oColour = lightColour;    
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassTexVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassTexVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassTexVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,23 +1,23 @@
-#version 150
-
-out vec4 oUv0;
-
-in vec4 position;
-in vec4 uv0;
-
-uniform mat4 worldViewProj;
-uniform vec4 ambient;
-uniform vec4 objSpaceLight;
-uniform vec4 lightColour;
-uniform vec4 offset;
-
-void main()
-{	    
-     // Position
-	vec4 mypos = position;
-	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
-	mypos = mypos + offset * factor;
-	gl_Position = worldViewProj * mypos;
-    // Texture Coord
-	oUv0.xy = uv0.xy;
-}
+#version 150
+
+out vec4 oUv0;
+
+in vec4 position;
+in vec4 uv0;
+
+uniform mat4 worldViewProj;
+uniform vec4 ambient;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+void main()
+{	    
+     // Position
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+    // Texture Coord
+	oUv0.xy = uv0.xy;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/GrassVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/GrassVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/GrassVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,35 +1,35 @@
-#version 150
-
-////////////////////////////// MOVING GRASS
-// Vertex program to wave some grass about
-// Assumes UV texture coords of v==0 indicates the top of the grass
-uniform mat4 worldViewProj;
-uniform vec4 camObjPos;
-uniform vec4 ambient;
-uniform vec4 objSpaceLight;
-uniform vec4 lightColour;
-uniform vec4 offset;
-
-in vec4 position;
-in vec4 normal;
-in vec4 uv0;
-
-out vec4 oUv0;
-out vec4 oColour;
-
-void main()
-{
-	vec4 mypos = position;
-	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
-	mypos = mypos + offset * factor;
-	gl_Position = worldViewProj * mypos;
-
-	oUv0 = uv0;
-    // Color
-	// get vertex light direction (support directional and point)
-	vec3 light = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
-	// grass is just 2D quads, so if light passes underneath we need to invert the normal
-	// abs() will have the same effect
-    float diffuseFactor = abs(dot(normal.xyz, light));
-	oColour = ambient + diffuseFactor * lightColour;
-}
+#version 150
+
+////////////////////////////// MOVING GRASS
+// Vertex program to wave some grass about
+// Assumes UV texture coords of v==0 indicates the top of the grass
+uniform mat4 worldViewProj;
+uniform vec4 camObjPos;
+uniform vec4 ambient;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+in vec4 position;
+in vec4 normal;
+in vec4 uv0;
+
+out vec4 oUv0;
+out vec4 oColour;
+
+void main()
+{
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+
+	oUv0 = uv0;
+    // Color
+	// get vertex light direction (support directional and point)
+	vec3 light = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
+	// grass is just 2D quads, so if light passes underneath we need to invert the normal
+	// abs() will have the same effect
+    float diffuseFactor = abs(dot(normal.xyz, light));
+	oColour = ambient + diffuseFactor * lightColour;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HalftoneFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HalftoneFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HalftoneFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,25 +1,25 @@
-#version 150
-
-in vec4 pos;
-in vec2 oUv0;
-
-uniform vec2 numTiles;
-uniform vec2 iNumTiles;
-uniform vec2 iNumTiles2;
-uniform vec4 lum;
-uniform sampler2D RT;
-uniform sampler3D noise;
-
-out vec4 fragColour;
-
-void main()
-{
-	vec3 local;
-	local.xy = mod(oUv0, iNumTiles);
-	vec2 middle = oUv0 - local.xy;
-	local.xy = local.xy * numTiles;
-	middle +=  iNumTiles2;
-	local.z = dot(texture(RT, middle), lum);
-	vec4 c = vec4(texture(noise,local).r);
-	fragColour = c;
-}
+#version 150
+
+in vec4 pos;
+in vec2 oUv0;
+
+uniform vec2 numTiles;
+uniform vec2 iNumTiles;
+uniform vec2 iNumTiles2;
+uniform vec4 lum;
+uniform sampler2D RT;
+uniform sampler3D noise;
+
+out vec4 fragColour;
+
+void main()
+{
+	vec3 local;
+	local.xy = mod(oUv0, iNumTiles);
+	vec2 middle = oUv0 - local.xy;
+	local.xy = local.xy * numTiles;
+	middle +=  iNumTiles2;
+	local.z = dot(texture(RT, middle), lum);
+	vec4 c = vec4(texture(noise,local).r);
+	fragColour = c;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,23 +1,23 @@
-#version 150
-
-in vec4 vertex;
-in vec4 normal;
-in vec4 uv0;
-in vec4 uv1; // pos2
-
-out vec2 oUv;
-out vec4 colour;
-
-uniform mat4 worldViewProj;
-uniform vec4 anim_t;
-
-// hardware morph animation (no normals)
-void main()
-{
-	// interpolate
-	vec4 interp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0);
-	
-	gl_Position = worldViewProj * interp;
-	oUv = uv0.xy;
-	colour = vec4(1.0,0.0,0.0,1.0);
-}
+#version 150
+
+in vec4 vertex;
+in vec4 normal;
+in vec4 uv0;
+in vec4 uv1; // pos2
+
+// out vec2 oUv;
+out vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+
+// hardware morph animation (no normals)
+void main()
+{
+	// interpolate
+	vec4 interp = vec4(vertex.xyz + anim_t.x * (uv1.xyz - vertex.xyz), 1.0);
+	
+	gl_Position = worldViewProj * interp;
+	// oUv = uv0.xy;
+	colour = vec4(1.0, 0.0, 0.0, 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationWithNormalsVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationWithNormalsVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HardwareMorphAnimationWithNormalsVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,36 +1,36 @@
-#version 150
-
-in vec4 vertex;
-in vec3 normal;
-in vec4 uv0;
-in vec4 uv1; // pos2
-in vec4 uv2; // normal2
-
-out vec2 oUv;
-out vec4 colour;
-
-uniform mat4 worldViewProj;
-uniform vec4 anim_t;
-uniform vec4 objSpaceLightPos;
-uniform vec4 ambient;
-
-// hardware morph animation (with normals)
-void main()
-{
-	// interpolate position
-	vec4 posinterp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0);
-
-    // nlerp normal
-	vec3 ninterp = normal + anim_t.x*(uv2.xyz - normal);
-	ninterp = normalize(ninterp);
-
-	gl_Position = worldViewProj * posinterp;
-	oUv = uv0.xy;
-
-	vec3 lightDir = normalize(
-		objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
-
-	// Colour it red to make it easy to identify
-	float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
-	colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0);
-}
+#version 150
+
+in vec4 vertex;
+in vec3 normal;
+in vec4 uv0;
+in vec4 uv1; // pos2
+in vec4 uv2; // normal2
+
+out vec4 colour;
+// out vec2 oUv;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+uniform vec4 objSpaceLightPos;
+uniform vec4 ambient;
+
+// hardware morph animation (with normals)
+void main()
+{
+    // interpolate position
+    vec4 posinterp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0);
+
+    // nlerp normal
+    vec3 ninterp = normal + anim_t.x*(uv2.xyz - normal);
+    ninterp = normalize(ninterp);
+
+    gl_Position = worldViewProj * posinterp;
+    // oUv = uv0.xy;
+
+    vec3 lightDir = normalize(
+        objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
+
+    // Colour it red to make it easy to identify
+    float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
+    colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,25 +1,24 @@
-#version 150
-
-in vec4 vertex;
-in vec4 normal;
-in vec4 uv0;
-in vec4 uv1; // pose1
-in vec4 uv2; // pose2
-
-out vec2 oUv;
-out vec4 colour;
-
-uniform mat4 worldViewProj;
-uniform vec4 anim_t;
-
-// hardware pose animation (no normals)
-void main()
-{
-	// interpolate
-    vec4 interp = vec4(vertex + anim_t.x*uv1.xyz + anim_t.y*uv2.xyz, 1.0);
-
-	gl_Position = worldViewProj * interp;
-	oUv = uv0.xy;
-	colour = vec4(1.0,0.0,0.0,1.0);
-}
-
+#version 150
+
+in vec4 vertex;
+in vec4 normal;
+in vec4 uv0;
+in vec4 uv1; // pose1
+in vec4 uv2; // pose2
+
+out vec2 oUv;
+out vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+
+// hardware pose animation (no normals)
+void main()
+{
+    // interpolate
+    vec4 interp = vec4(vertex.xyz + anim_t.x * uv1.xyz + anim_t.y * uv2.xyz, 1.0);
+
+    gl_Position = worldViewProj * interp;
+    oUv = uv0.xy;
+    colour = vec4(1.0, 0.0, 0.0, 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,46 +1,45 @@
-#version 150
-
-in vec4 vertex;
-in vec4 normal;
-in vec4 uv0;
-in vec4 uv1; // pose1pos
-in vec4 uv2; // pose1norm
-in vec4 uv3; // pose2pos
-in vec4 uv4; // pose2norm
-
-out vec2 oUv;
-out vec4 colour;
-
-uniform mat4 worldViewProj;
-uniform vec4 anim_t;
-uniform vec4 objSpaceLightPos;
-uniform vec4 ambient;
-
-// hardware pose animation (with normals)
-void main()
-{
-	// interpolate position
-	vec4 posinterp = vec4(pos + anim_t.x*uv1.xyz + anim_t.y*uv3.xyz, 1.0);
-
-    // nlerp normal
-	// nlerp normal
-	// First apply the pose normals (these are actual normals, not offsets)
-	vec3 ninterp = anim_t.x*uv2.xyz + anim_t.y*uv4.xyz;
-
-	// Now add back any influence of the original normal
-	// This depends on what the cumulative weighting left the normal at, if it's lacking or cancelled out
-	//float remainder = 1.0 - min(anim_t.x + anim_t.y, 1.0);
-	float remainder = 1.0 - min(length(ninterp), 1.0);
-	ninterp = ninterp + (normal * remainder);
-	ninterp = normalize(ninterp);
-
-	gl_Position = worldViewProj * posinterp;
-	oUv = uv0.xy;
-	
-	vec3 lightDir = normalize(
-		objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
-
-	// Colour it red to make it easy to identify
-	float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
-	colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0);
-}
+#version 150
+
+in vec4 vertex;
+in vec4 normal;
+in vec4 uv0;
+in vec4 uv1; // pose1pos
+in vec4 uv2; // pose1norm
+in vec4 uv3; // pose2pos
+in vec4 uv4; // pose2norm
+
+// out vec2 oUv;
+out vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+uniform vec4 objSpaceLightPos;
+uniform vec4 ambient;
+
+// hardware pose animation (with normals)
+void main()
+{
+    // interpolate position
+    vec4 posinterp = vec4(vertex.xyz + anim_t.x * uv1.xyz + anim_t.y * uv3.xyz, 1.0);
+
+    // nlerp normal
+    // First apply the pose normals (these are actual normals, not offsets)
+    vec3 ninterp = anim_t.x * uv2.xyz + anim_t.y * uv4.xyz;
+
+    // Now add back any influence of the original normal
+    // This depends on what the cumulative weighting left the normal at, if it's lacking or cancelled out
+    //float remainder = 1.0 - min(anim_t.x + anim_t.y, 1.0);
+    float remainder = 1.0 - min(length(ninterp), 1.0);
+    ninterp = ninterp + (remainder * normal.xyz);
+    ninterp = normalize(ninterp);
+
+    gl_Position = worldViewProj * posinterp;
+    // oUv = uv0.xy;
+
+    vec3 lightDir = normalize(
+        objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
+
+    // Colour it red to make it easy to identify
+    float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
+    colour = vec4((ambient.rgb + vec3(lit, lit, lit)) * vec3(1.0, 0.0, 0.0), 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HeatBlurFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HeatBlurFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HeatBlurFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,61 +1,61 @@
-#version 150
-
-uniform sampler2D Input;
-uniform vec4 blurAmount;
-
-in vec2 uv;
-out vec4 fragColour;
-
-void main()
-{
-   int i;
-   vec4 tmpOutColor;
-   float  diffuseGlowFactor;
-   vec2 offsets[4];
-/*
-		// hazy blur
-		-1.8, -1.8,
-		-1.8, 1.8,
-		1.8, -1.8,
-		1.8, 1.8
-*/
-/*
-		// less-hazy blur
-	  -1.0,  2.0,
-	  -1.0, -1.0,
-	   1.0, -1.0,
-	   1.0,  1.0
-*/
-/*
-      -0.326212, -0.405805,
-      -0.840144, -0.073580,
-      -0.695914,  0.457137,
-      -0.203345,  0.620716
-*/
-
-   offsets[0] = vec2(-0.3,  0.4);
-   offsets[1] = vec2(-0.3,  -0.4);
-   offsets[2] = vec2(0.3,  -0.4);
-   offsets[3] = vec2(0.3,  0.4);
-
-   tmpOutColor = texture( Input, uv );	// UV coords are in image space
-
-   // calculate glow amount
-   diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
-
-   // basic blur filter
-   for (i = 0; i < 4; i++) {
-      tmpOutColor += texture( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
-   }
-
-   tmpOutColor *= 0.25;
-
-   // TIPS (old-skool strikes again!)
-   // Pay attention here! If you use the "out float4 outColor" directly
-   // in your steps while creating the output color (like you remove
-   // the "tmpOutColor" var and just use the "outColor" directly)
-   // your pixel-color output IS CHANGING EACH TIME YOU DO AN ASSIGNMENT TOO!
-   // A temporary variable, instead, acts like a per-pixel double buffer, and
-   // best of all, lead to better performance.
-   fragColour = tmpOutColor;
-}
+#version 150
+
+uniform sampler2D Input;
+uniform vec4 blurAmount;
+
+in vec2 uv;
+out vec4 fragColour;
+
+void main()
+{
+    int i;
+    vec4 tmpOutColor;
+    float  diffuseGlowFactor;
+    vec2 offsets[4];
+    /*
+    // hazy blur
+    -1.8, -1.8,
+    -1.8, 1.8,
+    1.8, -1.8,
+    1.8, 1.8
+    */
+    /*
+    // less-hazy blur
+    -1.0,  2.0,
+    -1.0, -1.0,
+    1.0, -1.0,
+    1.0,  1.0
+    */
+    /*
+      -0.326212, -0.405805,
+      -0.840144, -0.073580,
+      -0.695914,  0.457137,
+      -0.203345,  0.620716
+    */
+
+    offsets[0] = vec2(-0.3,  0.4);
+    offsets[1] = vec2(-0.3,  -0.4);
+    offsets[2] = vec2(0.3,  -0.4);
+    offsets[3] = vec2(0.3,  0.4);
+
+    tmpOutColor = texture( Input, uv ); // UV coords are in image space
+
+    // calculate glow amount
+    diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
+
+    // basic blur filter
+    for (i = 0; i < 4; i++) {
+        tmpOutColor += texture( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
+    }
+
+    tmpOutColor *= 0.25;
+
+    // TIPS (old-skool strikes again!)
+    // Pay attention here! If you use the "out float4 outColor" directly
+    // in your steps while creating the output color (like you remove
+    // the "tmpOutColor" var and just use the "outColor" directly)
+    // your pixel-color output IS CHANGING EACH TIME YOU DO AN ASSIGNMENT TOO!
+    // A temporary variable, instead, acts like a per-pixel double buffer, and
+    // best of all, lead to better performance.
+    fragColour = tmpOutColor;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,9 +1,9 @@
-#version 150
-
-in vec2 NDotV;
-out vec4 fragColour;
-
-void main()
-{
-   fragColour = vec4(NDotV.x);
-}
+#version 150
+
+in vec2 NDotV;
+out vec4 fragColour;
+
+void main()
+{
+   fragColour = vec4(NDotV.x);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/HeatCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,15 +1,15 @@
-#version 150
-
-uniform mat4 worldViewProj;
-uniform vec3 eyePosition;
-in vec4 position;
-in vec4 normal;
-out vec2 NDotV;
-
-void main()
-{
-   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
-   eyeDir = normalize(eyeDir);
-   gl_Position = worldViewProj * position;
-   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
-}
+#version 150
+
+uniform mat4 worldViewProj;
+uniform vec3 eyePosition;
+in vec4 position;
+in vec4 normal;
+out vec2 NDotV;
+
+void main()
+{
+   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
+   eyeDir = normalize(eyeDir);
+   gl_Position = worldViewProj * position;
+   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/InvertFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/InvertFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/InvertFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,11 +1,11 @@
-#version 150
-
-uniform sampler2D RT;
-in vec2 oUv0;
-in vec2 oUv1;
-out vec4 fragColour;
-
-void main()
-{
-	fragColour = 1.0 - texture(RT, oUv0);
-}
+#version 150
+
+uniform sampler2D RT;
+in vec2 oUv0;
+in vec2 oUv1;
+out vec4 fragColour;
+
+void main()
+{
+	fragColour = 1.0 - texture(RT, oUv0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfFS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfFS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfFS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,29 @@
+#version 150
+
+// Ogre port of Nvidia's IsoSurf.cg file
+// Modified code follows. See http://developer.download.nvidia.com/SDK/10/opengl/samples.html for original
+//
+// Cg port of Yury Uralsky's metaball FX shader
+//
+// Authors: Simon Green and Yury Urlasky
+// Email: sdkfeedback at nvidia.com
+//
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+in vec3 oNormal;
+
+out vec4 fragColour;
+
+// Pixel shader
+void main()
+{
+    // Sanitize input
+    vec3 N = normalize(oNormal);
+    vec3 L = vec3(0, 0, 1);
+    float nDotL = dot(N, L);
+
+    vec3 materials[2] = vec3[](vec3(1, 1, 1), vec3(0, 0, 0.5));
+
+    fragColour = vec4(abs(nDotL) * materials[int(nDotL < 0.0)], 0.1);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfGS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfGS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfGS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,89 @@
+#version 150
+
+// Ogre port of Nvidia's IsoSurf.cg file
+// Modified code follows. See http://developer.download.nvidia.com/SDK/10/opengl/samples.html for original
+//
+// Cg port of Yury Uralsky's metaball FX shader
+//
+// Authors: Simon Green and Yury Urlasky
+// Email: sdkfeedback at nvidia.com
+//
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Size of the sampling grid
+in VertexData 
+{
+    vec3 N;
+    vec2 Field;
+} VertexIn[];
+
+out vec3 oNormal;
+
+uniform float IsoValue;
+
+layout(lines_adjacency) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+// Estimate where isosurface intersects grid edge with endpoints v0, v1.
+void CalcIntersection(vec4 Pos0,
+                      vec3 N0,
+                      vec2 Field0,
+                      vec4 Pos1,
+                      vec3 N1,
+                      vec2 Field1)
+{
+    float t = (IsoValue - Field0.x) / (Field1.x - Field0.x);
+    if ((Field0.x < IsoValue) && (Field1.x > Field0.x))
+    {
+        if (t > 0 && t < 1)
+        {
+            gl_Position = mix(Pos0, Pos1, t);
+            oNormal = mix(N0, N1, t);
+            EmitVertex();
+        }
+    }
+}
+
+// Geometry shader
+// input: line with adjacency (tetrahedron)
+// outputs: zero, one or two triangles depending if isosurface intersects tetrahedron
+void main()
+{
+
+    // Construct index for this tetrahedron.
+    uint index = uint((uint(VertexIn[0].Field.y) << 3) |
+                      (uint(VertexIn[1].Field.y) << 2) |
+                      (uint(VertexIn[2].Field.y) << 1) |
+                      uint(VertexIn[3].Field.y));
+
+    // Don't bother if all vertices out or all vertices inside isosurface.
+    if (index > uint(0) && index < uint(15))
+    {
+        // Uber-compressed version of the edge table.
+        uint edgeListHex[8] = 
+            uint[8](uint(0x0001cde0), uint(0x98b08c9d), uint(0x674046ce), uint(0x487bc480), 
+                    uint(0x21301d2e), uint(0x139bd910), uint(0x26376e20), uint(0x3b700000));
+
+        uint edgeValFull = edgeListHex[index/uint(2)];
+        uint three = uint(0x3);
+        uint edgeVal = (index % uint(2) == uint(1)) ? (edgeValFull & uint(0xFFFF)) : ((edgeValFull >> 16) & uint(0xFFFF));
+        ivec4 e0 = ivec4((edgeVal >> 14) & three, (edgeVal >> 12) & three, (edgeVal >> 10) & three, (edgeVal >> 8) & three);
+        ivec4 e1 = ivec4((edgeVal >> 6) & three, (edgeVal >> 4) & three, (edgeVal >> 2) & three, (edgeVal >> 0) & three);
+
+        CalcIntersection(gl_in[e0.x].gl_Position, VertexIn[e0.x].N, VertexIn[e0.x].Field,
+                         gl_in[e0.y].gl_Position, VertexIn[e0.y].N, VertexIn[e0.y].Field);
+        CalcIntersection(gl_in[e0.z].gl_Position, VertexIn[e0.z].N, VertexIn[e0.z].Field,
+                         gl_in[e0.w].gl_Position, VertexIn[e0.w].N, VertexIn[e0.w].Field);
+        CalcIntersection(gl_in[e1.x].gl_Position, VertexIn[e1.x].N, VertexIn[e1.x].Field,
+                         gl_in[e1.y].gl_Position, VertexIn[e1.y].N, VertexIn[e1.y].Field);
+
+        // Emit additional triangle, if necessary.
+        if (e1.z != -1) {
+             CalcIntersection(gl_in[e1.z].gl_Position, VertexIn[e1.z].N, VertexIn[e1.z].Field,
+                              gl_in[e1.w].gl_Position, VertexIn[e1.w].N, VertexIn[e1.w].Field);
+         }
+
+         EndPrimitive();
+     }
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfVS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfVS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/IsosurfVS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,73 @@
+#version 150
+
+// Ogre port of Nvidia's IsoSurf.cg file
+// Modified code follows. See http://developer.download.nvidia.com/SDK/10/opengl/samples.html for original
+//
+// Cg port of Yury Uralsky's metaball FX shader
+//
+// Authors: Simon Green and Yury Urlasky
+// Email: sdkfeedback at nvidia.com
+//
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+in vec4 vertex;
+
+out VertexData {
+    vec3 N;
+    vec2 Field;
+    // vec4 Color;
+} VertexOut;
+
+uniform float IsoValue = 1.0;
+uniform mat4 WorldViewProj;
+uniform mat4 origWorldViewIT;
+uniform vec4 Metaballs[2] = vec4[](vec4( -0.5, 0, 0, 0.2 ), vec4( 0.6, 0, 0, 0.1 ));
+
+// Size of the sampling grid
+const ivec3 SizeMask = ivec3( 63, 63, 63 );
+const ivec3 SizeShift = ivec3( 0, 6, 12 );
+
+// Metaball function
+// Returns metaball function value in .w and its gradient in .xyz
+vec4 Metaball(vec3 Pos, vec3 Center, float RadiusSq)
+{
+    const float epsilon = 0.001;
+
+    vec3 Dist = Pos - Center;
+    float InvDistSq = 1 / (dot(Dist, Dist) + epsilon);
+
+    vec4 o;
+    o.xyz = -2 * RadiusSq * InvDistSq * InvDistSq * Dist;
+    o.w = RadiusSq * InvDistSq;
+    return o;
+}
+
+void main()
+{
+    vec4 Pos;
+
+    // Generate sampling point position based on its index
+    // Pos.x = float((gl_VertexID >> SizeShift.x) & SizeMask.x) / (SizeMask.x + 1);
+    // Pos.y = float((gl_VertexID >> SizeShift.y) & SizeMask.y) / (SizeMask.y + 1);
+    // Pos.z = float((gl_VertexID >> SizeShift.z) & SizeMask.z) / (SizeMask.z + 1);
+    // Pos = Pos*2 - 1;
+    Pos = vertex;
+    
+    // Sum up contributions from all metaballs
+    vec4 Field = vec4(0,0,0,0);
+    for (int i = 0; i < 2; i++)
+        Field += Metaball(Pos.xyz, Metaballs[i].xyz, Metaballs[i].w);
+
+    mat3 WorldViewIT = mat3(origWorldViewIT[0].xyz, origWorldViewIT[1].xyz, origWorldViewIT[2].xyz);
+    
+    // Transform position and normals
+    gl_Position = WorldViewProj * vec4(Pos.xyz, 1);
+    VertexOut.N = WorldViewIT * Field.xyz;        // we want normals in world space
+    VertexOut.Field.x = Field.w;
+
+    // Generate in-out flags
+    VertexOut.Field.y = (Field.w < IsoValue) ? 1 : 0;
+
+    // VertexOut.Color = (Field*0.5+0.5) * (Field.w / 10.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/LaplaceFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/LaplaceFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/LaplaceFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,38 +1,38 @@
-#version 150
-
-uniform sampler2D Image;
-uniform float scale;
-uniform float pixelSize;
-in vec2 oUv0;
-out vec4 fragColour;
-
-// The Laplace filter approximates the second order derivate,
-// that is, the rate of change of slope in the image. It can be
-// used for edge detection. The Laplace filter gives negative
-// response on the higher side of the edge and positive response
-// on the lower side.
-
-// This is the filter kernel:
-// 0  1  0
-// 1 -4  1
-// 0  1  0
-
-void main()
-{
-    vec2 samples[4];
-	samples[0] = vec2(0, -1);
-	samples[1] = vec2(-1, 0);
-	samples[2] = vec2(1, 0);
-	samples[3] = vec2(0, 1);
-
-    mediump vec4 tc = texture(Image, oUv0);
-    vec4 laplace = -4.0 * tc;
-
-    // Sample the neighbor pixels
-    for (int i = 0; i < 4; i++){
-       laplace += texture(Image, oUv0 + pixelSize * samples[i]);
-    }
-
-    fragColour = (0.5 + scale * laplace);
-}
-
+#version 150
+
+uniform sampler2D Image;
+uniform float scale;
+uniform float pixelSize;
+in vec2 oUv0;
+out vec4 fragColour;
+
+// The Laplace filter approximates the second order derivate,
+// that is, the rate of change of slope in the image. It can be
+// used for edge detection. The Laplace filter gives negative
+// response on the higher side of the edge and positive response
+// on the lower side.
+
+// This is the filter kernel:
+// 0  1  0
+// 1 -4  1
+// 0  1  0
+
+void main()
+{
+    vec2 samples[4];
+	samples[0] = vec2(0, -1);
+	samples[1] = vec2(-1, 0);
+	samples[2] = vec2(1, 0);
+	samples[3] = vec2(0, 1);
+
+    mediump vec4 tc = texture(Image, oUv0);
+    vec4 laplace = -4.0 * tc;
+
+    // Sample the neighbor pixels
+    for (int i = 0; i < 4; i++){
+       laplace += texture(Image, oUv0 + pixelSize * samples[i]);
+    }
+
+    fragColour = (0.5 + scale * laplace);
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/LightToHeatFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/LightToHeatFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/LightToHeatFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,36 +1,36 @@
-#version 150
-
-uniform vec4 random_fractions;
-uniform vec4 heatBiasScale;
-uniform vec4 depth_modulator;
-
-uniform sampler2D Input;         // output of HeatVisionCaster_fp (NdotV)
-uniform sampler2D NoiseMap;
-uniform sampler2D HeatLookup;
-
-in vec4 diffuse;
-in vec2 uv;
-out vec4 fragColour;
-
-void main()
-{
-   float depth, heat, interference;
-
-   //  Output constant color:
-   depth = texture( Input, uv ).x;
-   depth *= (depth * depth_modulator).x;
-
-   heat = (depth * heatBiasScale.y);
-
-//   if (depth > 0)
-   {
-		interference = -0.5 + texture( NoiseMap, uv + vec2( random_fractions.x, random_fractions.y ) ).x;
-		interference *= interference;
-		interference *= 1.0 - heat;
-		heat += interference;//+ heatBiasScale.x;
-   }
-
-   // Clamp UVs
-   heat  = max( 0.005, min( 0.995, heat ) );
-   fragColour = texture( HeatLookup, vec2( heat, 0.0 ) );
-}
+#version 150
+
+uniform vec4 random_fractions;
+uniform vec4 heatBiasScale;
+uniform vec4 depth_modulator;
+
+uniform sampler2D Input;         // output of HeatVisionCaster_fp (NdotV)
+uniform sampler2D NoiseMap;
+uniform sampler2D HeatLookup;
+
+// in vec4 diffuse;
+in vec2 uv;
+out vec4 fragColour;
+
+void main()
+{
+    float depth, heat, interference;
+
+    //  Output constant color:
+    depth = texture( Input, uv ).x;
+    depth *= (depth * depth_modulator).x;
+
+    heat = (depth * heatBiasScale.y);
+
+    // if (depth > 0)
+    {
+        interference = -0.5 + texture( NoiseMap, uv + vec2( random_fractions.x, random_fractions.y ) ).x;
+        interference *= interference;
+        interference *= 1.0 - heat;
+        heat += interference;//+ heatBiasScale.x;
+    }
+
+    // Clamp UVs
+    heat  = max( 0.005, min( 0.995, heat ) );
+    fragColour = texture( HeatLookup, vec2( heat, 0.0 ) );
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/NightVisionFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/NightVisionFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/NightVisionFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,32 +1,32 @@
-#version 150
-
-out vec4 fragColour;
-
-uniform sampler2D RT;
-uniform sampler3D noiseVol;
-
-in vec2 oUv0;
-uniform vec4 lum;
-uniform float time;
-
-void main()
-{
-	vec4 oC;
-	oC = texture(RT, oUv0);
-	
-	//obtain luminence value
-	oC = vec4(dot(oC,lum));
-	
-	//add some random noise
-	oC += 0.2 *(texture(noiseVol, vec3(oUv0*5,time)))- 0.05;
-	
-	//add lens circle effect
-	//(could be optimised by using texture)
-	float dist = distance(oUv0, vec2(0.5,0.5));
-	oC *= smoothstep(0.5,0.45,dist);
-	
-	//add rb to the brightest pixels
-	oC.rb = vec2(max(oC.r - 0.75, 0)*4);
-	
-	fragColour = oC;
-}
+#version 150
+
+out vec4 fragColour;
+
+uniform sampler2D RT;
+uniform sampler3D noiseVol;
+
+in vec2 oUv0;
+uniform vec4 lum;
+uniform float time;
+
+void main()
+{
+	vec4 oC;
+	oC = texture(RT, oUv0);
+	
+	//obtain luminence value
+	oC = vec4(dot(oC,lum));
+	
+	//add some random noise
+	oC += 0.2 *(texture(noiseVol, vec3(oUv0*5,time)))- 0.05;
+	
+	//add lens circle effect
+	//(could be optimised by using texture)
+	float dist = distance(oUv0, vec2(0.5,0.5));
+	oC *= smoothstep(0.5,0.45,dist);
+	
+	//add rb to the brightest pixels
+	oC.rb = vec2(max(oC.r - 0.75, 0)*4);
+	
+	fragColour = oC;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/OldMovieFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/OldMovieFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/OldMovieFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,56 +1,56 @@
-#version 150
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-uniform sampler2D RT;
-uniform sampler2D SplotchesTx;
-uniform sampler1D Texture2;
-uniform sampler1D SepiaTx;
-uniform float time_cycle_period;
-uniform float flicker;
-uniform float DirtFrequency;
-uniform vec3 luminance;
-uniform float frameJitter;
-uniform float lumiShift;
-
-vec2 calcSpriteAddr(vec2 texCoord, float DirtFrequency1, float period)
-{
-   return texCoord + texture(Texture2, period * DirtFrequency1).xy;
-}
-
-vec4 getSplotches(vec2 spriteAddr)
-{
-   // get sprite address into paged texture coords space
-   spriteAddr = spriteAddr / 6.3;
-   spriteAddr = spriteAddr - (spriteAddr / 33.3);
-
-//   return texture(SplotchesTx, spriteAddr);
-   return vec4(1.0) * texture(SplotchesTx, spriteAddr).r;
-}
-
-void main()
-{
-   // get sprite address
-   vec2 spriteAddr = calcSpriteAddr(oUv0, DirtFrequency, time_cycle_period);
-
-   // add some dark and light splotches to the film
-   vec4 splotches = getSplotches(spriteAddr);
-   vec4 specs = 1.0 - getSplotches(spriteAddr / 3.0);
-
-   // convert color to base luminance
-   vec4 base = texture(RT, oUv0 + vec2(0.0, spriteAddr.y * frameJitter));
-   float lumi = dot(base.rgb, luminance);
-   // randomly shift luminance
-   lumi -= spriteAddr.x * lumiShift;
-   // tone map luminance
-   base.rgb = texture(SepiaTx, lumi).rgb;
-
-   // calc flicker speed
-   float darken = fract(flicker * time_cycle_period);
-
-   // we want darken to cycle between 0.6 and 1.0
-   darken = abs(darken - 0.5) * 0.4 + 0.6;
-   // composite dirt onto film
-   fragColour = base * splotches * darken + specs;
-}
+#version 150
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+uniform sampler2D RT;
+uniform sampler2D SplotchesTx;
+uniform sampler1D Texture2;
+uniform sampler1D SepiaTx;
+uniform float time_cycle_period;
+uniform float flicker;
+uniform float DirtFrequency;
+uniform vec3 luminance;
+uniform float frameJitter;
+uniform float lumiShift;
+
+vec2 calcSpriteAddr(vec2 texCoord, float DirtFrequency1, float period)
+{
+   return texCoord + texture(Texture2, period * DirtFrequency1).xy;
+}
+
+vec4 getSplotches(vec2 spriteAddr)
+{
+   // get sprite address into paged texture coords space
+   spriteAddr = spriteAddr / 6.3;
+   spriteAddr = spriteAddr - (spriteAddr / 33.3);
+
+//   return texture(SplotchesTx, spriteAddr);
+   return vec4(1.0) * texture(SplotchesTx, spriteAddr).r;
+}
+
+void main()
+{
+   // get sprite address
+   vec2 spriteAddr = calcSpriteAddr(oUv0, DirtFrequency, time_cycle_period);
+
+   // add some dark and light splotches to the film
+   vec4 splotches = getSplotches(spriteAddr);
+   vec4 specs = 1.0 - getSplotches(spriteAddr / 3.0);
+
+   // convert color to base luminance
+   vec4 base = texture(RT, oUv0 + vec2(0.0, spriteAddr.y * frameJitter));
+   float lumi = dot(base.rgb, luminance);
+   // randomly shift luminance
+   lumi -= spriteAddr.x * lumiShift;
+   // tone map luminance
+   base.rgb = texture(SepiaTx, lumi).rgb;
+
+   // calc flicker speed
+   float darken = fract(flicker * time_cycle_period);
+
+   // we want darken to cycle between 0.6 and 1.0
+   darken = abs(darken - 0.5) * 0.4 + 0.6;
+   // composite dirt onto film
+   fragColour = base * splotches * darken + specs;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/OldTV.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/OldTV.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/OldTV.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,46 +1,45 @@
-#version 150
-
-in vec4 pos;
-in vec2 oUv0;
-out vec4 fragColour;
-
-uniform sampler2D Image;
-uniform sampler3D Rand;
-uniform sampler3D Noise;
-uniform float distortionFreq;
-uniform float distortionScale;
-uniform float distortionRoll;
-uniform float interference;
-uniform float frameLimit;
-uniform float frameShape;
-uniform float frameSharpness;
-uniform float time_0_X;
-uniform float sin_time_0_X;
-
-void main()
-{
-   // Define a frame shape
-   float f = (1 - pos.x * pos.x) * (1 - pos.y * pos.y);
-   float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
-
-   // Interference ... just a texture filled with rand()
-   float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
-
-   // Some signed noise for the distortion effect
-   float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
-
-   // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
-   float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
-   dst *= (1 - dst);
-   // Make sure distortion is highest in the center of the image
-   dst /= 1 + distortionScale * abs(pos.y);
-
-   // ... and finally distort
-   vec2 inUv = oUv0;
-   inUv.x += distortionScale * noisy * dst;
-   vec4 image = texture(Image, inUv);
-
-   // Combine frame, distorted image and interference
-   fragColour = frame * (interference * rand + image);
-}
-
+#version 150
+
+in vec4 pos;
+in vec2 oUv0;
+out vec4 fragColour;
+
+uniform sampler2D Image;
+uniform sampler3D Rand;
+uniform sampler3D Noise;
+uniform float distortionFreq;
+uniform float distortionScale;
+uniform float distortionRoll;
+uniform float interference;
+uniform float frameLimit;
+uniform float frameShape;
+uniform float frameSharpness;
+uniform float time_0_X;
+uniform float sin_time_0_X;
+
+void main()
+{
+    // Define a frame shape
+    float f = (1 - pos.x * pos.x) * (1 - pos.y * pos.y);
+    float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
+
+    // Interference ... just a texture filled with rand()
+    float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
+
+    // Some signed noise for the distortion effect
+    float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
+
+    // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
+    float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
+    dst *= (1 - dst);
+    // Make sure distortion is highest in the center of the image
+    dst /= 1 + distortionScale * abs(pos.y);
+
+    // ... and finally distort
+    vec2 inUv = oUv0;
+    inUv.x += distortionScale * noisy * dst;
+    vec4 image = texture(Image, inUv);
+
+    // Combine frame, distorted image and interference
+    fragColour = frame * (interference * rand + image);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayFS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayFS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayFS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 150
+
+in block {
+    vec4 pos;
+    vec4 colour;
+    vec2 texcoord;
+} Firework;
+
+out vec4 fragColour;
+
+uniform sampler2D diffuseTex;
+
+// Colours the fireworks.
+void main()
+{
+    fragColour = texture(diffuseTex, Firework.texcoord) * Firework.colour;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayGS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayGS.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayGS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,42 +1,42 @@
-#version 150
-
-in block {
-	vec3 	pos;
-    vec4 	color;
-	float	radius;
-} ColoredFirework[];
-
-out block {
-	vec4 	pos;
-    vec4 	color;
-	vec2	texcoord;
-} Firework;
-
-uniform mat4 inverseView;
-uniform mat4 worldViewProj;
-
-layout(points) in;
-layout(triangle_strip, max_vertices = 4) out;
-
-//The geometry shader that prepares the fireworks for display
-void main()
-{
-	vec3 g_positions[4] = vec3[4](vec3(-1, 1, 0), vec3(-1, -1, 0), vec3(1, 1, 0), vec3(1, -1, 0));
-    vec2 g_texcoords[4] = vec2[4](vec2(0, 1), vec2(1, 1), vec2(0, 0), vec2(1, 0));
-
-    //
-    // Emit two new triangles
-    //
-    for(int i=0; i<4; i++)
-    {
-		vec3 position = -g_positions[i] * ColoredFirework[0].radius;
-        position = mat3(inverseView) * position + ColoredFirework[0].pos;
-        gl_Position = worldViewProj * vec4(position, 1.0);
-
-        Firework.pos = gl_Position;
-        Firework.color = ColoredFirework[0].color;
-        Firework.texcoord = g_texcoords[i];
-        EmitVertex();
-    }
-    EndPrimitive();
-}
+#version 150
+
+in block {
+    vec3 pos;
+    vec4 colour;
+    float radius;
+} ColouredFirework[];
+
+out block {
+    vec4 pos;
+    vec4 colour;
+    vec2 texcoord;
+} Firework;
+
+uniform mat4 inverseView;
+uniform mat4 worldViewProj;
+
+layout(points) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+//The geometry shader that prepares the fireworks for display
+void main()
+{
+    vec3 g_positions[4] = vec3[4](vec3(-1, 1, 0), vec3(-1, -1, 0), vec3(1, 1, 0), vec3(1, -1, 0));
+    vec2 g_texcoords[4] = vec2[4](vec2(0, 1), vec2(1, 1), vec2(0, 0), vec2(1, 0));
+
+    //
+    // Emit two new triangles
+    //
+    for (int i = 0; i < 4; i++)
+    {
+        vec3 position = -g_positions[i] * ColouredFirework[0].radius;
+        position = mat3(inverseView) * position + ColouredFirework[0].pos;
+        gl_Position = worldViewProj * vec4(position, 1.0);
+
+        Firework.pos = gl_Position;
+        Firework.colour = ColouredFirework[0].colour;
+        Firework.texcoord = g_texcoords[i];
+        EmitVertex();
+    }
+    EndPrimitive();
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,65 +1,81 @@
-#version 150
-
-//
-// Explanation of different particle types
-//
-#define PT_LAUNCHER 0 //Firework Launcher - launches a PT_SHELL every so many seconds
-#define PT_SHELL    1 //Unexploded shell - flies from the origin and explodes into many PT_EMBERXs
-#define PT_EMBER1   2 //basic particle - after it's emitted from the shell, it dies
-#define PT_EMBER2   3 //after it's emitted, it explodes again into many PT_EMBER1s
-#define PT_EMBER3   4 //just a differently colored ember1
-#define P_SHELLLIFE 3.0
-#define P_EMBER1LIFE 2.5
-#define P_EMBER2LIFE 1.5
-#define P_EMBER3LIFE 2.0
-
-in vec4 position;
-uniform float inTimer;
-uniform float inType;
-uniform vec3 inVelocity;
-
-out block {
-	vec3 	pos;
-    vec4 	color;
-	float	radius;
-} ColoredFirework;
-
-uniform mat4 worldViewProj;
-
-//The vertex shader that prepares the fireworks for display
-void main()
-{
-    //
-    // Pass the point through
-    //
-    ColoredFirework.pos = position.xyz; //Multiply by world matrix?
-    ColoredFirework.radius = 1.5;
-    
-    //  
-    // calculate the color
-    //
-    if( inType == PT_LAUNCHER )
-    {
-        ColoredFirework.color = vec4(1,0.1,0.1,1);
-        ColoredFirework.radius = 1.0;
-    }
-    else if( inType == PT_SHELL )
-    {
-        ColoredFirework.color = vec4(0.1,1,1,1);
-        ColoredFirework.radius = 1.0;
-    }
-    else if( inType == PT_EMBER1 )
-    {
-        ColoredFirework.color = vec4(1,1,0.1,1);
-        ColoredFirework.color *= (inTimer / P_EMBER1LIFE );
-    }
-    else if( inType == PT_EMBER2 )
-    {
-        ColoredFirework.color = vec4(1,0.1,1,1);
-    }
-    else if( inType == PT_EMBER3 )
-    {
-        ColoredFirework.color = vec4(1,0.1,0.1,1);
-        ColoredFirework.color *= (inTimer / P_EMBER3LIFE );
-    }
-}
+#version 150
+
+//
+// Explanation of different particle types
+//
+// Firework Launcher - launches a PT_SHELL every so many seconds.
+#define PT_LAUNCHER 0 
+// Unexploded shell - flies from the origin and explodes into many PT_EMBERX's.
+#define PT_SHELL    1 
+// Basic particle - after it's emitted from the shell, it dies.
+#define PT_EMBER1   2 
+// After it's emitted, it explodes again into many PT_EMBER1's.
+#define PT_EMBER2   3 
+// Just a differently colored ember1.
+#define PT_EMBER3   4 
+#define P_SHELLLIFE 3.0
+#define P_EMBER1LIFE 2.5
+#define P_EMBER2LIFE 1.5
+#define P_EMBER3LIFE 2.0
+
+in vec3 position;
+// timer
+in float uv0;
+// type
+in float uv1;
+// velocity
+in vec3 uv2;
+
+out block {
+    vec3 pos;
+    vec4 colour;
+    float radius;
+} ColouredFirework;
+
+uniform mat4 worldViewProj;
+
+//The vertex shader that prepares the fireworks for display
+void main()
+{
+    float inTimer = uv0;
+    float inType = uv1;
+    
+    //
+    // Pass the point through
+    //
+    ColouredFirework.pos = position; // Multiply by world matrix?
+    ColouredFirework.radius = 1.5;
+    
+    //  
+    // calculate the colour
+    //
+    if (inType == PT_LAUNCHER)
+    {
+        // red
+        ColouredFirework.colour = vec4(1, 0.1, 0.1, 1);
+        ColouredFirework.radius = 1.0;
+    }
+    else if (inType == PT_SHELL)
+    {
+        // cyan
+        ColouredFirework.colour = vec4(0.1, 1, 1, 1);
+        ColouredFirework.radius = 1.0;
+    }
+    else if (inType == PT_EMBER1)
+    {
+        // yellow
+        ColouredFirework.colour = vec4(1, 1, 0.1, 1);
+        ColouredFirework.colour *= (inTimer / P_EMBER1LIFE);
+    }
+    else if (inType == PT_EMBER2)
+    {
+        // fuschia
+        ColouredFirework.colour = vec4(1, 0.1, 1, 1);
+    }
+    else if (inType == PT_EMBER3)
+    {
+        // red
+        ColouredFirework.colour = vec4(1, 0.1, 0.1, 1);
+        ColouredFirework.colour *= (inTimer / P_EMBER3LIFE);
+    }
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateGS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateGS.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateGS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,210 +1,245 @@
-#version 150
-
-//
-// Explanation of different particle types
-//
-#define PT_LAUNCHER 0 //Firework Launcher - launches a PT_SHELL every so many seconds
-#define PT_SHELL    1 //Unexploded shell - flies from the origin and explodes into many PT_EMBERXs
-#define PT_EMBER1   2 //basic particle - after it's emitted from the shell, it dies
-#define PT_EMBER2   3 //after it's emitted, it explodes again into many PT_EMBER1s
-#define PT_EMBER3   4 //just a differently colored ember1
-#define P_SHELLLIFE 3.0
-#define P_EMBER1LIFE 2.5
-#define P_EMBER2LIFE 1.5
-#define P_EMBER3LIFE 2.0
-
-//These two were originally shader params, but they caused runtime errors
-#define NUM_EMBER_1S 30
-#define NUM_EMBER_2S 15
-#define NUM_EMBER_3S 10
-//This one was originally a variant, but this also causes runtime errors
-//#define MAX_EMBER_2S 15.0
-
-in block {
-	vec4 	Pos;
-	float 	Timer;
-    float 	Type;
-	vec3	Vel;
-} FireworkData[];
-
-layout(points) in;
-layout(points, max_vertices = 1) out;
-
-uniform sampler1D randomTex;
-uniform vec3 frameGravity;
-uniform float globalTime;
-uniform float elapsedTime;
-uniform float secondsPerFirework;
-out vec4 colour;
-//
-// Generic particle motion handler
-//
-
-void GSGenericHandler( vec3 Pos, vec3 Vel, float Timer, float Type,
-						float elapsedTime, 
-						vec3 frameGravity)
-{
-    gl_Position.xyz = Pos + (Vel * elapsedTime);
-    Vel += frameGravity;
-    Timer -= elapsedTime;
-	if (Pos.y > -100)
-	{
-		EmitVertex();//Pos : POSITION, Vel : TEXCOORD2, Timer : TEXCOORD0, Type : TEXCOORD1);
-	}
-}
-
-//
-// Sample a random direction from our random texture
-//
-vec3 RandomDir(float fOffset, float globalTime, sampler1D randomTex)
-{
-    float tCoord = (globalTime + fOffset) / 300.0;
-    return texture(randomTex, tCoord).rgb;
-}
-
-//
-// Launcher type particle handler
-//
-void GSLauncherHandler( vec3 Pos, vec3 Vel, float Timer, float Type, 
-						float elapsedTime, 
-						float globalTime, 
-						sampler1D randomTex,
-						float secondsPerFirework)
-{
-    if(Timer <= 0)
-    {
-        vec3 vRandom = normalize( RandomDir( Type, globalTime, randomTex) );
-		//Give it more of an up bias
-        vRandom = normalize(vRandom + vec3(0,2.5,0)); 
-		
-		//time to emit a new SHELL
-        gl_Position.xyz = Pos + Vel*elapsedTime;
-        vec3 outputVel = Vel + vRandom*35.0;
-        float  outputTimer = P_SHELLLIFE + vRandom.y*0.5;
-        float outputType = PT_SHELL;
-        EmitVertex();//(outputPos : POSITION, outputVel : TEXCOORD2, outputTimer : TEXCOORD0, outputType : TEXCOORD1);
-        
-        //reset our timer
-        Timer = secondsPerFirework + vRandom.x*0.4;
-    }
-    else
-    {
-        Timer -= elapsedTime;
-    }
-    
-    //emit ourselves to keep us alive
-    EmitVertex();//( Pos : POSITION, Vel : TEXCOORD2, Timer : TEXCOORD0, Type : TEXCOORD1);
-}
-
-//
-// Shell type particle handler
-//	
-void GSShellHandler( vec3 Pos, vec3 Vel, float Timer, float Type,
-					float elapsedTime, 
-					float globalTime, 
-					sampler1D randomTex,
-					vec3 frameGravity)
-{
-    if(Timer <= 0)
-    {
-        vec3 outputPos;
-		vec3 outputVel;
-		float outputTimer;
-		float outputType;
-		
-        vec3 vRandom = vec3(0,0,0);
-        
-        //time to emit a series of new Ember1s  
-        for(int i=0; i<NUM_EMBER_1S; i++)
-        {
-            vRandom = normalize( RandomDir( Type+i, globalTime, randomTex ) );
-            gl_Position.xyz = Pos + Vel*elapsedTime;
-            outputVel = Vel + vRandom*15.0;
-            outputTimer = P_EMBER1LIFE;
-            outputType = PT_EMBER1;
-            EmitVertex();//(outputPos : POSITION, outputTimer : TEXCOORD0, outputType : TEXCOORD1, outputVel : TEXCOORD2);
-        }
-        
-        //find out how many Ember2s to emit
-		//Not doing this because it causes a runtime error
-		//int numEmber2s = abs(vRandom.x)*MAX_EMBER_2S;
-        for(int i=0; i<NUM_EMBER_2S; i++)
-        {
-            vRandom = normalize( RandomDir( Type, globalTime, randomTex) );
-            gl_Position.xyz = Pos + Vel*elapsedTime;
-            outputVel = Vel + vRandom*10.0;
-            outputTimer = P_EMBER2LIFE + 0.4*vRandom.x;
-            outputType = PT_EMBER2;
-            EmitVertex();//(outputPos : POSITION, outputVel : TEXCOORD2, outputTimer : TEXCOORD0, outputType : TEXCOORD1);
-        }
-        
-    }
-    else
-    {
-        GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity );
-    }
-}
-
-//
-// Ember1 and Ember3 type particle handler
-//
-void GSEmber1Handler( vec3 Pos, vec3 Vel, float Timer, float Type,
-						float elapsedTime, 
-						vec3 frameGravity)
-{
-    if(Timer > 0)
-    {
-        GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity );
-    }
-}
-
-//
-// Ember2 type particle handler
-//
-void GSEmber2Handler( vec3 Pos, vec3 Vel, float Timer, float Type,
-						float elapsedTime, 
-						float globalTime, 
-						sampler1D randomTex,
-						vec3 frameGravity)
-{
-    if(Timer <= 0)
-    {
-		vec3 outputPos;
-		vec3 outputVel;
-		float outputTimer;
-		float outputType;
-    
-        //time to emit a series of new Ember3s  
-        for(int i=0; i<NUM_EMBER_3S; i++)
-        {
-            gl_Position.xyz = Pos + Vel*elapsedTime;
-            outputVel = Vel + normalize( RandomDir( Type + i, globalTime, randomTex ) )*10.0;
-            outputTimer = P_EMBER3LIFE;
-            outputType = PT_EMBER3;
-            EmitVertex();
-        }
-    }
-    else
-    {
-         GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity );
-    }
-}
-
-void main()
-{
-	if( FireworkData[0].Type == PT_LAUNCHER )
-        GSLauncherHandler( FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type, 
-							elapsedTime, globalTime, randomTex, secondsPerFirework);
-	else if ( FireworkData[0].Type == PT_SHELL )
-        GSShellHandler( FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type, 
-							elapsedTime, globalTime, randomTex, frameGravity);
-	else if ( FireworkData[0].Type == PT_EMBER1 ||
-              FireworkData[0].Type == PT_EMBER3 )
-        GSEmber1Handler( FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type, 
-							elapsedTime, frameGravity);
-    else if( FireworkData[0].Type == PT_EMBER2 )
-        GSEmber2Handler( FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type, 
-							elapsedTime, globalTime, randomTex, frameGravity);
-    colour = vec4(1.0,1.0,0.0,1.0);
-	EndPrimitive();
-}
+#version 150
+
+//
+// Explanation of different particle types.
+//
+// Firework Launcher - launches a PT_SHELL every so many seconds.
+#define PT_LAUNCHER 0 
+// Unexploded shell - flies from the origin and explodes into many PT_EMBERX's.
+#define PT_SHELL    1 
+// Basic particle - after it's emitted from the shell, it dies.
+#define PT_EMBER1   2 
+// After it's emitted, it explodes again into many PT_EMBER1's.
+#define PT_EMBER2   3 
+// Just a different colored ember1.
+#define PT_EMBER3   4
+#define P_SHELLLIFE 3.0
+#define P_EMBER1LIFE 2.5
+#define P_EMBER2LIFE 1.5
+#define P_EMBER3LIFE 2.0
+
+// These two were originally shader params, but they caused runtime errors.
+#define NUM_EMBER_1S 30
+#define NUM_EMBER_2S 15
+#define NUM_EMBER_3S 10
+// This one was originally a variant, but also causes runtime errors.
+//#define MAX_EMBER_2S 15.0
+
+layout(points) in;
+layout(points, max_vertices = 60) out;
+
+in block {
+    vec3 Pos;
+    float Timer;
+    float Type;
+    vec3 Vel;
+} FireworkData[];
+
+// out vec3 outputPos;
+// out float outputTimer;
+// out float outputType;
+// out vec3 outputVel;
+
+// out vec3 gl_Position;
+out vec3 oPos;
+out float oUv0; // Timer
+out float oUv1; // Type
+out vec3 oUv2;  // Velocity
+
+uniform sampler1D randomTexture;
+uniform vec3 frameGravity;
+uniform float globalTime;
+uniform float elapsedTime;
+uniform float secondsPerFirework;
+
+//
+// Generic particle motion handler
+//
+void GSGenericHandler( vec3 Pos, vec3 Vel, float Timer, float Type,
+                       float elapsedTime,
+                       vec3 frameGravity)
+{
+    Vel += frameGravity;
+    Timer -= elapsedTime;
+
+    if (Pos.y > -100)
+    {
+        oPos = Pos + (Vel * elapsedTime);
+        oUv0 = Timer;
+        oUv1 = Type;
+        oUv2 = Vel;
+        EmitVertex();
+    }
+}
+
+//
+// Sample a random direction from our random texture
+//
+vec3 RandomDir(float fOffset, float globalTime, sampler1D randomTex)
+{
+    float tCoord = (globalTime + fOffset) / 300.0;
+    return texture(randomTex, tCoord).rgb;
+}
+
+//
+// Launcher type particle handler
+//
+void GSLauncherHandler( vec3 Pos, vec3 Vel, float Timer, float Type,
+                        float elapsedTime,
+                        float globalTime,
+                        sampler1D randomTex,
+                        float secondsPerFirework)
+{
+    if (Timer <= 0)
+    {
+        vec3 vRandom = normalize(RandomDir(Type, globalTime, randomTex));
+        // Give it more of an up bias.
+        vRandom = normalize(vRandom + vec3(0, 2.5, 0));
+
+        // Time to emit a new SHELL.
+        oPos = Pos + Vel * elapsedTime;
+        oUv2 = Vel + vRandom * 35.0;
+        oUv0 = P_SHELLLIFE + vRandom.y * 0.5;
+        oUv1 = PT_SHELL;
+        EmitVertex();
+
+        // Reset our timer.
+        Timer = secondsPerFirework + vRandom.x * 0.4;
+    }
+    else
+    {
+        Timer -= elapsedTime;
+    }
+
+    // Emit ourselves to keep us alive.
+    oPos = Pos;
+    oUv2 = Vel;
+    oUv0 = Timer;
+    oUv1 = Type;
+    EmitVertex();
+}
+
+//
+// Shell type particle handler
+//
+void GSShellHandler( vec3 Pos, vec3 Vel, float Timer, float Type,
+                     float elapsedTime,
+                     float globalTime,
+                     sampler1D randomTex,
+                     vec3 frameGravity)
+{
+    if (Timer <= 0)
+    {
+        vec3 vRandom = vec3(0,0,0);
+
+        // Time to emit a series of new Ember1s.
+        for (int i = 0; i < NUM_EMBER_1S; i++)
+        {
+            vRandom = normalize(RandomDir(Type + i, globalTime, randomTex));
+            oPos = Pos + Vel * elapsedTime;
+            oUv2 = Vel + vRandom * 15.0;
+            oUv0 = P_EMBER1LIFE;
+            oUv1 = PT_EMBER1;
+            EmitVertex();
+        }
+
+        // Find out how many Ember2s to emit.
+        // Not doing this because it causes a runtime error.
+        //int numEmber2s = abs(vRandom.x)*MAX_EMBER_2S;
+        for (int i = 0; i < NUM_EMBER_2S; i++)
+        {
+            vRandom = normalize(RandomDir(Type, globalTime, randomTex));
+            oPos = Pos + Vel * elapsedTime;
+            oUv2 = Vel + vRandom * 10.0;
+            oUv0 = P_EMBER2LIFE + 0.4 * vRandom.x;
+            oUv1 = PT_EMBER2;
+            EmitVertex();
+        }
+
+    }
+    else
+    {
+        GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity);
+    }
+}
+
+//
+// Ember1 and Ember3 type particle handler.
+//
+void GSEmber1Handler( vec3 Pos, vec3 Vel, float Timer, float Type,
+                      float elapsedTime,
+                      vec3 frameGravity)
+{
+    if (Timer > 0)
+    {
+        GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity);
+    }
+}
+
+//
+// Ember2 type particle handler.
+//
+void GSEmber2Handler( vec3 Pos, vec3 Vel, float Timer, float Type,
+                      float elapsedTime,
+                      float globalTime,
+                      sampler1D randomTex,
+                      vec3 frameGravity)
+{ 
+    if (Timer <= 0)
+    {
+        // Time to emit a series of new Ember3's.
+        for (int i = 0; i < NUM_EMBER_3S; i++)
+        {
+            oPos = Pos + Vel * elapsedTime;
+            oUv2 = Vel + normalize(RandomDir(Type + i, globalTime, randomTex)) * 10.0;
+            oUv0 = P_EMBER3LIFE;
+            oUv1 = PT_EMBER3;
+            EmitVertex();
+        }
+    }
+    else
+    {
+        GSGenericHandler(Pos, Vel, Timer, Type, elapsedTime, frameGravity);
+    }
+}
+
+void main()
+{
+    if (FireworkData[0].Type == PT_LAUNCHER)
+        GSLauncherHandler(FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type,
+                           elapsedTime, globalTime, randomTexture, secondsPerFirework);
+    else if (FireworkData[0].Type == PT_SHELL)
+        GSShellHandler(FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type,
+                        elapsedTime, globalTime, randomTexture, frameGravity);
+    else if (FireworkData[0].Type == PT_EMBER1 ||
+             FireworkData[0].Type == PT_EMBER3)
+        GSEmber1Handler(FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type,
+                         elapsedTime, frameGravity);
+    else if (FireworkData[0].Type == PT_EMBER2)
+        GSEmber2Handler(FireworkData[0].Pos.xyz, FireworkData[0].Vel, FireworkData[0].Timer, FireworkData[0].Type,
+                         elapsedTime, globalTime, randomTexture, frameGravity);
+    EndPrimitive();
+
+    // // gl_Position.xyz = FireworkData[0].Pos;// + FireworkData[0].Vel * elapsedTime;
+    // // gl_Position.w = 1;
+    // gl_Position = FireworkData[0].Pos + 1;// + FireworkData[0].Vel * elapsedTime;
+    // // gl_Position = Pos[0];// + FireworkData[0].Vel * elapsedTime;
+    // //gl_Position = vec4(10, 10, 10, 1);
+    // // oUv0 = P_SHELLLIFE + 0.5;
+    // oUv0 = FireworkData[0].Timer;
+    // // oUv0 = Timer[0];
+    // oUv1 = FireworkData[0].Type;
+    // // oUv1 = Type[0];
+    // oUv2 = FireworkData[0].Vel;
+    // // oUv2 = Vel[0];
+    // //oUv2 = vec3(4, 5, 35.0);
+    // EmitVertex();
+    // EndPrimitive();
+    // // // gl_Position = vec4(10, 20, 30, 1);
+    // gl_Position = vec3(10, 20, 30);
+    // oUv0 = P_EMBER3LIFE;
+    // oUv1 = PT_SHELL;
+    // oUv2 = vec3(40, 50, 60);
+    // EmitVertex();
+    // EndPrimitive();
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateVS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateVS.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_GenerateVS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,22 +1,40 @@
-#version 150
-
-in vec4 vertex;
-uniform float inTimer;
-uniform float inType;
-uniform vec3 inVelocity;
-
-out block {
-	vec4 	Pos;
-	float 	Timer;
-    float 	Type;
-	vec3	Vel;
-} FireworkData;
-
-//The vertex shader that prepares the fireworks for display
-void main()
-{
-	FireworkData.Pos = vertex;
-	FireworkData.Timer = inTimer;
-	FireworkData.Type = inType;
-	FireworkData.Vel = inVelocity;
-}
+#version 150
+
+in vec3 vertex;
+in float uv0; // Timer
+in float uv1; // Type
+in vec3 uv2;  // Velocity
+// in float inTimer;
+// in float inType;
+// in vec3 inVelocity;
+
+
+out block {
+    vec3 Pos;
+    float Timer;
+    float Type;
+    vec3 Vel;
+} FireworkData;
+
+// out vec3 Pos;
+// out float Timer;
+// out float Type;
+// out vec3 Vel;
+
+//The vertex shader that prepares the fireworks for display
+void main()
+{
+    FireworkData.Pos  = vertex;
+    FireworkData.Timer = uv0;
+    FireworkData.Type = uv1;
+    FireworkData.Vel = uv2;
+    // Pos  = vertex;
+    // Timer = uv0;
+    // Type = uv1;
+    // Vel = uv2;
+
+    // FireworkData.Pos = vertex;
+    // FireworkData.Timer = 1;
+    // FireworkData.Type = 8;
+    // FireworkData.Vel = vec3(3, 3, 3);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL150/PassthroughGP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/PassthroughGP.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/PassthroughGP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,18 @@
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+/*
+  Basic pass through geometry shader for GLSL.
+  Assumes triangle input and output.
+*/
+void main()
+{
+    for (int i = 0; i < gl_in.length(); i++)
+    {
+        gl_Position = gl_in[i].gl_Position;
+        EmitVertex();
+    }
+    EndPrimitive();
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/PosterizeFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/PosterizeFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/PosterizeFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,20 +1,20 @@
-#version 150
-
-uniform sampler2D RT;
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main()
-{
-	float nColors = 8.0;
-	float gamma = 0.6;
-
-	vec4 texCol = vec4(texture(RT, oUv0));
-	vec3 tc = texCol.xyz;
-	tc = pow(tc, vec3(gamma));
-	tc = tc * nColors;
-	tc = floor(tc);
-	tc = tc / nColors;
-	tc = pow(tc, vec3(1.0/gamma));
-	fragColour = vec4(tc, texCol.w);
-}
+#version 150
+
+uniform sampler2D RT;
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main()
+{
+    float nColors = 8.0;
+    float gamma = 0.6;
+
+    vec4 texCol = vec4(texture(RT, oUv0));
+    vec3 tc = texCol.xyz;
+    tc = pow(tc, vec3(gamma));
+    tc = tc * nColors;
+    tc = floor(tc);
+    tc = tc / nColors;
+    tc = pow(tc, vec3(1.0 / gamma));
+    fragColour = vec4(tc, texCol.w);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/Radial_Blur_FP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/Radial_Blur_FP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/Radial_Blur_FP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,60 +1,60 @@
-#version 150
-
-//------------------------------------------------------
-//Radial_Blur_FP.glsl
-//  Implements radial blur to be used with the compositor
-//  It's very dependent on screen resolution
-//------------------------------------------------------
-
-uniform sampler2D tex;
-uniform float sampleDist;
-uniform float sampleStrength;
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main()
-{
-	float samples[10];
-	
-	samples[0] = -0.08;
-	samples[1] = -0.05;
-	samples[2] = -0.03;
-	samples[3] = -0.02;
-	samples[4] = -0.01;
-	samples[5] = 0.01;
-	samples[6] = 0.02;
-	samples[7] = 0.03;
-	samples[8] = 0.05;
-	samples[9] = 0.08;
-	
-   //Vector from pixel to the center of the screen
-   vec2 dir = 0.5 - oUv0;
-
-   //Distance from pixel to the center (distant pixels have stronger effect)
-   //float dist = distance( vec2( 0.5, 0.5 ), texCoord );
-   float dist = sqrt( dir.x*dir.x + dir.y*dir.y );
-
-
-   //Now that we have dist, we can normlize vector
-   dir = normalize( dir );
-
-   //Save the color to be used later
-   vec4 color = texture( tex, oUv0 );
-   //Average the pixels going along the vector
-   vec4 sum = color;
-   for (int i = 0; i < 10; i++)
-   {
-      vec4 res=texture( tex, oUv0 + dir * samples[i] * sampleDist );
-      sum += res;
-   }
-   sum /= 11.0;
-
-   //Calculate amount of blur based on
-   //distance and a strength parameter
-   float t = dist * sampleStrength;
-   t = clamp( t, 0.0, 1.0 );//We need 0 <= t <= 1
-
-   //Blend the original color with the averaged pixels
-   fragColour = mix( color, sum, t );
-}
+#version 150
+
+//------------------------------------------------------
+//Radial_Blur_FP.glsl
+//  Implements radial blur to be used with the compositor
+//  It's very dependent on screen resolution
+//------------------------------------------------------
+
+uniform sampler2D tex;
+uniform float sampleDist;
+uniform float sampleStrength;
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main()
+{
+	float samples[10];
+	
+	samples[0] = -0.08;
+	samples[1] = -0.05;
+	samples[2] = -0.03;
+	samples[3] = -0.02;
+	samples[4] = -0.01;
+	samples[5] = 0.01;
+	samples[6] = 0.02;
+	samples[7] = 0.03;
+	samples[8] = 0.05;
+	samples[9] = 0.08;
+	
+   //Vector from pixel to the center of the screen
+   vec2 dir = 0.5 - oUv0;
+
+   //Distance from pixel to the center (distant pixels have stronger effect)
+   //float dist = distance( vec2( 0.5, 0.5 ), texCoord );
+   float dist = sqrt( dir.x*dir.x + dir.y*dir.y );
+
+
+   //Now that we have dist, we can normlize vector
+   dir = normalize( dir );
+
+   //Save the color to be used later
+   vec4 color = texture( tex, oUv0 );
+   //Average the pixels going along the vector
+   vec4 sum = color;
+   for (int i = 0; i < 10; i++)
+   {
+      vec4 res=texture( tex, oUv0 + dir * samples[i] * sampleDist );
+      sum += res;
+   }
+   sum /= 11.0;
+
+   //Calculate amount of blur based on
+   //distance and a strength parameter
+   float t = dist * sampleStrength;
+   t = clamp( t, 0.0, 1.0 );//We need 0 <= t <= 1
+
+   //Blend the original color with the averaged pixels
+   fragColour = mix( color, sum, t );
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/SharpenEdgesFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/SharpenEdgesFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/SharpenEdgesFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,29 +1,29 @@
-#version 150
-
-uniform sampler2D RT;
-uniform vec2 vTexelSize;
-
-in vec2 oUv0;
-in vec2 oUv1;
-out vec4 fragColour;
-
-void main()
-{
-	vec2 usedTexelED[8];
-	usedTexelED[0] = vec2(-1, -1);
-	usedTexelED[1] = vec2(0, -1);
-	usedTexelED[2] = vec2(1, -1);
-	usedTexelED[3] = vec2(-1, 0);
-	usedTexelED[4] = vec2(1, 0);
-	usedTexelED[5] = vec2(-1, 1);
-	usedTexelED[6] = vec2(0, 1);
-	usedTexelED[7] = vec2(1, 1);
-
-    vec4 tc = texture(RT, oUv0);
-	vec4 cAvgColor = vec4(9.0 * tc);
-
-	for(int t=0; t<8; t++)
-		cAvgColor -= texture(RT, oUv0 + vTexelSize * usedTexelED[t]);
-
-	fragColour = cAvgColor;
-}
+#version 150
+
+uniform sampler2D RT;
+uniform vec2 vTexelSize;
+
+in vec2 oUv0;
+in vec2 oUv1;
+out vec4 fragColour;
+
+void main()
+{
+	vec2 usedTexelED[8];
+	usedTexelED[0] = vec2(-1, -1);
+	usedTexelED[1] = vec2(0, -1);
+	usedTexelED[2] = vec2(1, -1);
+	usedTexelED[3] = vec2(-1, 0);
+	usedTexelED[4] = vec2(1, 0);
+	usedTexelED[5] = vec2(-1, 1);
+	usedTexelED[6] = vec2(0, 1);
+	usedTexelED[7] = vec2(1, 1);
+
+    vec4 tc = texture(RT, oUv0);
+	vec4 cAvgColor = vec4(9.0 * tc);
+
+	for(int t=0; t<8; t++)
+		cAvgColor -= texture(RT, oUv0 + vTexelSize * usedTexelED[t]);
+
+	fragColour = cAvgColor;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/StdQuad_vp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/StdQuad_vp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/StdQuad_vp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,15 +1,18 @@
-#version 150
-
-in vec4 vertex;
-in vec2 uv0;
-uniform mat4 worldViewProj;
-
-out vec2 oUv0;
-
-void main()                    
-{
-	gl_Position = worldViewProj * vertex;
-		
-	oUv0 = uv0;
-}
-
+#version 150
+
+in vec4 vertex;
+// in vec2 uv0;
+uniform mat4 worldViewProj;
+
+out vec2 oUv0;
+
+void main()
+{
+    gl_Position = worldViewProj * vertex;
+
+    // oUv0 = uv0;
+
+    vec2 inPos = sign(vertex.xy);
+
+    oUv0 = (vec2(inPos.x, -inPos.y) + 1.0) * 0.5;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/SwizzleGP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/SwizzleGP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/SwizzleGP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,41 +1,29 @@
-#version 150
-
-#extension GL_EXT_geometry_shader4 : enable													
-
-uniform vec4 origColor;																		
-uniform vec4 cloneColor;																	
-
-void main(void)																				
-{																							
-
-	//increment variable																	
-	int i;																					
-
-	/////////////////////////////////////////////////////////////							
-	//This example has two parts															
-	//	step a) draw the primitive pushed down the pipeline									
-	//		 there are gl_Vertices # of vertices											
-	//		 put the vertex value into gl_Position											
-	//		 use EmitVertex => 'create' a new vertex										
-	// 		use EndPrimitive to signal that you are done creating a primitive!				
-	//	step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)	
-	//		I just do the same loop, but swizzle the x and y values							
-	//	result => the line we want to draw, and the same line, but along the other axis		
-
-	//Pass-thru!																			
-	for(i=0; i< gl_VerticesIn; i++){														
-		gl_Position = gl_PositionIn[i];														
-		gl_FrontColor = origColor;															
-		EmitVertex();																		
-	}																						
-	EndPrimitive();																			
-	//New piece of geometry!  We just swizzle the x and y terms								
-	for(i=0; i< gl_VerticesIn; i++){														
-		gl_Position = gl_PositionIn[i];														
-		gl_Position.xy = gl_Position.yx;													
-		gl_FrontColor = cloneColor;															
-		EmitVertex();																		
-	}																						
-	EndPrimitive();																			
-
-}
+#version 150
+
+uniform vec4 origColour;
+uniform vec4 cloneColour;
+
+out vec4 colour;
+
+layout(triangles) in;
+layout(line_strip, max_vertices = 6) out;
+
+void main()
+{
+    // Pass-through!
+    for (int i = 0; i < gl_in.length(); i++){
+        gl_Position = gl_in[i].gl_Position;
+        colour = origColour;
+        EmitVertex();
+    }
+    EndPrimitive();
+
+    // New piece of geometry!  We just swizzle the x and y terms.
+    for (int i = 0; i < gl_in.length(); i++){
+        gl_Position = gl_in[i].gl_Position;
+        gl_Position.xy = gl_Position.yx;
+        colour = cloneColour;
+        EmitVertex();
+    }
+    EndPrimitive();
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/TilingFP.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/TilingFP.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/TilingFP.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,34 +1,34 @@
-#version 150
-
-uniform sampler2D RT;
-uniform float NumTiles;
-uniform float Threshold;
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main()
-{
-	vec3 EdgeColor = vec3(0.7, 0.7, 0.7);
-
-    float size = 1.0/NumTiles;
-    vec2 Pbase = oUv0 - mod(oUv0, vec2(size));
-    vec2 PCenter = vec2(Pbase + (size/2.0));
-    vec2 st = (oUv0 - Pbase)/size;
-    vec4 c1 = vec4(0.0);
-    vec4 c2 = vec4(0.0);
-    vec4 invOff = vec4((1.0-EdgeColor),1.0);
-    if (st.x > st.y) { c1 = invOff; }
-    float threshholdB =  1.0 - Threshold;
-    if (st.x > threshholdB) { c2 = c1; }
-    if (st.y > threshholdB) { c2 = c1; }
-    vec4 cBottom = c2;
-    c1 = vec4(0.0);
-    c2 = vec4(0.0);
-    if (st.x > st.y) { c1 = invOff; }
-    if (st.x < Threshold) { c2 = c1; }
-    if (st.y < Threshold) { c2 = c1; }
-    vec4 cTop = c2;
-    vec4 tileColor = vec4(texture(RT, PCenter));
-    vec4 result = tileColor + cTop - cBottom;
-    fragColour = result;
-}
+#version 150
+
+uniform sampler2D RT;
+uniform float NumTiles;
+uniform float Threshold;
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main()
+{
+	vec3 EdgeColor = vec3(0.7, 0.7, 0.7);
+
+    float size = 1.0/NumTiles;
+    vec2 Pbase = oUv0 - mod(oUv0, vec2(size));
+    vec2 PCenter = vec2(Pbase + (size/2.0));
+    vec2 st = (oUv0 - Pbase)/size;
+    vec4 c1 = vec4(0.0);
+    vec4 c2 = vec4(0.0);
+    vec4 invOff = vec4((1.0-EdgeColor),1.0);
+    if (st.x > st.y) { c1 = invOff; }
+    float threshholdB =  1.0 - Threshold;
+    if (st.x > threshholdB) { c2 = c1; }
+    if (st.y > threshholdB) { c2 = c1; }
+    vec4 cBottom = c2;
+    c1 = vec4(0.0);
+    c2 = vec4(0.0);
+    if (st.x > st.y) { c1 = invOff; }
+    if (st.x < Threshold) { c2 = c1; }
+    if (st.y < Threshold) { c2 = c1; }
+    vec4 cTop = c2;
+    vec4 tileColor = vec4(texture(RT, PCenter));
+    vec4 result = tileColor + cTop - cBottom;
+    fragColour = result;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_bloom.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/hdr_bloom.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/hdr_bloom.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,24 +1,24 @@
-#version 150
-
-uniform sampler2D inRTT;
-
-uniform vec4 sampleOffsets[15];
-uniform vec4 sampleWeights[15];
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main(void)
-{
-    vec4 accum = vec4(0.0, 0.0, 0.0, 1.0);
-	vec2 sampleUV;
-
-    for( int i = 0; i < 15; i++ )
-    {
-        // Sample from adjacent points, 7 each side and central
-        sampleUV = oUv0 + sampleOffsets[i].xy;
-        accum += sampleWeights[i] * texture(inRTT, sampleUV);
-    }
-
-    fragColour = accum;
-}
+#version 150
+
+uniform sampler2D inRTT;
+
+uniform vec4 sampleOffsets[15];
+uniform vec4 sampleWeights[15];
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 1.0);
+	vec2 sampleUV;
+
+    for( int i = 0; i < 15; i++ )
+    {
+        // Sample from adjacent points, 7 each side and central
+        sampleUV = oUv0 + sampleOffsets[i].xy;
+        accum += sampleWeights[i] * texture(inRTT, sampleUV);
+    }
+
+    fragColour = accum;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale2x2luminence.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale2x2luminence.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale2x2luminence.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,27 +1,27 @@
-#version 150
-
-uniform sampler2D inRTT;
-uniform vec2 texelSize;
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main(void)
-{
-	
-    vec4 accum = vec4(0.0);
-	vec4 LUMINENCE_FACTOR = vec4(0.27, 0.67, 0.06, 0.0);
-
-    // Get colour from source
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-0.5, -0.5));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-0.5, 0.5));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(0.5, 0.5));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(0.5, -0.5));
-
-	// Adjust the accumulated amount by lum factor
-	float lum = dot(accum, LUMINENCE_FACTOR);
-
-	// Take average of 4 samples
-	lum *= 0.25;
-	fragColour = vec4(lum, lum, lum, 1.0);
-}
+#version 150
+
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main(void)
+{
+	
+    vec4 accum = vec4(0.0);
+	vec4 LUMINENCE_FACTOR = vec4(0.27, 0.67, 0.06, 0.0);
+
+    // Get colour from source
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-0.5, -0.5));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-0.5, 0.5));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(0.5, 0.5));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(0.5, -0.5));
+
+	// Adjust the accumulated amount by lum factor
+	float lum = dot(accum, LUMINENCE_FACTOR);
+
+	// Take average of 4 samples
+	lum *= 0.25;
+	fragColour = vec4(lum, lum, lum, 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,28 +1,28 @@
-#version 150
-
-uniform sampler2D inRTT;
-uniform vec2 texelSize;
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-void main(void)
-{
-    vec4 accum = vec4(0.0);
-
-    // Get colour from source
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  1.0));
-    
-	// take average of 9 samples
-	accum *= 0.1111111111111111;
-
-	fragColour = accum;
-}
+#version 150
+
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0);
+
+    // Get colour from source
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+	fragColour = accum;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3brightpass.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3brightpass.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/hdr_downscale3x3brightpass.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,39 +1,39 @@
-#version 150
-
-uniform sampler2D inRTT;
-uniform sampler2D inLum;
-uniform vec2 texelSize;
-
-in vec2 oUv0;
-out vec4 fragColour;
-const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
-
-// declare external function
-vec4 toneMap(in vec4 inColour, in float lum);
-
-void main(void)
-{
-    vec4 accum = vec4(0.0);
-
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  0.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  1.0));
-    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  1.0));
-    
-	// take average of 9 samples
-	accum *= 0.1111111111111111;
-
-    // Reduce bright and clamp
-    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
-
-	// Sample the luminence texture
-	vec4 lum = texture(inLum, vec2(0.5));
-	
-	// Tone map result
-	fragColour = toneMap(accum, lum.r);
-}
+#version 150
+
+uniform sampler2D inRTT;
+uniform sampler2D inLum;
+uniform vec2 texelSize;
+
+in vec2 oUv0;
+out vec4 fragColour;
+const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
+
+// declare external function
+vec4 toneMap(in vec4 inColour, in float lum);
+
+void main(void)
+{
+    vec4 accum = vec4(0.0);
+
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  0.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  1.0));
+    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+    // Reduce bright and clamp
+    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
+
+	// Sample the luminence texture
+	vec4 lum = texture(inLum, vec2(0.5));
+	
+	// Tone map result
+	fragColour = toneMap(accum, lum.r);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_finalToneMapping.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/hdr_finalToneMapping.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/hdr_finalToneMapping.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,29 +1,29 @@
-#version 150
-
-uniform sampler2D inRTT;
-uniform sampler2D inBloom;
-uniform sampler2D inLum;
-
-in vec2 oUv0;
-out vec4 fragColour;
-
-// declare external function
-vec4 toneMap(in vec4 inColour, in float lum);
-
-void main(void)
-{
-	// Get main scene colour
-    vec4 sceneCol = texture(inRTT, oUv0);
-
-	// Get luminence value
-	vec4 lum = texture(inLum, vec2(0.5));
-
-	// tone map this
-	vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r);
-	
-	// Get bloom colour
-    vec4 bloom = texture(inBloom, oUv0);
-
-	// Add scene & bloom
-	fragColour = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0);
-}
+#version 150
+
+uniform sampler2D inRTT;
+uniform sampler2D inBloom;
+uniform sampler2D inLum;
+
+in vec2 oUv0;
+out vec4 fragColour;
+
+// declare external function
+vec4 toneMap(in vec4 inColour, in float lum);
+
+void main(void)
+{
+	// Get main scene colour
+    vec4 sceneCol = texture(inRTT, oUv0);
+
+	// Get luminence value
+	vec4 lum = texture(inLum, vec2(0.5));
+
+	// tone map this
+	vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r);
+	
+	// Get bloom colour
+    vec4 bloom = texture(inBloom, oUv0);
+
+	// Add scene & bloom
+	fragColour = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/instancingVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/instancingVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/instancingVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,46 +1,46 @@
-#version 150
-
-in vec4 position;
-in vec3 normal;
-in vec4 uv0;
-in float uv1;
-
-out vec4 oColor_0;
-#if SHADOW_CASTER
-#else
-out vec2 oTexcoord2_0;
-#endif
-
-uniform mat4x3 worldMatrix3x4Array[80];
-uniform mat4 viewProjectionMatrix;
-uniform vec4 lightPos;
-uniform vec4 ambient;
-uniform vec4 lightDiffuseColour;
-
-void main()
-{
-#if SHADOW_CASTER
-	// transform by indexed matrix
-	vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
-
-	// view / projection
-	gl_Position = viewProjectionMatrix * transformedPos;
-	
-	oColor_0 = ambient;
-#else
-	// transform by indexed matrix
-	vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
-	
-	// view / projection
-	gl_Position = viewProjectionMatrix * transformedPos;
-	oTexcoord2_0 = uv0.xy;
-
-	vec3 norm = mat3(worldMatrix3x4Array[int(uv1)]) * normal;
-	
-	vec3 lightDir = 	normalize(
-		lightPos.xyz -  (transformedPos.xyz * lightPos.w));
-
-	oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour;
-#endif
-}
-
+#version 150
+
+in vec4 position;
+in vec3 normal;
+in vec4 uv0;
+in float uv1;
+
+out vec4 oColor_0;
+#if SHADOW_CASTER
+#else
+out vec2 oTexcoord2_0;
+#endif
+
+uniform mat4x3 worldMatrix3x4Array[80];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 lightPos;
+uniform vec4 ambient;
+uniform vec4 lightDiffuseColour;
+
+void main()
+{
+#if SHADOW_CASTER
+	// transform by indexed matrix
+	vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
+
+	// view / projection
+	gl_Position = viewProjectionMatrix * transformedPos;
+	
+	oColor_0 = ambient;
+#else
+	// transform by indexed matrix
+	vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
+	
+	// view / projection
+	gl_Position = viewProjectionMatrix * transformedPos;
+	oTexcoord2_0 = uv0.xy;
+
+	vec3 norm = mat3(worldMatrix3x4Array[int(uv1)]) * normal;
+	
+	vec3 lightDir = 	normalize(
+		lightPos.xyz -  (transformedPos.xyz * lightPos.w));
+
+	oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour;
+#endif
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_quad.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_quad.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_quad.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,20 +1,20 @@
-#version 150
-
-uniform sampler2D rt0;
-uniform sampler2D rt1;
-uniform sampler2D rt2;
-uniform sampler2D rt3;
-
-in vec2 uv;
-out vec4 fragColour;
-
-void main(void)
-{
-    
-    //fragColour = texture(rt0, uv);
-    fragColour = texture(rt1, uv);
-    //fragColour = texture(rt2, uv);
-    //fragColour = texture(rt3, uv);
-	
-}
-
+#version 150
+
+uniform sampler2D rt0;
+uniform sampler2D rt1;
+uniform sampler2D rt2;
+uniform sampler2D rt3;
+
+in vec2 uv;
+out vec4 fragColour;
+
+void main(void)
+{
+    
+    //fragColour = texture(rt0, uv);
+    fragColour = texture(rt1, uv);
+    //fragColour = texture(rt2, uv);
+    //fragColour = texture(rt3, uv);
+	
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_scene.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_scene.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/mrttestfp_scene.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,22 +1,22 @@
-#version 150
-
-// Need to enable the draw buffers extension
-#extension GL_ARB_draw_buffers : enable
-
-uniform sampler2D tex0;
-
-void main()                    
-{
-	vec4 baseColour = texture(tex0, gl_TexCoord[0].xy);
-
-	gl_FragData[0] = baseColour;
-
-	gl_FragData[1] = baseColour * vec4(1, 0, 0, 1);
-
-	float abs = (baseColour.r + baseColour.g + baseColour.b) * 0.333;
-	gl_FragData[2] = vec4(abs, abs, abs, 1);
-	
-	float invabs = 1.0 - abs;
-	gl_FragData[3] = vec4(invabs, invabs, invabs, 1);
-}
-
+#version 130
+
+// Need to enable the draw buffers extension
+#extension GL_ARB_draw_buffers : enable
+
+uniform sampler2D tex0;
+
+void main()                    
+{
+	vec4 baseColour = texture(tex0, gl_TexCoord[0].xy);
+
+	gl_FragData[0] = baseColour;
+
+	gl_FragData[1] = baseColour * vec4(1, 0, 0, 1);
+
+	float abs = (baseColour.r + baseColour.g + baseColour.b) * 0.333;
+	gl_FragData[2] = vec4(abs, abs, abs, 1);
+	
+	float invabs = 1.0 - abs;
+	gl_FragData[3] = vec4(invabs, invabs, invabs, 1);
+}
+

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,11 +1,11 @@
-#version 150
-
-in vec2 oDepth;
-out vec4 fragColour;
-uniform vec4 pssmSplitPoints;
-
-void main()
-{
-	float finalDepth = oDepth.x / oDepth.y;
-	fragColour = vec4(finalDepth, finalDepth, finalDepth, 1.0);
-}
+#version 150
+
+in vec2 oDepth;
+out vec4 fragColour;
+uniform vec4 pssmSplitPoints;
+
+void main()
+{
+	float finalDepth = oDepth.x / oDepth.y;
+	fragColour = vec4(finalDepth, finalDepth, finalDepth, 1.0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/pssmCasterVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,18 +1,18 @@
-#version 150
-
-out vec2 oDepth;
-uniform mat4 worldViewProjMatrix;
-in vec4 vertex;
-
-void main()
-{
-	// This is the view space position
-	gl_Position = worldViewProjMatrix * vertex;
-
-	// Depth info for the fragment.
-	oDepth.x = gl_Position.z;
-	oDepth.y = gl_Position.w;
-
-	// Clamp z to zero. seem to do the trick. :-/
-	//oPosition.z = max(oPosition.z, 0);
-}
+#version 150
+
+out vec2 oDepth;
+uniform mat4 worldViewProjMatrix;
+in vec4 vertex;
+
+void main()
+{
+	// This is the view space position
+	gl_Position = worldViewProjMatrix * vertex;
+
+	// Depth info for the fragment.
+	oDepth.x = gl_Position.z;
+	oDepth.y = gl_Position.w;
+
+	// Clamp z to zero. seem to do the trick. :-/
+	//oPosition.z = max(oPosition.z, 0);
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverFp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,90 +1,90 @@
-#version 150
-
-float shadowPCF(sampler2D shadowMap, vec4 shadowMapPos, vec2 offset)
-{
-	shadowMapPos = shadowMapPos / shadowMapPos.w;
-	vec2 uv = shadowMapPos.xy;
-	vec3 o = vec3(offset, -offset.x) * 0.3;
-
-	// Note: We using 2x2 PCF. Good enough and is a lot faster.
-	float c =	(shadowMapPos.z <= texture(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
-	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
-	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
-	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
-
-	return c / 4.0;
-}
-
-uniform vec4 invShadowMapSize0;
-uniform vec4 invShadowMapSize1;
-uniform vec4 invShadowMapSize2;
-uniform vec4 pssmSplitPoints;
-uniform sampler2D diffuse;
-uniform sampler2D specular;
-uniform sampler2D normalMap;
-uniform sampler2D shadowMap0;
-uniform sampler2D shadowMap1;
-uniform sampler2D shadowMap2;
-uniform vec4 lightDiffuse;
-uniform vec4 lightSpecular;
-uniform vec4 ambient;
-
-in vec4 oUv0;
-in vec3 oLightDir;
-in vec3 oHalfAngle;
-in vec4 oLightPosition0;
-in vec4 oLightPosition1;
-in vec4 oLightPosition2;
-in vec3 oNormal;
-out vec4 fragColour;
-
-// to put it simply, this does 100% per pixel diffuse lighting
-void main()
-{
-	// calculate shadow
-	float shadowing = 1.0;
-	vec4 splitColour;
-	if (oUv0.z <= pssmSplitPoints.y)
-	{
-		splitColour = vec4(0.1, 0.0, 0.0, 1.0);
-		shadowing = shadowPCF(shadowMap0, oLightPosition0, invShadowMapSize0.xy);
-	}
-	else if (oUv0.z <= pssmSplitPoints.z)
-	{
-		splitColour = vec4(0.0, 0.1, 0.0, 1.0);
-		shadowing = shadowPCF(shadowMap1, oLightPosition1, invShadowMapSize1.xy);
-	}
-	else
-	{
-		splitColour = vec4(0.1, 0.1, 0.0, 1.0);
-		shadowing = shadowPCF(shadowMap2, oLightPosition2, invShadowMapSize2.xy);
-	}
-
-	// retrieve normalised light vector, expand from range-compressed
-	vec3 lightVec = normalize(oLightDir);
-
-	// retrieve half angle and normalise through cube map
-	vec3 halfAngle = normalize(oHalfAngle);
-
-	// get diffuse colour
-	vec4 diffuseColour = texture(diffuse, oUv0.xy);
-
-	// specular
-	vec4 specularColour = texture(specular, oUv0.xy);
-	float shininess = specularColour.w;
-	specularColour.w = 1.0;
-
-	// calculate lit value.
-	float diffuseCoeff = max(dot(oNormal, lightVec), 0.0);
-	float specularCoeff = step(0.0, dot(oNormal, lightVec)) * max(dot(oNormal, halfAngle) * (shininess * 128.0), 0.0);
-	vec4 lighting;
-	lighting.y = diffuseCoeff * shadowing;
-	lighting.z = specularCoeff * shadowing;
-//	vec4 lighting = lit(dot(oNormal, lightVec), dot(oNormal, halfAngle), shininess * 128.0) * shadowing;
-
-	// final lighting with diffuse and spec
-	fragColour = (diffuseColour * clamp(ambient + lightDiffuse * lighting.y, 0.0, 1.0)) + (lightSpecular * specularColour * lighting.z);
-	fragColour.w = diffuseColour.w;
-
-	//oColour += splitColour;
-}
+#version 150
+
+float shadowPCF(sampler2D shadowMap, vec4 shadowMapPos, vec2 offset)
+{
+	shadowMapPos = shadowMapPos / shadowMapPos.w;
+	vec2 uv = shadowMapPos.xy;
+	vec3 o = vec3(offset, -offset.x) * 0.3;
+
+	// Note: We using 2x2 PCF. Good enough and is a lot faster.
+	float c =	(shadowMapPos.z <= texture(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
+	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
+	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
+	c +=		(shadowMapPos.z <= texture(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
+
+	return c / 4.0;
+}
+
+uniform vec4 invShadowMapSize0;
+uniform vec4 invShadowMapSize1;
+uniform vec4 invShadowMapSize2;
+uniform vec4 pssmSplitPoints;
+uniform sampler2D diffuse;
+uniform sampler2D specular;
+uniform sampler2D normalMap;
+uniform sampler2D shadowMap0;
+uniform sampler2D shadowMap1;
+uniform sampler2D shadowMap2;
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform vec4 ambient;
+
+in vec4 oUv0;
+in vec3 oLightDir;
+in vec3 oHalfAngle;
+in vec4 oLightPosition0;
+in vec4 oLightPosition1;
+in vec4 oLightPosition2;
+in vec3 oNormal;
+out vec4 fragColour;
+
+// to put it simply, this does 100% per pixel diffuse lighting
+void main()
+{
+	// calculate shadow
+	float shadowing = 1.0;
+	vec4 splitColour;
+	if (oUv0.z <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.1, 0.0, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap0, oLightPosition0, invShadowMapSize0.xy);
+	}
+	else if (oUv0.z <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0.0, 0.1, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap1, oLightPosition1, invShadowMapSize1.xy);
+	}
+	else
+	{
+		splitColour = vec4(0.1, 0.1, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap2, oLightPosition2, invShadowMapSize2.xy);
+	}
+
+	// retrieve normalised light vector, expand from range-compressed
+	vec3 lightVec = normalize(oLightDir);
+
+	// retrieve half angle and normalise through cube map
+	vec3 halfAngle = normalize(oHalfAngle);
+
+	// get diffuse colour
+	vec4 diffuseColour = texture(diffuse, oUv0.xy);
+
+	// specular
+	vec4 specularColour = texture(specular, oUv0.xy);
+	float shininess = specularColour.w;
+	specularColour.w = 1.0;
+
+	// calculate lit value.
+	float diffuseCoeff = max(dot(oNormal, lightVec), 0.0);
+	float specularCoeff = step(0.0, dot(oNormal, lightVec)) * max(dot(oNormal, halfAngle) * (shininess * 128.0), 0.0);
+	vec4 lighting;
+	lighting.y = diffuseCoeff * shadowing;
+	lighting.z = specularCoeff * shadowing;
+//	vec4 lighting = lit(dot(oNormal, lightVec), dot(oNormal, halfAngle), shininess * 128.0) * shadowing;
+
+	// final lighting with diffuse and spec
+	fragColour = (diffuseColour * clamp(ambient + lightDiffuse * lighting.y, 0.0, 1.0)) + (lightSpecular * specularColour * lighting.z);
+	fragColour.w = diffuseColour.w;
+
+	//oColour += splitColour;
+}

Modified: data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverVp.glsl	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/programs/Example/GLSL150/pssmReceiverVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -1,45 +1,45 @@
-#version 150
-
-uniform vec4 lightPosition;				// object space
-uniform vec3 eyePosition;					// object space
-uniform mat4 worldViewProjMatrix;
-uniform mat4 texWorldViewProjMatrix0;
-uniform mat4 texWorldViewProjMatrix1;
-uniform mat4 texWorldViewProjMatrix2;
-
-out vec4 oUv0;
-out vec3 oLightDir;
-out vec3 oHalfAngle;
-out vec4 oLightPosition0;
-out vec4 oLightPosition1;
-out vec4 oLightPosition2;
-out vec3 oNormal;
-
-in vec4 position;
-in vec3 normal;
-in vec4 uv0;
-
-void main()
-{
-	// Calculate output position
-	gl_Position = worldViewProjMatrix * position;
-
-	// Pass the main uvs straight through unchanged
-	oUv0.xy = uv0.xy;
-	oUv0.z = gl_Position.z;
-
-	// Calculate tangent space light vector
-	// Get object space light direction
-	oLightDir = normalize(lightPosition.xyz - (position * lightPosition.w).xyz);
-
-	// Calculate half-angle in tangent space
-	vec3 eyeDir = normalize(eyePosition - position.xyz);
-	oHalfAngle = normalize(eyeDir + oLightDir);	
-
-	// Calculate the position of vertex in light space
-	oLightPosition0 = texWorldViewProjMatrix0 * position;
-	oLightPosition1 = texWorldViewProjMatrix1 * position;
-	oLightPosition2 = texWorldViewProjMatrix2 * position;
-
-	oNormal = normal;
-}
+#version 150
+
+uniform vec4 lightPosition;				// object space
+uniform vec3 eyePosition;					// object space
+uniform mat4 worldViewProjMatrix;
+uniform mat4 texWorldViewProjMatrix0;
+uniform mat4 texWorldViewProjMatrix1;
+uniform mat4 texWorldViewProjMatrix2;
+
+out vec4 oUv0;
+out vec3 oLightDir;
+out vec3 oHalfAngle;
+out vec4 oLightPosition0;
+out vec4 oLightPosition1;
+out vec4 oLightPosition2;
+out vec3 oNormal;
+
+in vec4 position;
+in vec3 normal;
+in vec4 uv0;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProjMatrix * position;
+
+	// Pass the main uvs straight through unchanged
+	oUv0.xy = uv0.xy;
+	oUv0.z = gl_Position.z;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	oLightDir = normalize(lightPosition.xyz - (position * lightPosition.w).xyz);
+
+	// Calculate half-angle in tangent space
+	vec3 eyeDir = normalize(eyePosition - position.xyz);
+	oHalfAngle = normalize(eyeDir + oLightDir);	
+
+	// Calculate the position of vertex in light space
+	oLightPosition0 = texWorldViewProjMatrix0 * position;
+	oLightPosition1 = texWorldViewProjMatrix1 * position;
+	oLightPosition2 = texWorldViewProjMatrix2 * position;
+
+	oNormal = normal;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL400/ComputeCS.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/ComputeCS.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/ComputeCS.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 430
+
+layout(binding = 0, rgba8) coherent uniform image2D image_data;
+
+uniform float roll;
+
+layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
+
+// source/ details: http://wili.cc/blog/opengl-cs.html
+void main()
+{
+    ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);
+
+    float localCoef = length(vec2(ivec2(gl_LocalInvocationID.xy)-8)/8.0);
+    float globalCoef = sin(float(gl_WorkGroupID.x+gl_WorkGroupID.y)*0.1 + roll)*0.5;
+    imageStore(image_data, storePos, vec4(vec2(1.0-globalCoef*localCoef),1.0,1.0));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL400/RasterizationOrderFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/RasterizationOrderFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/RasterizationOrderFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,19 @@
+#version 400
+
+#extension GL_ARB_shader_atomic_counters : enable
+
+layout(binding=0, offset=0) uniform atomic_uint ac;
+
+out vec4 fragColour;
+
+void main(void)
+{
+    uint counter = atomicCounterIncrement(ac);
+    uint mask = (1 << 8) - 1;
+    // fragColour = vec4(
+    //     ((counter & (mask <<  0)) % 255) / 255.f,
+    //     ((counter & (mask <<  8)) % 255) / 255.f,
+    //     ((counter & (mask << 16)) % 255) / 5.f,
+    //     0.5);
+    fragColour = vec4(counter/uint(4E9),0,0,0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL400/TessellationFp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/TessellationFp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/TessellationFp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,9 @@
+#version 400 core
+
+out vec4 fragColour;
+
+// Fragment shader section.
+void main()
+{
+    fragColour = vec4(1, 1, 1, 1);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTd.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTd.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTd.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 400 core
+
+uniform mat4 g_mWorldViewProjection;
+
+// GLSL tessellation evaluation shader (domain shader in HLSL).
+layout(triangles, equal_spacing, cw) in;
+void main()
+{
+    // Baricentric interpolation
+    vec3 finalPos = vec3(gl_TessCoord.x * gl_in[0].gl_Position + 
+                         gl_TessCoord.y * gl_in[1].gl_Position + 
+                         gl_TessCoord.z * gl_in[2].gl_Position);
+    gl_Position = g_mWorldViewProjection * vec4(finalPos, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTh.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTh.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/TessellationTh.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 400 core
+
+uniform float g_fTessellationFactor;
+
+// GLSL tessellation control shader.
+layout (vertices = 3) out;
+void main()
+{
+    gl_TessLevelOuter[0] = gl_TessLevelOuter[1] = gl_TessLevelOuter[2] = g_fTessellationFactor;
+    gl_TessLevelInner[0] = g_fTessellationFactor;
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSL400/TessellationVp.glsl
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSL400/TessellationVp.glsl	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSL400/TessellationVp.glsl	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,9 @@
+#version 400 core
+
+in vec4 vertex;
+
+// Just a pass-through vertex shader.
+void main()
+{
+    gl_Position = vertex;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ASCIIFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ASCIIFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ASCIIFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,40 @@
+#version 300 es
+
+precision mediump int;
+precision mediump float;
+
+in vec4 pos;
+in vec2 oUv0;
+out vec4 fragColour;
+
+uniform sampler2D RT;
+uniform lowp sampler3D chars;
+uniform vec2 numTiles;
+uniform vec2 iNumTiles;
+uniform vec2 iNumTiles2;
+uniform vec4 lum;
+uniform float charBias;
+
+void main()
+{
+    vec3 local;
+
+	//sample RT
+	local.xy = mod(oUv0, iNumTiles);
+	vec2 middle = oUv0 - local.xy;
+	local.xy = local.xy * numTiles;
+	
+	//iNumTiles2 = iNumTiles / 2
+	middle = middle + iNumTiles2;
+	vec4 c = texture(RT, middle);
+	
+	//multiply luminance by charbias , beacause not all slices of the ascii
+	//volume texture are used
+	local.z = dot(c , lum)*charBias;
+	
+	//fix to brighten the dark pixels with small characters
+	//c *= lerp(2.0,1.0, local.z);
+	
+	c *= texture(chars, local);
+	fragColour = c;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTexture.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTexture.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTexture.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,20 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 ambient;
+uniform mat4 worldViewProj;
+
+attribute vec4 position;
+
+varying vec4 colour;
+
+/*
+  Basic ambient lighting vertex program for GLSL ES
+*/
+void main()
+{
+	gl_Position = worldViewProj * position;
+	colour = ambient;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTextureWithUV.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTextureWithUV.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/AmbientOneTextureWithUV.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,23 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 ambient;
+uniform mat4 worldViewProj;
+
+attribute vec4 position;
+attribute vec4 uv0;
+
+varying vec4 colour;
+varying vec4 ambientUV;
+
+/*
+  Basic ambient lighting vertex program for GLSL ES
+*/
+void main()
+{
+	gl_Position = worldViewProj * position;
+	colour = ambient;
+	ambientUV = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Bloom2_ps20.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Bloom2_ps20.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Bloom2_ps20.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,30 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+//-------------------------------
+// Bloom_ps20.glsles
+// Blends using weights the blurred image with the sharp one
+// Params:
+//   OriginalImageWeight
+//   BlurWeight
+//-------------------------------
+
+uniform sampler2D RT;
+uniform sampler2D Blur1;
+
+uniform float OriginalImageWeight;
+uniform float BlurWeight;
+varying vec2 texCoord;
+
+void main()
+{
+    vec4 sharp;
+    vec4 blur;
+
+    sharp = texture2D( RT, texCoord);
+    blur = texture2D( Blur1, texCoord);
+    
+    gl_FragColor = ( (blur * BlurWeight) + (sharp * OriginalImageWeight) );
+    //gl_FragColor = vec4(0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/BlurH_ps20.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/BlurH_ps20.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/BlurH_ps20.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,58 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+//-------------------------------
+//BlurH_ps20.glsles
+// Horizontal Gaussian-Blur pass
+//-------------------------------
+
+uniform sampler2D Blur0;
+varying vec2 texCoord;
+
+vec2 pos[11];
+//We use the Normal-gauss distribution formula
+//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+float samples[11];
+
+void main()
+{
+	pos[0] = vec2(-5.0, 0.0);
+	pos[1] = vec2(-4.0, 0.0);
+	pos[2] = vec2(-3.0, 0.0);
+	pos[3] = vec2(-2.0, 0.0);
+	pos[4] = vec2(-1.0, 0.0);
+	pos[5] = vec2(0.0, 0.0);
+	pos[6] = vec2(1.0, 0.0);
+	pos[7] = vec2(2.0, 0.0);
+	pos[8] = vec2(3.0, 0.0);
+	pos[9] = vec2(4.0, 0.0);
+	pos[10] = vec2(5.0, 0.0);
+
+	//We use the Normal-gauss distribution formula
+	//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+	//stddev=2.0
+	samples[0] = 0.01222447;
+	samples[1] = 0.02783468;
+	samples[2] = 0.06559061;
+	samples[3] = 0.12097757;
+	samples[4] = 0.17466632;
+	samples[5] = 0.19741265;
+	samples[6] = 0.17466632;
+	samples[7] = 0.12097757;
+	samples[8] = 0.06559061;
+	samples[9] = 0.02783468;
+	samples[10] = 0.01222447;
+	
+    vec4 retVal;
+    vec4 sum;
+    int i = 0;
+
+    sum = vec4( 0 );
+    for( i = 0;i < 11; i++ )
+    {
+        sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i];
+    }
+
+    gl_FragColor = sum;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/BlurV_ps20.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/BlurV_ps20.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/BlurV_ps20.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,63 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+// Note, this won't work on ATI which is why it's not used
+// the issue is with the array initializers
+// no card supports GL_3DL_array_objects but it does work on nvidia, not on ATI
+//#extension GL_3DL_array_objects : enable
+
+//-------------------------------
+//BlurV_ps20.glsles
+// Vertical Gaussian-Blur pass
+//-------------------------------
+
+uniform sampler2D Blur0;
+varying vec2 texCoord;
+
+vec2 pos[11];
+//We use the Normal-gauss distribution formula
+//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+float samples[11];
+
+void main()
+{
+	pos[0] = vec2(0.0, -5.0);
+	pos[1] = vec2(0.0, -4.0);
+	pos[2] = vec2(0.0, -3.0);
+	pos[3] = vec2(0.0, -2.0);
+	pos[4] = vec2(0.0, -1.0);
+	pos[5] = vec2(0.0, 0.0);
+	pos[6] = vec2(0.0, 1.0);
+	pos[7] = vec2(0.0, 2.0);
+	pos[8] = vec2(0.0, 3.0);
+	pos[9] = vec2(0.0, 4.0);
+	pos[10] = vec2(0.0, 5.0);
+
+	//We use the Normal-gauss distribution formula
+	//f(x) being the formula, we used f(0.5)-f(-0.5); f(1.5)-f(0.5)...
+	//stddev=2.0
+	samples[0] = 0.01222447;
+	samples[1] = 0.02783468;
+	samples[2] = 0.06559061;
+	samples[3] = 0.12097757;
+	samples[4] = 0.17466632;
+	samples[5] = 0.19741265;
+	samples[6] = 0.17466632;
+	samples[7] = 0.12097757;
+	samples[8] = 0.06559061;
+	samples[9] = 0.02783468;
+	samples[10] = 0.01222447;
+
+    vec4 retVal;
+    vec4 sum;
+    int i = 0;
+
+    sum = vec4( 0 );
+    for( ;i < 11; i++ )
+    {
+        sum += texture2D( Blur0, texCoord + (pos[i] * 0.0100000) ) * samples[i];
+    }
+
+    gl_FragColor = sum;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Blur_vs.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Blur_vs.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Blur_vs.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,16 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 texCoord;
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec2 uv0;
+
+void main()                    
+{
+	gl_Position = worldViewProj * vertex;
+	texCoord = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/BrightBloom2_ps20.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/BrightBloom2_ps20.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/BrightBloom2_ps20.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,32 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+//-------------------------------
+//BrightBloom_ps20.glsles
+// High-pass filter for obtaining luminance
+// We use an approximation formula that is pretty fast:
+//   f(x) = ( -3 * ( x - 1 )^2 + 1 ) * 2
+//   Color += Grayscale( f(Color) ) + 0.6
+//
+// Special thanks to ATI for their great HLSL2GLSL utility
+//     http://sourceforge.net/projects/hlsl2glsl
+//-------------------------------
+
+uniform sampler2D RT;
+varying vec2 oUv0;
+
+void main()
+{
+    vec4 tex;
+    vec4 bright4;
+    float bright;
+
+    tex = texture2D(RT, oUv0);
+    tex -= 1.00000;
+    bright4 = -6.00000 * tex * tex + 2.00000;
+    bright = dot( bright4, vec4( 0.333333, 0.333333, 0.333333, 0.000000) );
+    tex += (bright + 0.600000);
+
+    gl_FragColor = tex;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/BumpMapVPTangentParity.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/BumpMapVPTangentParity.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/BumpMapVPTangentParity.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+/* Bump mapping vertex program
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect. 
+*/
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec4 tangent;
+attribute vec2 uv0;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// Pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	// Non-normalised since we'll do that in the fragment program anyway
+	vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+
+	// Fixed handedness
+	vec3 binormal = cross(normal, tangent.xyz) * tangent.www;
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,11 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 NDotV;
+
+void main()
+{
+   gl_FragColor = vec4(NDotV.x / 2.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ColdCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,18 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+uniform vec3 eyePosition;
+attribute vec4 position;
+attribute vec4 normal;
+varying vec2 NDotV;
+
+void main()
+{
+   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
+   eyeDir = normalize(eyeDir);
+   gl_Position = worldViewProj * position;
+   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Combine_fp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Combine_fp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Combine_fp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+uniform sampler2D Sum;
+uniform float blur;
+
+varying vec2 uv0;
+
+void main()
+{
+   vec4 render = texture2D(RT, uv0);
+   vec4 sum = texture2D(Sum, uv0);
+
+   gl_FragColor = mix(render, sum, blur);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DOF_ps.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DOF_ps.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DOF_ps.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,94 @@
+// Simple blur filter
+
+const float2 samples[8] = {
+    {-1, 1},
+    {-1, 0},
+    {-1, -1},
+    {0, -1},
+    {1, -1},
+    {1, 0},
+    {1, 1},
+    {0, 1}
+};
+
+float4 blur(
+
+    in float2 texCoord: TEXCOORD0,
+    uniform float sampleDistance: register(c0),
+    uniform sampler Blur0: register(s0)
+
+) : COLOR
+{
+   float4 sum = tex2D(Blur0, texCoord);
+   for (int i = 0; i < 8; ++i){
+      sum += tex2D(Blur0, texCoord + sampleDistance * samples[i]);
+   }
+   return sum / 9;
+}
+
+
+
+float4 blend
+(
+    in float2 texCoord: TEXCOORD0,
+
+    uniform sampler Blur0 : register(s0),
+    uniform sampler Blur1 : register(s1),
+
+    uniform float focus: register(c0),
+    uniform float range: register(c1)
+) : COLOR
+{
+   float4 sharp = tex2D(Blur0, texCoord);
+   float4 blur  = tex2D(Blur1, texCoord);
+
+   // alpha channel of sharp RT has depth info
+   return mix(sharp, blur, saturate(range * abs(focus - sharp.a)));
+}
+// Simple blur filter
+
+const float2 samples[8] = {
+    {-1, 1},
+    {-1, 0},
+    {-1, -1},
+    {0, -1},
+    {1, -1},
+    {1, 0},
+    {1, 1},
+    {0, 1}
+};
+
+float4 blur(
+
+    in float2 texCoord: TEXCOORD0,
+    uniform float sampleDistance: register(c0),
+    uniform sampler Blur0: register(s0)
+
+) : COLOR
+{
+   float4 sum = tex2D(Blur0, texCoord);
+   for (int i = 0; i < 8; ++i){
+      sum += tex2D(Blur0, texCoord + sampleDistance * samples[i]);
+   }
+   return sum / 9;
+}
+
+
+
+float4 blend
+(
+    in float2 texCoord: TEXCOORD0,
+
+    uniform sampler Blur0 : register(s0),
+    uniform sampler Blur1 : register(s1),
+
+    uniform float focus: register(c0),
+    uniform float range: register(c1)
+) : COLOR
+{
+   float4 sharp = tex2D(Blur0, texCoord);
+   float4 blur  = tex2D(Blur1, texCoord);
+
+   // alpha channel of sharp RT has depth info
+   return mix(sharp, blur, saturate(range * abs(focus - sharp.a)));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,18 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+varying vec2 depth;
+
+void main()
+{
+#if LINEAR_RANGE
+	float finalDepth = depth.x;
+#else
+	float finalDepth = depth.x / depth.y;
+#endif
+	// just smear across all components 
+	// therefore this one needs high individual channel precision
+    gl_FragColor.r = finalDepth;// = vec4(finalDepth, finalDepth, finalDepth, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,27 @@
+#version 100
+precision highp int;
+precision highp float;
+
+uniform mat4 worldViewProj;
+uniform vec4 texelOffsets;
+uniform vec4 depthRange;
+
+varying vec2 depth;
+
+attribute vec4 position;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+
+	// fix pixel / texel alignment
+	gl_Position.xy += texelOffsets.zw * gl_Position.w;
+	// linear depth storage
+	// offset / scale range output
+#if LINEAR_RANGE
+	depth.x = (gl_Position.z - depthRange.x) * depthRange.w;
+#else
+	depth.x = gl_Position.z;
+#endif
+	depth.y = gl_Position.w;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,87 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform float shadowFuzzyWidth;
+uniform vec4 lightColour;
+
+uniform sampler2D shadowMap;
+uniform sampler2D normalMap;
+
+varying vec3 tangentLightDir;
+varying vec4 vUv0;
+varying vec4 vUv1;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+
+	// get the new normal and diffuse values
+	vec3 normal = normalize(expand(texture2D(normalMap, vUv1.xy).xyz));
+	vec4 vertexColour = clamp(dot(normal, tangentLightDir), 0.0, 1.0) * vec4(0.590839, 0.36056, 0.13028, 1.0);
+	vec4 shadowUV = vUv0;
+	// point on shadowmap
+#if LINEAR_RANGE
+	shadowUV.xy = shadowUV.xy / shadowUV.w;
+#else
+	shadowUV = shadowUV / shadowUV.w;
+#endif
+	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0.0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0.0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0.0, -pixeloffset)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0.0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+
+#if FUZZY_TEST
+	// fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
+	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
+	float visibility = saturate(1.0 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
+
+	gl_FragColor = vertexColour * visibility;
+#else
+	// hard test
+#if PCF
+	// use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	gl_FragColor = vec4(vertexColour.xyz * final, 1.0);
+	
+#else
+	gl_FragColor = (finalCenterDepth > shadowUV.z) ? vertexColour : vec4(0.0, 0.0, 0.0, 1.0);
+#endif
+
+#endif
+	gl_FragColor = vec4(1.0,0.0,1.0, 1.0);
+   
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapNormalMapReceiverVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,52 @@
+#version 100
+precision highp int;
+precision highp float;
+
+attribute vec3 tangent;
+attribute vec4 position;
+attribute vec3 normal;
+
+uniform mat4 world;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition; // object space
+uniform vec4 shadowDepthRange;
+
+varying vec3 tangentLightDir;
+varying vec4 vUv0;
+varying vec4 vUv1;
+
+attribute vec4 uv0;
+attribute vec4 uv1;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	
+	vec4 worldPos = world * position;
+vec4 lightPos = vec4(300.0, 750.0, -700.0, 1.0);
+
+	// Get object space light direction 
+    vec3 lightDir = normalize(lightPos.xyz -  (position.xyz * lightPos.w));
+
+	// calculate shadow map coords
+	vUv0 = texViewProj * worldPos;
+#if LINEAR_RANGE
+	// adjust by fixed depth bias, rescale into range
+	vUv0.z = (uv0.z - shadowDepthRange.x) * shadowDepthRange.w;
+#endif
+
+	vUv1 = uv1;
+
+	// Calculate the binormal (NB we assume both normal and tangent are 
+	// already normalised) 
+	vec3 binormal = cross(normal, tangent); 
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+    
+	// Transform the light vector according to this matrix 
+	tangentLightDir = normalize(rotation * lightDir); 
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,75 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+uniform float inverseShadowmapSize;
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+#if FUZZY_TEST
+uniform float shadowFuzzyWidth;
+#endif
+uniform sampler2D shadowMap;
+
+varying vec4 oShadowUV;
+varying vec4 vColour;
+
+void main()
+{
+	vec4 shadowUV = oShadowUV;
+	// point on shadowmap
+#if LINEAR_RANGE
+	shadowUV.xy = shadowUV.xy / shadowUV.w;
+#else
+	shadowUV = shadowUV / shadowUV.w;
+#endif
+
+	float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
+    
+    // gradient calculation
+  	float pixeloffset = inverseShadowmapSize;
+    vec4 depths = vec4(
+    	texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0.0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0.0)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0.0, -pixeloffset)).x,
+    	texture2D(shadowMap, shadowUV.xy + vec2(0.0, +pixeloffset)).x);
+
+	vec2 differences = abs( depths.yw - depths.xz );
+	float gradient = min(gradientClamp, max(differences.x, differences.y));
+	float gradientFactor = gradient * gradientScaleBias;
+
+	// visibility function
+	float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
+	float finalCenterDepth = centerdepth + depthAdjust;
+
+	// shadowUV.z contains lightspace position of current object
+
+#if FUZZY_TEST
+	// Fuzzy test - introduces some ghosting in result and doesn't appear to be needed?
+	//float visibility = saturate(1 + delta_z / (gradient * shadowFuzzyWidth));
+	float visibility = saturate(1.0 + (finalCenterDepth - shadowUV.z) * shadowFuzzyWidth * shadowUV.w);
+
+	gl_FragColor = vColour * visibility;
+#else
+	// Hard test
+#if PCF
+	// Use depths from prev, calculate diff
+	depths += depthAdjust;
+	float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
+	final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
+	
+	final *= 0.2;
+
+	gl_FragColor = vec4(vColour.xyz * final, 1.0);
+	
+#else
+	gl_FragColor = (finalCenterDepth > shadowUV.z) ? vColour : vec4(0.0, 0.0, 0.0, 1.0);
+#endif
+
+#endif
+   
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DepthShadowmapReceiverVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,42 @@
+#version 100
+precision highp int;
+precision highp float;
+
+uniform mat4 world;
+uniform mat4 worldIT;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 lightPosition;
+uniform vec4 lightColour;
+#if LINEAR_RANGE
+uniform vec4 shadowDepthRange;
+#endif
+
+attribute vec4 position;
+attribute vec3 normal;
+
+varying vec4 shadowUV;
+varying vec4 vColour;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	vec4 worldPos = world * position;
+	vec3 worldNorm = (worldIT * vec4(normal, 1.0)).xyz;
+
+vec4 lightPos = vec4(300.0, 750.0, -700.0, 1.0);
+	// Calculate lighting (simple vertex lighting)
+	vec3 lightDir = normalize(lightPos.xyz - (worldPos.xyz * lightPos.w));
+
+	vColour = vec4(0.590839, 0.36056, 0.13028, 1.0) * max(dot(lightDir, worldNorm), 0.0);
+
+	// Calculate shadow map coords
+	shadowUV = texViewProj * worldPos;
+#if LINEAR_RANGE
+	// Adjust by fixed depth bias, rescale into range
+	shadowUV.z = (shadowUV.z - shadowDepthRange.x) * shadowDepthRange.w;
+	shadowUV.xy = shadowUV.xy / shadowUV.w;
+#else
+	shadowUV = shadowUV / shadowUV.w;
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DiffuseOneTexture.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DiffuseOneTexture.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DiffuseOneTexture.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D texMap;
+
+varying vec4 colour;
+varying vec4 uv;
+
+/*
+  Basic fragment program using texture and diffuse colour.
+*/
+void main()
+{
+	gl_FragColor = texture2D(texMap, uv.xy) * colour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/DitherFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/DitherFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/DitherFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,25 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+uniform sampler2D noise;
+varying vec2 oUv0;
+//varying vec2 oUv1;
+
+void main()
+{
+	float c = dot(texture2D(RT, oUv0), vec4(0.30, 0.11, 0.59, 0.00));
+	float n = texture2D(noise, oUv0).r*2.0 - 1.0;
+	c += n;
+	if (c > 0.5)
+	{
+		c = 0.0;
+	}
+	else
+	{
+		c = 1.0;
+	}   
+	gl_FragColor = vec4(c,c,c,1.0);
+}
\ No newline at end of file

Added: data/branches/Shader_HS18/programs/Example/GLSLES/EmbossedFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/EmbossedFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/EmbossedFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,18 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+varying vec2 uv0;
+
+void main()
+{
+    vec4 Color;
+    Color.a = 1.0;
+    Color.rgb = vec3(0.5);
+    Color -= texture2D( RT, uv0 - 0.001)*2.0;
+    Color += texture2D( RT, uv0 + 0.001)*2.0;
+    Color.rgb = vec3((Color.r+Color.g+Color.b)/3.0);
+    gl_FragColor = Color;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,29 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform vec4 lightDiffuse;
+uniform sampler2D normalMap;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+	// Retrieve normalised light vector, expand from range-compressed
+	vec3 lightVec = normalize(oTSLightDir).xyz;
+
+	// Get bump map vector, again expand from range-compressed
+	vec3 bumpVec = expand(texture2D(normalMap, oUv0).xyz);
+
+	// Calculate dot product
+	gl_FragColor = lightDiffuse * dot(bumpVec, lightVec);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,34 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+uniform sampler2D shadowMap;
+uniform sampler2D normalMap;
+uniform vec4 lightDiffuse;
+
+varying vec4 uvproj;
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// retrieve normalised light vector, expand from range-compressed
+	vec3 lightVec = expand(normalize(oTSLightDir).xyz);
+
+	// get bump map vector, again expand from range-compressed
+	vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz);
+
+	// get shadow value
+	vec3 shadow = texture2DProj(shadowMap, uvproj).xyz;
+
+	// Calculate dot product
+	gl_FragColor = vec4(shadow * lightDiffuse.xyz * dot(bumpVec, lightVec), 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingShadowRcvVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,54 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+/* Bump mapping vertex program for shadow receiving
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect. 
+*/
+
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+uniform mat4 worldMatrix;
+uniform mat4 texViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+
+varying vec4 uvproj;
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// Pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	// Non-normalised since we'll do that in the fragment program anyway
+	vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	vec3 binormal = cross(normal, tangent);
+	
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+
+	// Projection
+	uvproj = texViewProj * (worldMatrix * vertex);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,41 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+// General functions
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform sampler2D normalMap;
+
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+varying vec3 oTSHalfAngle;
+
+// NOTE: GLSL does not have the saturate function.  But it is equivalent to clamp(val, 0.0, 1.0)
+
+/* Fragment program which supports specular component */
+void main()
+{
+	// retrieve normalised light vector
+	vec3 lightVec = normalize(oTSLightDir);
+
+	// retrieve half angle and normalise
+	vec3 halfAngle = normalize(oTSHalfAngle);
+
+	// get bump map vector, again expand from range-compressed
+	vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz);
+
+	// Pre-raise the specular exponent to the eight power
+	float specFactor = pow(clamp(dot(bumpVec, halfAngle), 0.0, 1.0), 4.0);
+
+	// Calculate dot product for diffuse
+	gl_FragColor = (lightDiffuse * clamp(dot(bumpVec, lightVec), 0.0, 1.0)) + 
+			(lightSpecular * specFactor);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingSpecularVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+// General functions
+// parameters
+uniform vec4 lightPosition; // object space
+uniform vec3 eyePosition;   // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+
+varying vec4 oUv0;
+varying vec3 oTSLightDir;
+varying vec3 oTSHalfAngle;
+
+/* Vertex program which includes specular component */
+void main()
+{
+	// calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// calculate tangent space light vector
+	// Get object space light direction
+	vec3 lightDir = normalize(lightPosition.xyz - (vertex * lightPosition.w).xyz);
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	vec3 binormal = cross(normal, tangent);
+	
+	// Form a rotation matrix out of the vectors
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+
+	// Calculate half-angle in tangent space
+	vec3 eyeDir = normalize(eyePosition - vertex.xyz);
+	vec3 halfAngle = normalize(eyeDir + lightDir);
+	oTSHalfAngle = rotation * halfAngle;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_BumpMappingVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+/* Bump mapping vertex program
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect. 
+*/
+// parameters
+uniform vec4 lightPosition; // object space
+uniform mat4 worldViewProj;
+
+attribute vec4 vertex;
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec2 uv0;
+
+varying vec2 oUv0;
+varying vec3 oTSLightDir;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// Pass the main uvs straight through unchanged
+	oUv0 = uv0;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	// Non-normalised since we'll do that in the fragment program anyway
+	vec3 lightDir = lightPosition.xyz - (vertex * lightPosition.w).xyz;
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+
+	// Fixed handedness
+	vec3 binormal = cross(normal, tangent);
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+	
+	// Transform the light vector according to this matrix
+	oTSLightDir = rotation * lightDir;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,25 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+/* Cel shading fragment program for single-pass rendering */
+uniform vec4 diffuse;
+uniform vec4 specular;
+uniform sampler2D diffuseRamp;
+uniform sampler2D specularRamp;
+uniform sampler2D edgeRamp;
+
+varying float diffuseIn;
+varying float specularIn;
+varying float edge;
+
+void main()
+{
+	// Step functions from textures
+	vec4 diffuseStep = texture2D(diffuseRamp, vec2(diffuseIn));
+	vec4 specularStep = texture2D(specularRamp, vec2(specularIn));
+	vec4 edgeStep = texture2D(edgeRamp, vec2(edge));
+
+	gl_FragColor = edgeStep.x * ((diffuse * diffuseStep.x) + 
+					(specular * specularStep.x));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_CelShadingVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,50 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+/* Cel shading vertex program for single-pass rendering
+   In this program, we want to calculate the diffuse and specular
+   ramp components, and the edge factor (for doing simple outlining)
+   For the outlining to look good, we need a pretty well curved model.
+*/
+// Parameters
+attribute vec4 vertex;
+attribute vec3 normal;
+
+uniform vec3 lightPosition; // object space
+uniform vec3 eyePosition;   // object space
+uniform vec4 shininess;
+uniform mat4 worldViewProj;
+
+varying float diffuseIn;
+varying float specularIn;
+varying float edge;
+
+void main()
+{
+	// calculate output position
+	gl_Position = worldViewProj * vertex;
+
+	// calculate light vector
+	vec3 N = normalize(normal);
+	vec3 L = normalize(lightPosition - vertex.xyz);
+	vec3 E = normalize(eyePosition - vertex.xyz);
+	
+	// Calculate diffuse component
+	diffuseIn = max(dot(N, L) , 0.0);
+
+	// Mask off specular if diffuse is 0
+	if (diffuseIn == 0.0)
+	{
+	    specularIn = 0.0;
+	}
+	else
+	{
+		// Calculate specular component
+		vec3 H = normalize(L + E);
+		specularIn = pow(max(dot(N, H), 0.0), shininess.x);
+	}
+
+	// Edge detection, dot eye and normal vectors
+	edge = max(dot(N, E), 0.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,40 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 tintColour;
+uniform float noiseScale;
+uniform float fresnelBias;
+uniform float fresnelScale;
+uniform float fresnelPower;
+uniform sampler2D noiseMap;
+uniform sampler2D reflectMap;
+uniform sampler2D refractMap;
+
+varying vec3 noiseCoord;
+varying vec4 projectionCoord;
+varying vec3 eyeDir;
+varying vec3 oNormal;
+
+// Fragment program for distorting a texture using a 3D noise texture
+void main()
+{
+	// Do the tex projection manually so we can distort _after_
+	vec2 final = projectionCoord.xy / projectionCoord.w;
+
+	// Noise
+	vec3 noiseNormal = (texture2D(noiseMap, (noiseCoord.xy / 5.0)).rgb - 0.5).rbg * noiseScale;
+	final += noiseNormal.xz;
+
+	// Fresnel
+	//normal = normalize(normal + noiseNormal.xz);
+	float fresnel = fresnelBias + fresnelScale * pow(1.0 + dot(eyeDir, oNormal), fresnelPower);
+
+	// Reflection / refraction
+	vec4 reflectionColour = texture2D(reflectMap, final);
+	vec4 refractionColour = texture2D(refractMap, final) + tintColour;
+
+	// Final colour
+	gl_FragColor = mix(refractionColour, reflectionColour, fresnel);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_FresnelVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,39 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 uv0;
+attribute vec4 position;
+attribute vec3 normal;
+
+uniform mat4 worldViewProjMatrix;
+uniform vec3 eyePosition; // object space
+uniform float timeVal;
+uniform float scale;  // the amount to scale the noise texture by
+uniform float scroll; // the amount by which to scroll the noise
+uniform float noise;  // the noise perturb as a factor of the time
+
+varying vec3 noiseCoord;
+varying vec4 projectionCoord;
+varying vec3 eyeDir;
+varying vec3 oNormal;
+
+// Vertex program for fresnel reflections / refractions
+void main()
+{
+	gl_Position = worldViewProjMatrix * position;
+	// Projective texture coordinates, adjust for mapping
+	mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0, 
+                         0.0, -0.5, 0.0, 0.0,
+                         0.0, 0.0, 0.5, 0.0,
+                         0.5, 0.5, 0.5, 1.0);
+	projectionCoord = scalemat * gl_Position;
+
+	// Noise map coords
+	noiseCoord.xy = (uv0.xy + (timeVal * scroll)) * scale;
+	noiseCoord.z = noise * timeVal;
+
+	eyeDir = normalize(position.xyz - eyePosition); 
+	oNormal = normal.rgb;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,56 @@
+
+void generalPurposeProjection_vp(
+		float4 pos			: POSITION,
+		
+		out float4 oPos		: POSITION,
+		out float4 texCoord : TEXCOORD0,
+
+		uniform float4x4 worldViewProjMatrix,
+		uniform float4x4 worldMatrix,
+		uniform float4x4 texViewProjMatrix)
+{
+	oPos = mul(worldViewProjMatrix, pos);
+	// multiply position by world matrix, then by projective view/proj
+	float4 newpos = mul(worldMatrix, pos);
+	texCoord = mul(texViewProjMatrix, newpos);
+	
+}
+
+void generalPurposeProjection_fp(
+		float4 texCoord		: TEXCOORD0,
+		out float4 col		: COLOR,
+		uniform sampler2D texMap)
+{
+	col = tex2Dproj(texMap, texCoord);
+
+}
+		
+
+
+void generalPurposeProjection_vp(
+		float4 pos			: POSITION,
+		
+		out float4 oPos		: POSITION,
+		out float4 texCoord : TEXCOORD0,
+
+		uniform float4x4 worldViewProjMatrix,
+		uniform float4x4 worldMatrix,
+		uniform float4x4 texViewProjMatrix)
+{
+	oPos = mul(worldViewProjMatrix, pos);
+	// multiply position by world matrix, then by projective view/proj
+	float4 newpos = mul(worldMatrix, pos);
+	texCoord = mul(texViewProjMatrix, newpos);
+	
+}
+
+void generalPurposeProjection_fp(
+		float4 texCoord		: TEXCOORD0,
+		out float4 col		: COLOR,
+		uniform sampler2D texMap)
+{
+	col = tex2Dproj(texMap, texCoord);
+
+}
+		
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_ProjectionVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+
+void generalPurposeProjection_vp(
+		float4 pos			: POSITION,
+		
+		out float4 oPos		: POSITION,
+		out float4 texCoord : TEXCOORD0,
+
+		uniform float4x4 worldViewProjMatrix,
+		uniform float4x4 worldMatrix,
+		uniform float4x4 texViewProjMatrix)
+{
+	oPos = mul(worldViewProjMatrix, pos);
+	// multiply position by world matrix, then by projective view/proj
+	float4 newpos = mul(worldMatrix, pos);
+	texCoord = mul(texViewProjMatrix, newpos);
+}
+
+void generalPurposeProjection_fp(
+		float4 texCoord		: TEXCOORD0,
+		out float4 col		: COLOR,
+		uniform sampler2D texMap)
+{
+	col = tex2Dproj(texMap, texCoord);
+}
+		
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayPS.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayPS.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayPS.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,20 @@
+#version 300 es
+
+precision mediump int;
+precision mediump float;
+
+uniform lowp sampler2DArray TextureArrayTex;
+in vec4 oUv;
+out vec4 fragColour;
+
+void main(void)
+{
+	vec4 texcoord;
+	texcoord = oUv;
+	texcoord.z = floor(texcoord.z);
+    vec4 c0 = texture(TextureArrayTex, texcoord.xyz);
+	texcoord.z += 1.0;
+    vec4 c1 = texture(TextureArrayTex, texcoord.xyz);
+
+	fragColour = mix(c0, c1, fract(oUv.z));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayVS.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayVS.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Example_TextureArrayVS.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,15 @@
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+in vec4 uv0;
+in vec4 vertex;
+out vec4 oUv;
+
+uniform mat4 worldViewProj;
+
+void main(void)
+{
+	gl_Position = worldViewProj * vertex;
+	oUv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GlassFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GlassFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GlassFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,15 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+uniform sampler2D NormalMap;
+varying vec2 oUv0;
+
+void main()
+{
+	vec4 normal = 2.0 * (texture2D(NormalMap, oUv0 * 2.5) - 0.5);
+
+	gl_FragColor = texture2D(RT, oUv0 + normal.xy * 0.05);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,22 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D diffuseMap;
+
+varying vec4 oUv0;
+varying vec4 oColour;
+
+/// grass_vp ambient
+void main()
+{	
+    vec4 texColor = texture2D(diffuseMap, oUv0.xy);
+    // Do manual alpha rejection because it is not built into OpenGL ES 2
+    if (texColor.a < 0.588)
+    {
+        discard;
+    }
+
+    gl_FragColor = vec4(oColour.rgb, texColor.a);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassAmbientVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,41 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+uniform vec4 ambient;
+uniform vec4 offset;
+
+attribute vec4 position;
+attribute vec4 normal;
+attribute vec4 uv0;
+
+varying vec4 oUv0;
+varying vec4 oColour;
+
+/// grass_vp ambient
+void main()
+{	
+     // Position
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+  	gl_Position = worldViewProj * mypos;
+    // Texture Coord
+	oUv0.xy = uv0.xy;      
+    /*
+    // Normal
+    // Make vec from vertex to camera
+    vec4 EyeVec = camObjPos - mypos;
+    // Dot the v to eye and the normal to see if they point
+    //  in the same direction or opposite
+    float aligned = dot(normal, EyeVec); // -1..1
+    // If aligned is negative, we need to flip the normal
+    if (aligned < 0)  
+        normal = -normal;  
+    //oNormal = normal; 
+    */
+    // Color    
+	oColour = ambient; 
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,33 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D diffuseMap;
+
+varying vec4 oUv0;
+varying vec2 oDepth;
+
+//////////////////////// GRASS SHADOW CASTER
+void main()
+{	
+	float alpha = texture2D(diffuseMap, oUv0.xy).a;
+
+    // Do manual alpha rejection because it is not built into OpenGL ES 2
+    if (alpha < 0.588)
+    {
+        discard;
+    }
+
+	if (alpha > 0.001)
+    {
+       gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);
+    }
+    else
+    {
+        float finalDepth = oDepth.x / oDepth.y;
+        // just smear across all components 
+        // therefore this one needs high individual channel precision
+        gl_FragColor = vec4(vec3(finalDepth), 1.0);
+    }
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,32 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+uniform vec4 offset;
+uniform vec4 texelOffsets;
+
+attribute vec4 position;
+attribute vec4 uv0;
+
+varying vec4 oUv0;
+varying vec2 oDepth;
+
+//////////////////////// GRASS SHADOW CASTER
+// Shadow caster vertex program.
+void main()
+{
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+
+	// fix pixel / texel alignment
+	gl_Position.xy += texelOffsets.zw * gl_Position.w;
+    
+	oDepth.x = gl_Position.z;
+	oDepth.y = gl_Position.w;
+  
+  	oUv0 = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,25 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+////////////////////////////// MOVING GRASS
+// Vertex program to wave some grass about
+// Assumes UV texture coords of v==0 indicates the top of the grass
+uniform sampler2D diffuseMap;
+
+varying vec4 oUv0;
+varying vec4 oColour;
+
+void main()
+{	
+    vec4 texColor = texture2D(diffuseMap, oUv0.xy);
+
+    // Do manual alpha rejection because it is not built into OpenGL ES 2
+    if (texColor.a < 0.588)
+    {
+        discard;
+    }
+
+    gl_FragColor = vec4(texColor.rgb * oColour.rgb, texColor.a); 
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,47 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform float fixedDepthBias;
+uniform float gradientClamp;
+uniform float gradientScaleBias;
+uniform sampler2D shadowMap;
+uniform sampler2D diffuseMap;
+uniform vec4 vertexLight;
+
+varying vec4 oUv0;
+varying vec4 oShadowUV;
+
+//////////////////////// GRASS SHADOW RECEIVER
+void main()
+{
+    if (oShadowUV.z > 0.0)
+    {
+       vec4 diffuse = texture2D(diffuseMap, oUv0.xy);
+       if (diffuse.a > 0.001)
+       {
+            // Do manual alpha rejection because it is not built into OpenGL ES 2
+            if (diffuse.a < 0.588)
+            {
+                discard;
+            }
+            gl_FragColor = vec4(0.0);
+       }
+       else
+       {
+            vec4 normShadowUV = oShadowUV / oShadowUV.w;
+            vec4 shadowDepths = texture2D(shadowMap, normShadowUV.xy);
+
+            float gradientFactor = gradientClamp * gradientScaleBias;
+            float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x;
+            float centerdepth = shadowDepths.x + depthAdjust;
+
+            gl_FragColor = (centerdepth > normShadowUV.z) ? vec4(vertexLight.rgb, diffuse.a) : vec4(0.0, 0.0, 0.0, diffuse.a);
+       }
+    }
+    else
+    {
+        gl_FragColor = vec4(0.0);
+    }
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassReceiverVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,57 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 world;
+uniform mat4 worldViewProj;
+uniform mat4 texViewProj;
+uniform vec4 camObjPos;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+attribute vec4 position;
+attribute vec4 normal;
+attribute vec4 uv0;
+
+varying vec4 oShadowUV;
+varying vec3 oUv0;
+varying vec4 oColour;
+
+//////////////////////// GRASS SHADOW RECEIVER
+void main()
+{	    
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+	oUv0.xy = uv0.xy;    
+    // Transform position to world space
+	vec4 worldPos = world * mypos;
+	// calculate shadow map coords
+	oShadowUV = texViewProj * worldPos;
+       
+    // Make vec from vertex to camera
+    vec4 EyeVec = camObjPos - mypos;
+    // Dot the v to eye and the normal to see if they point
+    // in the same direction or opposite
+    float alignedEye = dot(normal, EyeVec); // -1..1
+    // If aligned is negative, we need to flip the normal
+	vec4 myNormal = normal;
+    if (alignedEye < 0.0)
+        myNormal = -normal;
+    //oNormal = normal;
+    
+  	// get vertex light direction (support directional and point)
+	vec3 lightVec = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
+    // Dot the v to light and the normal to see if they point
+    // in the same direction or opposite
+    float alignedLight = dot(myNormal.xyz, lightVec); // -1..1
+    // If aligned is negative, shadowing/lighting is not possible.
+    oUv0.z = (alignedLight < 0.0) ? 0.0 : 1.0 ;
+         
+    float diffuseFactor = max(alignedLight, 0.0);
+	//oColour = diffuseFactor * lightColour;    
+	oColour = lightColour;    
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassTexVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassTexVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassTexVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec4 oUv0;
+
+attribute vec4 position;
+attribute vec4 uv0;
+
+uniform mat4 worldViewProj;
+uniform vec4 ambient;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+void main()
+{	    
+     // Position
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+    // Texture Coord
+	oUv0.xy = uv0.xy;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrassVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrassVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrassVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,38 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+////////////////////////////// MOVING GRASS
+// Vertex program to wave some grass about
+// Assumes UV texture coords of v==0 indicates the top of the grass
+uniform mat4 worldViewProj;
+uniform vec4 camObjPos;
+uniform vec4 ambient;
+uniform vec4 objSpaceLight;
+uniform vec4 lightColour;
+uniform vec4 offset;
+
+attribute vec4 position;
+attribute vec4 normal;
+attribute vec4 uv0;
+
+varying vec4 oUv0;
+varying vec4 oColour;
+
+void main()
+{
+	vec4 mypos = position;
+	vec4 factor = vec4(1.0, 1.0, 1.0, 1.0) - uv0.yyyy;
+	mypos = mypos + offset * factor;
+	gl_Position = worldViewProj * mypos;
+
+	oUv0 = uv0;
+    // Color
+	// get vertex light direction (support directional and point)
+	vec3 light = normalize(objSpaceLight.xyz - (mypos.xyz * objSpaceLight.w).xyz);
+	// grass is just 2D quads, so if light passes underneath we need to invert the normal
+	// abs() will have the same effect
+    float diffuseFactor = abs(dot(normal.xyz, light));
+	oColour = ambient + diffuseFactor * lightColour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/GrayScale.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/GrayScale.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/GrayScale.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,13 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+varying vec2 oUv0;
+
+void main()
+{
+    vec3 greyscale = vec3(dot(texture2D(RT, oUv0).rgb, vec3(0.3, 0.59, 0.11)));
+	gl_FragColor = vec4(greyscale, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HWBasicInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HWBasicInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HWBasicInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,71 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+//Vertex input
+in vec4 vertex;
+in vec3 normal;
+in vec4 uv0;
+in vec4 uv1;
+in vec4 uv2;
+in vec4 uv3;
+in vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	out vec2 depth;
+#else
+	out vec2 _uv0;
+	out vec3 oNormal;
+	out vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		out vec4 oLightSpacePos;
+	#endif
+#endif
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	mat4 worldMatrix;
+	worldMatrix[0] = uv1;
+	worldMatrix[1] = uv2;
+	worldMatrix[2] = uv3;
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	vec4 worldPos		= vertex * worldMatrix;
+	vec3 worldNorm		= normal * mat3(worldMatrix);
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HW_VTFInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HW_VTFInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HW_VTFInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,133 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+//Vertex input
+in vec4 vertex;
+in vec3 normal;
+
+#ifdef BONE_TWO_WEIGHTS
+	in vec4 blendWeights;
+#endif
+
+in vec4 uv0;
+in vec4 uv1;
+in vec4 uv2;
+	
+#if BONE_MATRIX_LUT
+	in vec4 uv3;
+	in vec4 uv4;
+	in vec4 uv5;
+#endif
+
+in vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform sampler2D matrixTexture;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	out vec2 depth;
+#else
+	out vec2 _uv0;
+	out vec3 oNormal;
+	out vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		out vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos;
+	vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	mat2x4 blendDQ;	
+	blendDQ[0] = texture( matrixTexture, vec2(uv1.x, 0.0) + uv2.xy );
+	blendDQ[1] = texture( matrixTexture, vec2(uv1.y, 0.0) + uv2.xy );
+#ifdef BONE_TWO_WEIGHTS
+	mat2x4 blendDQ2;
+	blendDQ2[0] = texture( matrixTexture, vec2(uv1.z, 0.0) + uv2.xy );
+	blendDQ2[1] = texture( matrixTexture, vec2(uv1.w, 0.0) + uv2.xy );
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	worldMatrix[0] = texture( matrixTexture, uv1.xw + uv2.xy );
+	worldMatrix[1] = texture( matrixTexture, uv1.yw + uv2.xy );
+	worldMatrix[2] = texture( matrixTexture, uv1.zw + uv2.xy );
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+#if BONE_MATRIX_LUT
+	mat4 worldCompMatrix;
+	worldCompMatrix[0] = uv3;
+	worldCompMatrix[1] = uv4;
+	worldCompMatrix[2] = uv5;
+	worldCompMatrix[3] = vec4( 0, 0, 0, 1 );
+	
+	worldPos =  worldPos * worldCompMatrix;
+	worldNorm = worldNorm * mat3(worldCompMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HalftoneFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HalftoneFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HalftoneFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,28 @@
+#version 300 es
+
+precision mediump int;
+precision mediump float;
+
+in vec4 pos;
+in vec2 oUv0;
+
+uniform vec2 numTiles;
+uniform vec2 iNumTiles;
+uniform vec2 iNumTiles2;
+uniform vec4 lum;
+uniform sampler2D RT;
+uniform lowp sampler3D noise;
+
+out vec4 fragColour;
+
+void main()
+{
+	vec3 local;
+	local.xy = mod(oUv0, iNumTiles);
+	vec2 middle = oUv0 - local.xy;
+	local.xy = local.xy * numTiles;
+	middle +=  iNumTiles2;
+	local.z = dot(texture(RT, middle), lum);
+	vec4 c = vec4(texture(noise,local).r);
+	fragColour = c;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 vertex;
+attribute vec4 normal;
+attribute vec4 uv0;
+attribute vec4 uv1; // pos2
+
+varying vec2 oUv;
+varying vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+
+// hardware morph animation (no normals)
+void main()
+{
+	// interpolate
+	vec4 interp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0);
+	
+	gl_Position = worldViewProj * interp;
+	oUv = uv0.xy;
+	colour = vec4(1.0,0.0,0.0,1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationWithNormalsVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationWithNormalsVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HardwareMorphAnimationWithNormalsVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,39 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 vertex;
+attribute vec4 normal;
+attribute vec4 uv0;
+attribute vec4 uv1; // pos2
+attribute vec4 uv2; // normal2
+
+varying vec2 oUv;
+varying vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+uniform vec4 objSpaceLightPos;
+uniform vec4 ambient;
+
+// hardware morph animation (with normals)
+void main()
+{
+	// interpolate position
+	vec4 posinterp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0);
+
+    // nlerp normal
+	vec3 ninterp = normal.xyz + anim_t.x*(uv2.xyz - normal.xyz);
+	ninterp = normalize(ninterp);
+
+	gl_Position = worldViewProj * posinterp;
+	oUv = uv0.xy;
+
+	vec3 lightDir = normalize(
+		objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
+
+	// Colour it red to make it easy to identify
+	float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
+	colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,28 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 vertex;
+attribute vec4 normal;
+attribute vec4 uv0;
+attribute vec4 uv1; // pose1
+attribute vec4 uv2; // pose2
+
+varying vec2 oUv;
+varying vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+
+// hardware pose animation (no normals)
+void main()
+{
+	// interpolate
+    vec4 interp = vec4(vertex.xyz + anim_t.x*uv1.xyz + anim_t.y*uv2.xyz, 1.0);
+
+	gl_Position = worldViewProj * interp;
+	oUv = uv0.xy;
+	colour = vec4(1.0,0.0,0.0,1.0);
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationWithNormalsVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationWithNormalsVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HardwarePoseAnimationWithNormalsVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 vertex;
+attribute vec4 normal;
+attribute vec4 uv0;
+attribute vec4 uv1; // pose1pos
+attribute vec4 uv2; // pose1norm
+attribute vec4 uv3; // pose2pos
+attribute vec4 uv4; // pose2norm
+
+varying vec2 oUv;
+varying vec4 colour;
+
+uniform mat4 worldViewProj;
+uniform vec4 anim_t;
+uniform vec4 objSpaceLightPos;
+uniform vec4 ambient;
+
+// hardware pose animation (with normals)
+void main()
+{
+	// interpolate position
+	vec4 posinterp = vec4(vertex.xyz + anim_t.x*uv1.xyz + anim_t.y*uv3.xyz, 1.0);
+
+    // nlerp normal
+	// nlerp normal
+	// First apply the pose normals (these are actual normals, not offsets)
+	vec3 ninterp = anim_t.x*uv2.xyz + anim_t.y*uv4.xyz;
+
+	// Now add back any influence of the original normal
+	// This depends on what the cumulative weighting left the normal at, if it's lacking or cancelled out
+	//float remainder = 1.0 - min(anim_t.x + anim_t.y, 1.0);
+	float remainder = 1.0 - min(length(ninterp), 1.0);
+	ninterp = ninterp + (normal.xyz * remainder);
+	ninterp = normalize(ninterp);
+
+	gl_Position = worldViewProj * posinterp;
+	oUv = uv0.xy;
+	
+	vec3 lightDir = normalize(
+		objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w));
+
+	// Colour it red to make it easy to identify
+	float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0);
+	colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,63 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D Input;
+uniform vec4 blurAmount;
+
+varying vec2 uv;
+
+void main()
+{
+   int i;
+   vec4 tmpOutColor;
+   float  diffuseGlowFactor;
+   vec2 offsets[4];
+/*
+		// hazy blur
+		-1.8, -1.8,
+		-1.8, 1.8,
+		1.8, -1.8,
+		1.8, 1.8
+*/
+/*
+		// less-hazy blur
+	  -1.0,  2.0,
+	  -1.0, -1.0,
+	   1.0, -1.0,
+	   1.0,  1.0
+*/
+/*
+      -0.326212, -0.405805,
+      -0.840144, -0.073580,
+      -0.695914,  0.457137,
+      -0.203345,  0.620716
+*/
+
+   offsets[0] = vec2(-0.3,  0.4);
+   offsets[1] = vec2(-0.3,  -0.4);
+   offsets[2] = vec2(0.3,  -0.4);
+   offsets[3] = vec2(0.3,  0.4);
+
+   tmpOutColor = texture2D( Input, uv );	// UV coords are in image space
+
+   // calculate glow amount
+   diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
+
+   // basic blur filter
+   for (i = 0; i < 4; i++) {
+      tmpOutColor += texture2D( Input, uv + blurAmount.x * diffuseGlowFactor * offsets[i] );
+   }
+
+   tmpOutColor *= 0.25;
+
+   // TIPS (old-skool strikes again!)
+   // Pay attention here! If you use the "out float4 outColor" directly
+   // in your steps while creating the output color (like you remove
+   // the "tmpOutColor" var and just use the "outColor" directly)
+   // your pixel-color output IS CHANGING EACH TIME YOU DO AN ASSIGNMENT TOO!
+   // A temporary variable, instead, acts like a per-pixel double buffer, and
+   // best of all, lead to better performance.
+   gl_FragColor = tmpOutColor;
+}
\ No newline at end of file

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HeatBlurVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,15 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 vertex;
+uniform mat4 worldViewProj;
+varying vec2 uv;
+attribute vec2 uv0;
+
+void main()
+{
+    gl_Position = worldViewProj * vertex;
+    uv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,11 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 NDotV;
+
+void main()
+{
+   gl_FragColor = vec4(NDotV.x);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/HeatCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,18 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+uniform vec3 eyePosition;
+attribute vec4 position;
+attribute vec4 normal;
+varying vec2 NDotV;
+
+void main()
+{
+   vec4 eyeDir = vec4(eyePosition - position.xyz, 0.0);
+   eyeDir = normalize(eyeDir);
+   gl_Position = worldViewProj * position;
+   NDotV = vec2(clamp( dot( normal, eyeDir ), 0.0, 1.0 ));
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Instancing.frag
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Instancing.frag	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Instancing.frag	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,101 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+
+#version 300 es
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D diffuseMap;
+
+uniform vec4	lightPosition;
+uniform vec3	cameraPosition;
+uniform vec3 	lightAmbient;
+uniform vec3	lightDiffuse;
+uniform vec3	lightSpecular;
+uniform vec4	lightAttenuation;
+uniform float	lightGloss;
+
+#if DEPTH_SHADOWRECEIVER
+uniform float invShadowMapSize;
+uniform lowp sampler2DShadow shadowMap;
+
+//declare external function
+
+// Simple PCF 
+// Number of samples in one dimension (square for total samples)
+#define NUM_SHADOW_SAMPLES_1D 2.0
+#define SHADOW_FILTER_SCALE 1.0
+
+#define SHADOW_SAMPLES NUM_SHADOW_SAMPLES_1D*NUM_SHADOW_SAMPLES_1D
+
+vec4 offsetSample(vec4 uv, vec2 offset, float invMapSize)
+{
+	return vec4(uv.xy + offset * invMapSize * uv.w, uv.z, uv.w);
+}
+
+float calcDepthShadow(lowp sampler2DShadow shadowMap, vec4 uv, float invShadowMapSize)
+{
+	// 4-sample PCF
+	
+	float shadow = 0.0;
+	float offset = (NUM_SHADOW_SAMPLES_1D/2.0 - 0.5) * SHADOW_FILTER_SCALE;
+	for (float y = -offset; y <= offset; y += SHADOW_FILTER_SCALE)
+		for (float x = -offset; x <= offset; x += SHADOW_FILTER_SCALE)
+		{
+			float depth = textureProj(shadowMap, offsetSample(uv, vec2(x, y), invShadowMapSize));
+			if (depth >= 1.0 || depth >= uv.z)
+				shadow += 1.0;
+		}
+
+	shadow /= SHADOW_SAMPLES;
+
+	return shadow;
+}
+#endif
+
+in vec2 _uv0;
+in vec3 oNormal;
+in vec3 oVPos;
+#if DEPTH_SHADOWRECEIVER
+	in vec4 oLightSpacePos;
+#endif
+out vec4 fragColour;
+
+//---------------------------------------------
+//Main Pixel Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 color = texture( diffuseMap, _uv0 );
+
+	float fShadow = 1.0;
+#if DEPTH_SHADOWRECEIVER
+	fShadow = calcDepthShadow( shadowMap, oLightSpacePos, invShadowMapSize );
+#endif
+
+	vec4 baseColour = texture( diffuseMap, _uv0 );
+
+	//Blinn-Phong lighting
+	vec3 normal	= normalize( oNormal );
+	vec3 lightDir		= lightPosition.xyz - oVPos * lightPosition.w;
+	vec3 eyeDir			= normalize( cameraPosition - oVPos );
+
+	float fLength	= length( lightDir );
+	lightDir			= normalize( lightDir );
+
+	float NdotL	= max( 0.0, dot( normal, lightDir ) );
+	vec3 halfVector		= normalize(lightDir + eyeDir);
+	float HdotN	= max( 0.0, dot( halfVector, normal ) );
+	
+	vec3 ambient  = lightAmbient * baseColour.xyz;
+	vec3 diffuse  = lightDiffuse * NdotL * baseColour.xyz;
+	vec3 specular = lightSpecular * pow( HdotN, lightGloss );
+	
+	vec3 directLighting = (diffuse + specular) * fShadow;
+	
+	fragColour = vec4( directLighting + ambient, baseColour.a );
+	//fragColour = baseColour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/InstancingMisc.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/InstancingMisc.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/InstancingMisc.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,64 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+//Vertex input
+in vec4 vertex;
+in vec3 normal;
+in vec3 tangent;
+in vec4 uv0;
+in vec4 blendIndices;
+in vec4 blendWeights;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform mat4 worldMatrix;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	out vec2 depth;
+#else
+	out vec2 _uv0;
+	out vec3 oNormal;
+	out vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		out vec4 oLightSpacePos;
+	#endif
+#endif
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos		= vertex * worldMatrix;
+	vec3 worldNorm		= normal * mat3(worldMatrix);
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/InvertFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/InvertFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/InvertFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,13 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+varying vec2 oUv0;
+//varying vec2 uv1;
+
+void main()
+{
+	gl_FragColor = 1.0 - texture2D(RT, oUv0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/LaplaceFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/LaplaceFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/LaplaceFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,40 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D Image;
+uniform float scale;
+uniform float pixelSize;
+varying vec2 oUv0;
+
+// The Laplace filter approximates the second order derivate,
+// that is, the rate of change of slope in the image. It can be
+// used for edge detection. The Laplace filter gives negative
+// response on the higher side of the edge and positive response
+// on the lower side.
+
+// This is the filter kernel:
+// 0  1  0
+// 1 -4  1
+// 0  1  0
+
+void main()
+{
+    vec2 samples[4];
+	samples[0] = vec2(0, -1);
+	samples[1] = vec2(-1, 0);
+	samples[2] = vec2(1, 0);
+	samples[3] = vec2(0, 1);
+
+    mediump vec4 tc = texture2D(Image, oUv0);
+    vec4 laplace = -4.0 * tc;
+
+    // Sample the neighbor pixels
+    for (int i = 0; i < 4; i++){
+       laplace += texture2D(Image, oUv0 + pixelSize * samples[i]);
+    }
+
+    gl_FragColor = (0.5 + scale * laplace);
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,39 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 random_fractions;
+uniform vec4 heatBiasScale;
+uniform vec4 depth_modulator;
+
+uniform sampler2D Input;         // output of HeatVisionCaster_fp (NdotV)
+uniform sampler2D NoiseMap;
+uniform sampler2D HeatLookup;
+
+varying vec4 diffuse;
+varying vec2 uv;
+
+void main()
+{
+   float  depth, heat, interference;
+
+   //  Output constant color:
+   depth = texture2D( Input, uv ).x;
+   depth *= (depth * depth_modulator).x;
+
+   heat  = (depth * heatBiasScale.y);
+
+//   if (depth > 0)
+   {
+		interference = -0.5 + texture2D( NoiseMap, uv + vec2( random_fractions.x, random_fractions.y ) ).x;
+		interference *= interference;
+		interference *= 1.0 - heat;
+		heat += interference;//+ heatBiasScale.x;
+   }
+
+   // Clamp UVs
+   heat  = max( 0.005, min( 0.995, heat ) );
+   gl_FragColor = texture2D( HeatLookup, vec2( heat, 0.0 ) );
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/LightToHeatVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,17 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 vertex;
+attribute vec2 uv0;
+
+varying vec2 uv;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+    gl_Position = worldViewProj * vertex;
+    uv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/NightVisionFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/NightVisionFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/NightVisionFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,34 @@
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+out vec4 fragColour;
+
+uniform sampler2D RT;
+uniform lowp sampler3D noiseVol;
+
+in vec2 oUv0;
+uniform vec4 lum;
+uniform float time;
+
+void main()
+{
+	vec4 oC;
+	oC = texture(RT, oUv0);
+	
+	//obtain luminence value
+	oC = vec4(dot(oC,lum));
+	
+	//add some random noise
+	oC += 0.2 *(texture(noiseVol, vec3(oUv0*5.0,time)))- 0.05;
+	
+	//add lens circle effect
+	//(could be optimised by using texture)
+	float dist = distance(oUv0, vec2(0.5,0.5));
+	oC *= smoothstep(0.5,0.45,dist);
+	
+	//add rb to the brightest pixels
+	oC.rb = vec2(max(oC.r - 0.75, 0.0)*4.0);
+	
+	fragColour = oC;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.frag
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.frag	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.frag	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,76 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+/*********************************************************************NVMH3****
+Copyright NVIDIA Corporation 2003
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
+BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
+WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
+BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
+ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Comments:
+	Simple ocean shader with animated bump map and geometric waves
+	Based partly on "Effective Water Simulation From Physical Models", GPU Gems
+
+11 Aug 05: converted from HLSL to GLSL by Jeff Doyle (nfz) to work in Ogre
+6 Jan 10: converted from GLSL to GLSL ES by David Rogers (masterfalcon) to work in Ogre
+
+******************************************************************************/
+
+
+uniform sampler2D NormalMap;
+uniform samplerCube EnvironmentMap;
+uniform vec4 deepColor;
+uniform vec4 shallowColor;
+uniform vec4 reflectionColor;
+uniform float reflectionAmount;
+uniform float reflectionBlur;
+uniform float waterAmount;
+uniform float fresnelPower;
+uniform float fresnelBias;
+uniform float hdrMultiplier;
+
+varying mat3 rotMatrix; // first row of the 3x3 transform from tangent to cube space
+varying vec2 bumpCoord0;
+varying vec2 bumpCoord1;
+varying vec2 bumpCoord2;
+varying vec3 eyeVector;
+
+void main(void)
+{
+	// sum normal maps
+	// sample from 3 different points so no texture repetition is noticeable
+    vec4 t0 = texture2D(NormalMap, bumpCoord0) * 2.0 - 1.0;
+    vec4 t1 = texture2D(NormalMap, bumpCoord1) * 2.0 - 1.0;
+    vec4 t2 = texture2D(NormalMap, bumpCoord2) * 2.0 - 1.0;
+    vec3 N = t0.xyz + t1.xyz + t2.xyz;
+
+    N = normalize(rotMatrix * N);
+
+	// reflection
+    vec3 E = normalize(eyeVector);
+    vec3 R = reflect(E, N);
+    // Ogre conversion for cube map lookup
+    R.z = -R.z;
+
+    vec4 reflection = textureCube(EnvironmentMap, R, reflectionBlur);
+    // cheap hdr effect
+    reflection.rgb *= (reflection.r + reflection.g + reflection.b) * hdrMultiplier;
+
+	// fresnel
+    float facing = 1.0 - dot(-E, N);
+    float fresnel = clamp(fresnelBias + pow(facing, fresnelPower), 0.0, 1.0);
+
+    vec4 waterColor = mix(shallowColor, deepColor, facing) * waterAmount;
+
+    reflection = mix(waterColor, reflection * reflectionColor, fresnel) * reflectionAmount;
+    gl_FragColor = waterColor + reflection;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Ocean2GLSLES.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,101 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+/*********************************************************************NVMH3****
+Copyright NVIDIA Corporation 2003
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
+BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
+WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
+BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
+ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+Comments:
+	Simple ocean shader with animated bump map and geometric waves
+	Based partly on "Effective Water Simulation From Physical Models", GPU Gems
+
+11 Aug 05: converted from HLSL to GLSL by Jeff Doyle (nfz) to work in Ogre
+6 Jan 10: converted from GLSL to GLSL ES by David Rogers (masterfalcon) to work in Ogre
+
+******************************************************************************/
+
+uniform vec3 eyePosition;
+uniform float BumpScale;
+uniform vec2 textureScale;
+uniform vec2 bumpSpeed;
+uniform float time;
+uniform float waveFreq;
+uniform float waveAmp;
+uniform mat4 worldViewProj;
+
+varying mat3 rotMatrix; //  transform from tangent to obj space
+varying vec2 bumpCoord0;
+varying vec2 bumpCoord1;
+varying vec2 bumpCoord2;
+varying vec3 eyeVector;
+
+attribute vec4 vertex;
+attribute vec4 uv0;
+
+// wave functions
+struct Wave {
+  float freq;  // 2*PI / wavelength
+  float amp;   // amplitude
+  float phase; // speed * 2*PI / wavelength
+  vec2 dir;
+};
+
+
+void main(void)
+{
+	#define NWAVES 2
+
+	Wave wave[NWAVES];
+
+	wave[0] = Wave( waveFreq, waveAmp, 0.5, vec2(-1.0, 0.0) );
+	wave[1] = Wave( 3.0 * waveFreq, 0.33 * waveAmp, 1.7, vec2(-0.7, 0.7) );
+
+    vec4 P = vertex;
+
+	// sum waves
+	float ddx = 0.0, ddy = 0.0;
+	float deriv;
+	float angle;
+
+	// wave synthesis using two sine waves at different frequencies and phase shift
+	for(int i = 0; i<NWAVES; ++i)
+	{
+		angle = dot(wave[i].dir, P.xz) * wave[i].freq + time * wave[i].phase;
+		P.y += wave[i].amp * sin( angle );
+		// calculate derivate of wave function
+		deriv = wave[i].freq * wave[i].amp * cos(angle);
+		ddx -= deriv * wave[i].dir.x;
+		ddy -= deriv * wave[i].dir.y;
+	}
+
+	// compute the 3x3 transform from tangent space to object space
+	// compute tangent basis
+    vec3 T = normalize(vec3(1.0, ddy, 0.0)) * BumpScale; // Tangent
+    vec3 B = normalize(vec3(0.0, ddx, 1.0)) * BumpScale; // Binormal
+    vec3 N = normalize(vec3(ddx, 1.0, ddy));             // Normal
+
+	rotMatrix = mat3(T, B, N);
+//	rotMatrix = mat3(vec3(T[0], B[0], N[0]),
+//						vec3(T[1], B[1], N[1]),
+//						vec3(T[2], B[2], N[2]));
+
+	gl_Position = worldViewProj * P;
+
+	// calculate texture coordinates for normal map lookup
+	bumpCoord0.xy = uv0.xy * textureScale + time * bumpSpeed;
+	bumpCoord1.xy = uv0.xy * textureScale * 2.0 + time * bumpSpeed * 4.0;
+	bumpCoord2.xy = uv0.xy * textureScale * 4.0 + time * bumpSpeed * 8.0;
+
+	eyeVector = P.xyz - eyePosition; // eye position in vertex space
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,43 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform vec3 lightDiffuse;
+uniform vec3 lightSpecular;
+uniform vec4 scaleBias;
+
+uniform sampler2D normalHeightMap;
+uniform sampler2D diffuseMap;
+
+varying vec3 oEyeDir;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oUv0;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+    // Get the height using the tex coords
+    float height = texture2D(normalHeightMap, oUv0.xy).a;
+
+    // Calculate displacement
+    float displacement = (height * scaleBias.x) + scaleBias.y;
+	
+    vec3 uv2 = vec3(oUv0.xy, 1.0);
+	
+    // calculate the new tex coord to use for normal and diffuse
+    vec2 newTexCoord = ((oEyeDir * displacement) + uv2).xy;
+	
+    // get the new normal and diffuse values
+    vec3 normal = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+    vec3 diffuse = texture2D(diffuseMap, newTexCoord).xyz;
+    vec3 specular = pow(clamp(dot(normal, oHalfAngle), 0.0, 1.0), 32.0) * lightSpecular;
+
+    vec3 col = diffuse * (clamp(dot(normal, oLightDir), 0.0, 1.0) * lightDiffuse) + specular;
+    gl_FragColor = vec4(col, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,70 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform vec4 lightDiffuse;
+uniform vec4 scaleBias;
+uniform vec4 spotParams;
+uniform vec4 lightDiffuse1;
+uniform vec4 spotParams1;
+
+uniform sampler2D normalHeightMap;
+uniform sampler2D diffuseMap;
+uniform sampler2D shadowMap1;
+uniform sampler2D shadowMap2;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec3 tangentSpotDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+// Expand a range-compressed vector
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+void main()
+{
+	// get the height using the tex coords
+	float height = texture2D(normalHeightMap, oUv0.xy).a;
+	// scale and bias factors	
+	float scale = scaleBias.x;
+	float bias = scaleBias.y;
+
+	// calculate displacement	
+	float displacement = (height * scale) + bias;
+	//float displacement = (height * 0.04) - 0.02;
+	
+	vec3 scaledEyeDir = tangentEyeDir * displacement;
+	
+	// calculate the new tex coord to use for normal and diffuse
+	vec2 newTexCoord = (scaledEyeDir + oUv0.xyz).xy;
+	
+	// get the new normal and diffuse values
+	vec3 normal = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+	vec4 diffuse = texture2D(diffuseMap, newTexCoord);
+	
+	vec4 col1 = diffuse * clamp(dot(normal, tangentLightDir[0]),0.0,1.0) * lightDiffuse;
+	// factor in spotlight angle
+	float rho = clamp(dot(tangentSpotDir[0], tangentLightDir[0]),0.0,1.0);
+	// factor = (rho - cos(outer/2) / cos(inner/2) - cos(outer/2)) ^ falloff
+	float spotFactor = pow(
+		clamp(rho - spotParams.y,0.0,1.0) / (spotParams.x - spotParams.y), spotParams.z);
+	col1 = col1 * spotFactor;
+	vec4 col2 = diffuse * clamp(dot(normal, tangentLightDir[1]),0.0,1.0) * lightDiffuse1;
+	// factor in spotlight angle
+	rho = clamp(dot(tangentSpotDir[1], tangentLightDir[1]),0.0,1.0);
+	// factor = (rho - cos(outer/2) / cos(inner/2) - cos(outer/2)) ^ falloff
+	spotFactor = pow(
+		clamp(rho - spotParams1.y,0.0,1.0) / (spotParams1.x - spotParams1.y), spotParams1.z);
+	col2 = col2 * spotFactor;
+
+	// shadow textures
+	col1 = col1 * texture2DProj(shadowMap1, shadowUV[0]);
+	col2 = col2 * texture2DProj(shadowMap2, shadowUV[1]);
+
+	gl_FragColor = col1 + col2;
+
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingShadowsVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,63 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 lightPosition; // object space 
+uniform vec4 lightPosition1; // object space 
+uniform vec4 eyePosition;   // object space 
+uniform vec4 spotDirection; // object space
+uniform vec4 spotDirection1; // object space
+uniform mat4 worldViewProj; // not actually used but here for compat with HLSL
+uniform mat4 worldMatrix;
+uniform mat4 texViewProj1;
+uniform mat4 texViewProj2;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec3 tangentSpotDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+attribute vec3 tangent;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 uv0;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+
+	vec4 worldPos = worldMatrix * position;
+
+    oUv0 = uv0;
+
+	shadowUV[0] = texViewProj1 * worldPos;
+	shadowUV[1] = texViewProj2 * worldPos;
+
+	// calculate tangent space light vector 
+	// Get object space light direction 
+    vec3 lightDir = normalize(lightPosition.xyz -  (position.xyz * lightPosition.w));
+	vec3 lightDir1 = normalize(lightPosition1.xyz -  (position.xyz * lightPosition1.w));
+	
+	vec3 eyeDir = (eyePosition - position).xyz; 
+
+	// Calculate the binormal (NB we assume both normal and tangent are 
+	// already normalised) 
+	vec3 binormal = cross(normal, tangent); 
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 rotation = mat3(vec3(tangent[0], binormal[0], normal[0]),
+						vec3(tangent[1], binormal[1], normal[1]),
+						vec3(tangent[2], binormal[2], normal[2]));
+    
+	// Transform the light vector according to this matrix 
+	tangentLightDir[0] = normalize(rotation * lightDir); 
+	tangentLightDir[1] = normalize(rotation * lightDir1); 
+	// Invert the Y on the eye dir since we'll be using this to alter UVs and
+	// GL has Y inverted
+	tangentEyeDir = normalize(rotation * eyeDir) * vec3(1.0, -1.0, 1.0); 
+
+	tangentSpotDir[0] = normalize(rotation * -spotDirection.xyz);
+	tangentSpotDir[1] = normalize(rotation * -spotDirection1.xyz);	
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMappingVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,50 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 lightPosition; // object space 
+uniform vec3 eyePosition;   // object space 
+uniform mat4 worldViewProj; // not actually used but here for compat with HLSL
+
+varying vec3 oEyeDir;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oUv0;
+
+attribute vec3 normal;
+attribute vec3 tangent;
+attribute vec4 uv0;
+attribute vec4 position;
+
+/* Vertex program that moves light and eye vectors into texture tangent space at vertex */ 
+
+void main()
+{
+    // Calculate output position 
+	gl_Position = worldViewProj * position;
+
+    // Pass the main uvs straight through unchanged 
+    oUv0 = uv0;
+
+    vec3 lightDir = lightPosition.xyz - (position.xyz * lightPosition.w);
+
+	vec3 eyeDir = eyePosition - position.xyz; 
+    
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	// NB looks like nvidia cross params are BACKWARDS to what you'd expect
+	// this equates to NxT, not TxN
+	vec3 localbinormal = cross(tangent, normal);
+
+	// Form a rotation matrix out of the vectors, column major for glsl es 
+	mat3 TBN = mat3(vec3(tangent[0], localbinormal[0], normal[0]),
+						vec3(tangent[1], localbinormal[1], normal[1]),
+						vec3(tangent[2], localbinormal[2], normal[2]));
+    
+    // Transform the light vector according to this matrix 
+	oLightDir = normalize(TBN * lightDir); 
+	oEyeDir = normalize(TBN * eyeDir); 
+    oHalfAngle = normalize(oEyeDir + oLightDir);
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMapping_specular.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMapping_specular.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OffsetMapping_specular.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform vec4 scaleBias;
+uniform float exponent;
+uniform sampler2D normalHeightMap;
+
+varying vec3 tangentEyeDir;
+varying vec3 tangentLightDir[2];
+varying vec4 shadowUV[2];
+varying vec4 oUv0;
+
+vec4 lit(float NdotL, float NdotH, float m) {
+
+  float ambient = 1.0;
+  float diffuse = max(NdotL, 0.0);
+  float specular = step(0.0, NdotL) * max(NdotH * m, 0.0);
+
+  return vec4(ambient, diffuse, specular, 1.0);
+}
+
+vec3 expand(vec3 v)
+{
+	return (v - 0.5) * 2.0;
+}
+
+/*
+  Pixel Shader for doing bump mapping with parallax plus diffuse and specular lighting by masterfalcon
+*/
+void main()
+{
+	float height = texture2D(normalHeightMap, oUv0.xy).a;
+	float displacement = (height * scaleBias.x) + scaleBias.y;
+	vec2 newTexCoord = ((tangentEyeDir * displacement) + oUv0.xyz).xy;
+	vec3 bumpVec = expand(texture2D(normalHeightMap, newTexCoord).xyz);
+	vec3 N = normalize(bumpVec);
+
+	vec3 halfAngle = normalize(tangentEyeDir + tangentLightDir[0]); 
+	float NdotL = dot(normalize(tangentLightDir[0]), N);
+	float NdotH = dot(normalize(halfAngle), N); 
+
+	vec4 Lit = lit(NdotL, NdotH, exponent);
+	
+	gl_FragColor = lightDiffuse * Lit.y + lightSpecular * Lit.z;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OldMovieFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OldMovieFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OldMovieFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,58 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 oUv0;
+//varying vec2 uv1;
+
+uniform sampler2D RT;
+uniform sampler2D SplotchesTx;
+uniform sampler2D Texture2;
+uniform sampler2D SepiaTx;
+uniform float time_cycle_period;
+uniform float flicker;
+uniform float DirtFrequency;
+uniform vec3 luminance;
+uniform float frameJitter;
+uniform float lumiShift;
+
+vec2 calcSpriteAddr(vec2 texCoord, float DirtFrequency1, float period)
+{
+   return texCoord + texture2D(Texture2, vec2(period * DirtFrequency1, 0.0)).xy;
+}
+
+vec4 getSplotches(vec2 spriteAddr)
+{
+   // get sprite address into paged texture coords space
+   spriteAddr = spriteAddr / 6.3;
+   spriteAddr = spriteAddr - (spriteAddr / 33.3);
+
+   return texture2D(SplotchesTx, spriteAddr);
+}
+
+void main()
+{
+   // get sprite address
+   vec2 spriteAddr = calcSpriteAddr(oUv0, DirtFrequency, time_cycle_period);
+
+   // add some dark and light splotches to the film
+   vec4 splotches = getSplotches(spriteAddr);
+   vec4 specs = 1.0 - getSplotches(spriteAddr / 3.0);
+
+   // convert color to base luminance
+   vec4 base = texture2D(RT, oUv0 + vec2(0.0, spriteAddr.y * frameJitter));
+   float lumi = dot(base.rgb, luminance);
+   // randomly shift luminance
+   lumi -= spriteAddr.x * lumiShift;
+   // tone map luminance
+   base.rgb = texture2D(SepiaTx, vec2(lumi, 0.0)).rgb;
+
+   // calc flicker speed
+   float darken = fract(flicker * time_cycle_period);
+
+   // we want darken to cycle between 0.6 and 1.0
+   darken = abs(darken - 0.5) * 0.4 + 0.6;
+   // composite dirt onto film
+   gl_FragColor = base * splotches * darken + specs;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/OldTV.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/OldTV.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/OldTV.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,49 @@
+#version 300 es
+
+precision mediump int;
+precision mediump float;
+
+in vec4 pos;
+in vec2 oUv0;
+out vec4 fragColour;
+
+uniform sampler2D Image;
+uniform lowp sampler3D Rand;
+uniform lowp sampler3D Noise;
+uniform float distortionFreq;
+uniform float distortionScale;
+uniform float distortionRoll;
+uniform float interference;
+uniform float frameLimit;
+uniform float frameShape;
+uniform float frameSharpness;
+uniform float time_0_X;
+uniform float sin_time_0_X;
+
+void main()
+{
+   // Define a frame shape
+   float f = (1.0 - pos.x * pos.x) * (1.0 - pos.y * pos.y);
+   float frame = clamp(frameSharpness * (pow(f, frameShape) - frameLimit), 0.0, 1.0);
+
+   // Interference ... just a texture filled with rand()
+   float rand = texture(Rand, vec3(1.5 * pos.x, 1.5 * pos.y, time_0_X)).x - 0.2;
+
+   // Some signed noise for the distortion effect
+   float noisy = texture(Noise, vec3(0, 0.5 * pos.y, 0.1 * time_0_X)).x - 0.5;
+
+   // Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
+   float dst = fract(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
+   dst *= (1.0 - dst);
+   // Make sure distortion is highest in the center of the image
+   dst /= 1.0 + distortionScale * abs(pos.y);
+
+   // ... and finally distort
+   vec2 inUv = oUv0;
+   inUv.x += distortionScale * noisy * dst;
+   vec4 image = texture(Image, inUv);
+
+   // Combine frame, distorted image and interference
+   fragColour = frame * (interference * rand + image);
+}
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec4 colour;
+
+/*
+  Basic ambient lighting fragment program for GLSL ES
+*/
+void main()
+{
+	gl_FragColor = colour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughVP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughVP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/PassthroughVP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,13 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+attribute vec4 position;
+uniform mat4 worldViewProj;
+
+void main()																					
+{																							
+	//Transform the vertex (ModelViewProj matrix)											
+	gl_Position = position * worldViewProj;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/PosterizeFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/PosterizeFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/PosterizeFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,22 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+varying vec2 oUv0;
+
+void main()
+{
+	float nColors = 8.0;
+	float gamma = 0.6;
+
+	vec4 texCol = vec4(texture2D(RT, oUv0));
+	vec3 tc = texCol.xyz;
+	tc = pow(tc, vec3(gamma));
+	tc = tc * nColors;
+	tc = floor(tc);
+	tc = tc / nColors;
+	tc = pow(tc, vec3(1.0/gamma));
+	gl_FragColor = vec4(tc, texCol.w);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/Radial_Blur_FP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/Radial_Blur_FP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/Radial_Blur_FP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,62 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+//------------------------------------------------------
+//Radial_Blur_FP.cg
+//  Implements radial blur to be used with the compositor
+//  It's very dependent on screen resolution
+//------------------------------------------------------
+
+uniform sampler2D tex;
+uniform float sampleDist;
+uniform float sampleStrength;
+
+varying vec2 oUv0;
+
+void main()
+{
+	float samples[10];
+	
+	samples[0] = -0.08;
+	samples[1] = -0.05;
+	samples[2] = -0.03;
+	samples[3] = -0.02;
+	samples[4] = -0.01;
+	samples[5] = 0.01;
+	samples[6] = 0.02;
+	samples[7] = 0.03;
+	samples[8] = 0.05;
+	samples[9] = 0.08;
+	
+   //Vector from pixel to the center of the screen
+   vec2 dir = 0.5 - oUv0;
+
+   //Distance from pixel to the center (distant pixels have stronger effect)
+   //float dist = distance( vec2( 0.5, 0.5 ), texCoord );
+   float dist = sqrt( dir.x*dir.x + dir.y*dir.y );
+
+
+   //Now that we have dist, we can normlize vector
+   dir = normalize( dir );
+
+   //Save the color to be used later
+   vec4 color = texture2D( tex, oUv0 );
+   //Average the pixels going along the vector
+   vec4 sum = color;
+   for (int i = 0; i < 10; i++)
+   {
+      vec4 res=texture2D( tex, oUv0 + dir * samples[i] * sampleDist );
+      sum += res;
+   }
+   sum /= 11.0;
+
+   //Calculate amount of blur based on
+   //distance and a strength parameter
+   float t = dist * sampleStrength;
+   t = clamp( t, 0.0, 1.0 );//We need 0 <= t <= 1
+
+   //Blend the original color with the averaged pixels
+   gl_FragColor = mix( color, sum, t );
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ShaderInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ShaderInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ShaderInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,119 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+//Vertex input
+in vec4 vertex;
+in vec3 normal;
+in vec3 tangent;
+in vec4 uv0;
+in vec4 blendIndices;
+in vec4 blendWeights;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+//uniform mat4x3 worldMatrix3x4Array[80];
+#ifdef ST_DUAL_QUATERNION
+uniform vec4 worldDualQuaternion2x4Array[240];
+#else
+uniform vec4 worldMatrix3x4Array[240]; //240 = 80*3
+#endif
+
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	out vec2 depth;
+#else
+	out vec2 _uv0;
+	out vec3 oNormal;
+	out vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		out vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+vec4 worldPos;
+vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	int idx = int(blendIndices[0]) * 2;
+	mat2x4 blendDQ;
+	blendDQ[0] = worldDualQuaternion2x4Array[idx];
+	blendDQ[1] = worldDualQuaternion2x4Array[idx + 1];
+#ifdef BONE_TWO_WEIGHTS
+	int idx2 = int(blendIndices[1]) * 2;
+	mat2x4 blendDQ2;
+ 	blendDQ2[0] = worldDualQuaternion2x4Array[idx2];
+	blendDQ2[1] = worldDualQuaternion2x4Array[idx2 + 1];
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	int idx = int(blendIndices[0]) * 3;
+	worldMatrix[0] = worldMatrix3x4Array[idx];
+	worldMatrix[1] = worldMatrix3x4Array[idx + 1];
+	worldMatrix[2] = worldMatrix3x4Array[idx + 2];
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/SharpenEdgesFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/SharpenEdgesFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/SharpenEdgesFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,31 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+
+uniform vec2 vTexelSize;
+varying vec2 oUv0;
+//varying vec2 uv1;
+
+void main()
+{
+	vec2 usedTexelED[8];
+	usedTexelED[0] = vec2(-1, -1);
+	usedTexelED[1] = vec2(0, -1);
+	usedTexelED[2] = vec2(1, -1);
+	usedTexelED[3] = vec2(-1,  0);
+	usedTexelED[4] = vec2(1,  0);
+	usedTexelED[5] = vec2(-1,  1);
+	usedTexelED[6] = vec2(0,  1);
+	usedTexelED[7] = vec2(1,  1);
+
+    mediump vec4 tc = texture2D(RT, oUv0);
+	vec4 cAvgColor = vec4(9.0 * tc);
+
+	for(int t=0; t<8; t++)
+		cAvgColor -= texture2D(RT, oUv0 + vTexelSize * usedTexelED[t]);
+
+	gl_FragColor = cAvgColor;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ShowNormals.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ShowNormals.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ShowNormals.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,16 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+attribute vec4 position;
+attribute vec3 normal;
+
+varying vec4 oUv0;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	oUv0 = vec4(normal, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ShowTangents.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ShowTangents.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ShowTangents.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,16 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+attribute vec4 position;
+attribute vec3 tangent;
+
+varying vec4 oUv0;
+
+uniform mat4 worldViewProj;
+
+void main()
+{
+	gl_Position = worldViewProj * position;
+	oUv0 = vec4(tangent, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ShowUV.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ShowUV.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ShowUV.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,12 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+varying vec2 ambientUV;
+
+// Basic fragment program to display UV
+void main()
+{
+	// wrap values using fract
+	gl_FragColor = vec4(fract(ambientUV.x), fract(ambientUV.y), 0.0, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/ShowUVdir3D.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/ShowUVdir3D.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/ShowUVdir3D.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,14 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+varying vec4 oUv0;
+
+// Basic fragment program to display 3d uv
+void main()
+{
+	vec3 n = normalize(oUv0.xyz);
+	gl_FragColor = vec4(n.x, n.y, n.z, 1.0);
+}
+
+

Added: data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2_vp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2_vp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2_vp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,20 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2a_vp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2a_vp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex2a_vp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,21 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    oUv0 = uv0;
+    oUv1 = -vertex.xy;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex3_vp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex3_vp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex3_vp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,24 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec2 oUv2;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+    oUv2 = oUv0;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex4_vp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex4_vp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_Tex4_vp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 oUv0;
+varying vec2 oUv1;
+varying vec2 oUv2;
+varying vec2 oUv3;
+varying vec4 pos;
+
+void main()
+{
+	// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    gl_Position = worldViewProj * vertex;
+
+    // Convert to image-space
+    oUv0 = uv0;
+    oUv1 = oUv0;
+    oUv2 = oUv0;
+    oUv3 = oUv0;
+    pos = gl_Position;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_vp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_vp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/StdQuad_vp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,16 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform mat4 worldViewProj;
+attribute vec4 vertex;
+attribute vec2 uv0;
+varying vec2 uv;
+
+void main()
+{
+    gl_Position = worldViewProj * vertex;
+  	
+	uv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/SwizzleGP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/SwizzleGP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/SwizzleGP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,80 @@
+#version 120																				
+#extension GL_EXT_geometry_shader4 : enable													
+
+uniform vec4 origColor;																		
+uniform vec4 cloneColor;																	
+
+void main(void)																				
+{																							
+
+	//increment variable																	
+	int i;																					
+
+	/////////////////////////////////////////////////////////////							
+	//This example has two parts															
+	//	step a) draw the primitive pushed down the pipeline									
+	//		 there are gl_Vertices # of vertices											
+	//		 put the vertex value into gl_Position											
+	//		 use EmitVertex => 'create' a new vertex										
+	// 		use EndPrimitive to signal that you are done creating a primitive!				
+	//	step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)	
+	//		I just do the same loop, but swizzle the x and y values							
+	//	result => the line we want to draw, and the same line, but along the other axis		
+
+	//Pass-thru!																			
+	for(i=0; i< gl_VerticesIn; i++){														
+		gl_Position = gl_PositionIn[i];														
+		gl_FrontColor = origColor;															
+		EmitVertex();																		
+	}																						
+	EndPrimitive();																			
+	//New piece of geometry!  We just swizzle the x and y terms								
+	for(i=0; i< gl_VerticesIn; i++){														
+		gl_Position = gl_PositionIn[i];														
+		gl_Position.xy = gl_Position.yx;													
+		gl_FrontColor = cloneColor;															
+		EmitVertex();																		
+	}																						
+	EndPrimitive();																			
+
+}
+#version 120																				
+#extension GL_EXT_geometry_shader4 : enable													
+
+uniform vec4 origColor;																		
+uniform vec4 cloneColor;																	
+
+void main(void)																				
+{																							
+
+	//increment variable																	
+	int i;																					
+
+	/////////////////////////////////////////////////////////////							
+	//This example has two parts															
+	//	step a) draw the primitive pushed down the pipeline									
+	//		 there are gl_Vertices # of vertices											
+	//		 put the vertex value into gl_Position											
+	//		 use EmitVertex => 'create' a new vertex										
+	// 		use EndPrimitive to signal that you are done creating a primitive!				
+	//	step b) create a new piece of geometry (I.E. WHY WE ARE USING A GEOMETRY SHADER!)	
+	//		I just do the same loop, but swizzle the x and y values							
+	//	result => the line we want to draw, and the same line, but along the other axis		
+
+	//Pass-thru!																			
+	for(i=0; i< gl_VerticesIn; i++){														
+		gl_Position = gl_PositionIn[i];														
+		gl_FrontColor = origColor;															
+		EmitVertex();																		
+	}																						
+	EndPrimitive();																			
+	//New piece of geometry!  We just swizzle the x and y terms								
+	for(i=0; i< gl_VerticesIn; i++){														
+		gl_Position = gl_PositionIn[i];														
+		gl_Position.xy = gl_Position.yx;													
+		gl_FrontColor = cloneColor;															
+		EmitVertex();																		
+	}																						
+	EndPrimitive();																			
+
+}
\ No newline at end of file

Added: data/branches/Shader_HS18/programs/Example/GLSLES/TilingFP.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/TilingFP.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/TilingFP.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,36 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D RT;
+uniform float NumTiles;
+uniform float Threshold;
+varying vec2 uv0;
+
+void main()
+{
+	vec3 EdgeColor = vec3(0.7, 0.7, 0.7);
+
+    float size = 1.0/NumTiles;
+    vec2 Pbase = uv0 - mod(uv0, vec2(size));
+    vec2 PCenter = vec2(Pbase + (size/2.0));
+    vec2 st = (uv0 - Pbase)/size;
+    vec4 c1 = vec4(0.0);
+    vec4 c2 = vec4(0.0);
+    vec4 invOff = vec4((1.0-EdgeColor),1.0);
+    if (st.x > st.y) { c1 = invOff; }
+    float threshholdB =  1.0 - Threshold;
+    if (st.x > threshholdB) { c2 = c1; }
+    if (st.y > threshholdB) { c2 = c1; }
+    vec4 cBottom = c2;
+    c1 = vec4(0.0);
+    c2 = vec4(0.0);
+    if (st.x > st.y) { c1 = invOff; }
+    if (st.x < Threshold) { c2 = c1; }
+    if (st.y < Threshold) { c2 = c1; }
+    vec4 cTop = c2;
+    vec4 tileColor = vec4(texture2D(RT, PCenter));
+    vec4 result = tileColor + cTop - cBottom;
+    gl_FragColor = result;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/VTFInstancing.vert
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/VTFInstancing.vert	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/VTFInstancing.vert	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,115 @@
+//---------------------------------------------------------------------------
+//These materials/shaders are part of the NEW InstanceManager implementation
+//Written by Matias N. Goldberg ("dark_sylinc")
+//---------------------------------------------------------------------------
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+//Vertex input
+in vec4 vertex;
+in vec3 normal;
+
+#ifdef BONE_TWO_WEIGHTS
+	in vec4 blendWeights;
+#endif
+
+in vec4 uv0;
+in vec4 uv1;
+in vec4 uv2;
+in vec3 tangent;
+
+//Parameters
+uniform mat4 viewProjMatrix;
+uniform sampler2D matrixTexture;
+
+#if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER)
+uniform vec4 depthRange;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+uniform mat4 texViewProjMatrix;
+#endif
+
+//Output
+#if DEPTH_SHADOWCASTER
+	out vec2 depth;
+#else
+	out vec2 _uv0;
+	out vec3 oNormal;
+	out vec3 oVPos;
+	#if DEPTH_SHADOWRECEIVER
+		out vec4 oLightSpacePos;
+	#endif
+#endif
+
+vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ)
+{
+	vec3 blendPosition = position + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, position) + blendDQ[0].x*position);
+	vec3 trans = 2.0*(blendDQ[0].x*blendDQ[1].yzw - blendDQ[1].x*blendDQ[0].yzw + cross(blendDQ[0].yzw, blendDQ[1].yzw));
+	blendPosition += trans;
+
+	return blendPosition;
+}
+
+vec3 calculateBlendNormal(vec3 normal, mat2x4 blendDQ)
+{
+	return normal + 2.0*cross(blendDQ[0].yzw, cross(blendDQ[0].yzw, normal) + blendDQ[0].x*normal);
+}
+
+//---------------------------------------------
+//Main Vertex Shader
+//---------------------------------------------
+void main(void)
+{
+	vec4 worldPos;
+	vec3 worldNorm;
+
+#ifdef ST_DUAL_QUATERNION
+	mat2x4 blendDQ;	
+	blendDQ[0] = texture( matrixTexture, uv1.xy );
+	blendDQ[1] = texture( matrixTexture, uv1.zy );
+#ifdef BONE_TWO_WEIGHTS
+	mat2x4 blendDQ2;
+	blendDQ2[0] = texture( matrixTexture, uv2.xy );
+	blendDQ2[1] = texture( matrixTexture, uv2.zw );
+
+	//Accurate antipodality handling. For speed increase, remove the following line
+	if (dot(blendDQ[0], blendDQ2[0]) < 0.0) blendDQ2 *= -1.0;
+	
+	//Blend the dual quaternions based on the weights
+	blendDQ *= blendWeights.x;
+	blendDQ += blendWeights.y*blendDQ2;
+	//Normalize the resultant dual quaternion
+	blendDQ /= length(blendDQ[0]);
+#endif
+	worldPos = vec4(calculateBlendPosition(vertex.xyz, blendDQ), 1.0);
+	worldNorm = calculateBlendNormal(normal, blendDQ);
+#else
+	mat4 worldMatrix;
+	worldMatrix[0] = texture( matrixTexture, uv1.xy );
+	worldMatrix[1] = texture( matrixTexture, uv1.zw );
+	worldMatrix[2] = texture( matrixTexture, uv2.xy );
+	worldMatrix[3] = vec4( 0, 0, 0, 1 );
+
+	worldPos		= vertex * worldMatrix;
+	worldNorm		= normal * mat3(worldMatrix);
+#endif
+
+	//Transform the position
+	gl_Position			= viewProjMatrix * worldPos;
+	
+#if DEPTH_SHADOWCASTER
+	depth.x				= (gl_Position.z - depthRange.x) * depthRange.w;
+	depth.y				= depthRange.w;
+#else
+	_uv0		= uv0.xy;
+	oNormal		= worldNorm;
+	oVPos		= worldPos.xyz;
+
+	#if DEPTH_SHADOWRECEIVER
+		oLightSpacePos		= texViewProjMatrix * worldPos;
+		oLightSpacePos.z	= (oLightSpacePos.z - depthRange.x) * depthRange.w;
+	#endif
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,183 @@
+/* Copyright Torus Knot Software Ltd 2012-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+#include "shadows.cg"
+
+#define BIAS 0
+
+struct VS_OUT
+{
+    float4  pos			  : POSITION;   
+    float3  diffuseUV     : TEXCOORD0;  // xy = UV, z = fog/depth
+#if !SHADOWCASTER
+	float3	col			  : COLOR;
+#endif
+#if DEPTH_SHADOWCASTER
+	float	depth		  : TEXCOORD1;
+#endif
+#if DEPTH_SHADOWRECEIVER
+	float4 lightSpacePos0	: TEXCOORD2;
+	float4 lightSpacePos1	: TEXCOORD3;
+	float4 lightSpacePos2	: TEXCOORD4;
+#endif
+};
+
+VS_OUT main_vp(
+	float4   pos	: POSITION,     
+    float3   normal	: NORMAL,    
+    float4   uv0	: TEXCOORD0,
+
+   	uniform float4x4 worldViewProj,
+	uniform float4 lightPosition,
+	uniform float3 lightDiffuse
+#if FOG
+	, uniform float2 fogParams		// x = fog start, y = fog distance
+#endif
+#if DEPTH_SHADOWCASTER
+	, uniform float4 depthRange // x = min, y = max, z = range, w = 1/range
+#elif DEPTH_SHADOWRECEIVER
+	, uniform float4 depthRange0 // x = min, y = max, z = range, w = 1/range
+	, uniform float4 depthRange1 // x = min, y = max, z = range, w = 1/range
+	, uniform float4 depthRange2 // x = min, y = max, z = range, w = 1/range
+#endif
+#if DEPTH_SHADOWRECEIVER
+	, uniform float4x4 texWorldViewProjMatrix0
+	, uniform float4x4 texWorldViewProjMatrix1
+	, uniform float4x4 texWorldViewProjMatrix2
+#endif
+
+	)
+{
+    VS_OUT outp;
+
+    // project position to the screen
+    outp.pos = mul(worldViewProj, pos);
+
+#if !SHADOWCASTER
+	// Get object space light direction
+	float3 lightDir = normalize(lightPosition.xyz - (pos.xyz * lightPosition.w).xyz);
+	outp.col = lightDiffuse.xyz * max(dot(lightDir, normal.xyz), 0.0);
+#  if FOG
+    outp.diffuseUV.z = linearFog(outp.pos.z, fogParams.x, fogParams.y);
+#  endif
+
+#endif
+
+    // pass through other texcoords exactly as they were received
+    outp.diffuseUV.xy = uv0.xy;
+    
+
+#if DEPTH_SHADOWCASTER
+	outp.depth = (BIAS + outp.pos.z - depthRange.x) * depthRange.w;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+	// Calculate the position of vertex in light space
+	outp.lightSpacePos0 = mul(texWorldViewProjMatrix0, pos);
+	outp.lightSpacePos1 = mul(texWorldViewProjMatrix1, pos);
+	outp.lightSpacePos2 = mul(texWorldViewProjMatrix2, pos);
+
+	// make linear
+	outp.lightSpacePos0.z = (outp.lightSpacePos0.z - depthRange0.x) * depthRange0.w;
+	outp.lightSpacePos1.z = (outp.lightSpacePos1.z - depthRange1.x) * depthRange1.w;
+	outp.lightSpacePos2.z = (outp.lightSpacePos2.z - depthRange2.x) * depthRange2.w;
+
+	// pass cam depth
+	outp.diffuseUV.z = outp.pos.z;
+
+#endif
+
+    return outp;
+}
+
+
+float4 main_fp(
+	VS_OUT In,
+
+	uniform sampler2D diffuseMap	: register(s0),
+#if DEPTH_SHADOWRECEIVER
+	uniform sampler2D shadowMap0 : register(s1),
+	uniform sampler2D shadowMap1 : register(s2),
+	uniform sampler2D shadowMap2 : register(s3),
+#endif
+
+	uniform float3 materialAmbient
+	
+#if SHADOWCASTER
+	, uniform float3 shadowColour
+#endif
+#if FOG
+	, uniform float3 fogColour
+#endif
+#if DEPTH_SHADOWRECEIVER
+	, uniform float inverseShadowmapSize0
+	, uniform float inverseShadowmapSize1
+	, uniform float inverseShadowmapSize2
+	, uniform float4 pssmSplitPoints
+#endif
+
+	) : COLOR
+{
+
+    // look up the diffuse map layer
+    float4 texDiffuse = tex2D(diffuseMap, In.diffuseUV.xy);
+    
+#if SHADOWCASTER
+#  if DEPTH_SHADOWCASTER
+	// early-out with depth (we still include alpha for those cards that support it)
+	return float4(In.depth.xxx, 1);
+#  else
+	return float4(shadowColour.xyz, texDiffuse.a);
+#  endif
+
+#else
+    // compute the ambient contribution (pulled from the diffuse map)
+    float3 vAmbient = texDiffuse.xyz * materialAmbient.xyz;
+    float3 vColor3 = texDiffuse.rgb * In.col.rgb;
+
+#  if DEPTH_SHADOWRECEIVER
+	float camDepth = In.diffuseUV.z;
+	float shadow = calcPSSMDepthShadow(shadowMap0, shadowMap1, shadowMap2, 
+		In.lightSpacePos0, In.lightSpacePos1, In.lightSpacePos2,
+		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
+		pssmSplitPoints, camDepth);
+	vColor3 *= shadow;
+	/*
+	vAmbient = float3(0,0,0);
+	vColor3 = calcPSSMDebugShadow(shadowMap0, shadowMap1, shadowMap2, 
+		In.lightSpacePos0, In.lightSpacePos1, In.lightSpacePos2,
+		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
+		pssmSplitPoints, camDepth);
+	*/
+#  endif    
+
+	float4 vColor;
+    vColor = float4(vColor3 + vAmbient, texDiffuse.a);
+    
+#  if FOG
+    // if fog is active, interpolate between the unfogged color and the fog color
+    // based on vertex shader fog value
+    vColor.rgb = mix(vColor.rgb, fogColour, In.diffuseUV.z).rgb;
+#  endif
+
+    return vColor;
+#endif
+
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/depthshadowobjectVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,183 @@
+/* Copyright Torus Knot Software Ltd 2012-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+#include "shadows.cg"
+
+#define BIAS 0
+
+struct VS_OUT
+{
+    float4  pos			  : POSITION;   
+    float3  diffuseUV     : TEXCOORD0;  // xy = UV, z = fog/depth
+#if !SHADOWCASTER
+	float3	col			  : COLOR;
+#endif
+#if DEPTH_SHADOWCASTER
+	float	depth		  : TEXCOORD1;
+#endif
+#if DEPTH_SHADOWRECEIVER
+	float4 lightSpacePos0	: TEXCOORD2;
+	float4 lightSpacePos1	: TEXCOORD3;
+	float4 lightSpacePos2	: TEXCOORD4;
+#endif
+};
+
+VS_OUT main_vp(
+	float4   pos	: POSITION,     
+    float3   normal	: NORMAL,    
+    float4   uv0	: TEXCOORD0,
+
+   	uniform float4x4 worldViewProj,
+	uniform float4 lightPosition,
+	uniform float3 lightDiffuse
+#if FOG
+	, uniform float2 fogParams		// x = fog start, y = fog distance
+#endif
+#if DEPTH_SHADOWCASTER
+	, uniform float4 depthRange // x = min, y = max, z = range, w = 1/range
+#elif DEPTH_SHADOWRECEIVER
+	, uniform float4 depthRange0 // x = min, y = max, z = range, w = 1/range
+	, uniform float4 depthRange1 // x = min, y = max, z = range, w = 1/range
+	, uniform float4 depthRange2 // x = min, y = max, z = range, w = 1/range
+#endif
+#if DEPTH_SHADOWRECEIVER
+	, uniform float4x4 texWorldViewProjMatrix0
+	, uniform float4x4 texWorldViewProjMatrix1
+	, uniform float4x4 texWorldViewProjMatrix2
+#endif
+
+	)
+{
+    VS_OUT outp;
+
+    // project position to the screen
+    outp.pos = mul(worldViewProj, pos);
+
+#if !SHADOWCASTER
+	// Get object space light direction
+	float3 lightDir = normalize(lightPosition.xyz - (pos.xyz * lightPosition.w).xyz);
+	outp.col = lightDiffuse.xyz * max(dot(lightDir, normal.xyz), 0.0);
+#  if FOG
+    outp.diffuseUV.z = linearFog(outp.pos.z, fogParams.x, fogParams.y);
+#  endif
+
+#endif
+
+    // pass through other texcoords exactly as they were received
+    outp.diffuseUV.xy = uv0.xy;
+    
+
+#if DEPTH_SHADOWCASTER
+	outp.depth = (BIAS + outp.pos.z - depthRange.x) * depthRange.w;
+#endif
+
+#if DEPTH_SHADOWRECEIVER
+	// Calculate the position of vertex in light space
+	outp.lightSpacePos0 = mul(texWorldViewProjMatrix0, pos);
+	outp.lightSpacePos1 = mul(texWorldViewProjMatrix1, pos);
+	outp.lightSpacePos2 = mul(texWorldViewProjMatrix2, pos);
+
+	// make linear
+	outp.lightSpacePos0.z = (outp.lightSpacePos0.z - depthRange0.x) * depthRange0.w;
+	outp.lightSpacePos1.z = (outp.lightSpacePos1.z - depthRange1.x) * depthRange1.w;
+	outp.lightSpacePos2.z = (outp.lightSpacePos2.z - depthRange2.x) * depthRange2.w;
+
+	// pass cam depth
+	outp.diffuseUV.z = outp.pos.z;
+
+#endif
+
+    return outp;
+}
+
+
+float4 main_fp(
+	VS_OUT In,
+
+	uniform sampler2D diffuseMap	: register(s0),
+#if DEPTH_SHADOWRECEIVER
+	uniform sampler2D shadowMap0 : register(s1),
+	uniform sampler2D shadowMap1 : register(s2),
+	uniform sampler2D shadowMap2 : register(s3),
+#endif
+
+	uniform float3 materialAmbient
+	
+#if SHADOWCASTER
+	, uniform float3 shadowColour
+#endif
+#if FOG
+	, uniform float3 fogColour
+#endif
+#if DEPTH_SHADOWRECEIVER
+	, uniform float inverseShadowmapSize0
+	, uniform float inverseShadowmapSize1
+	, uniform float inverseShadowmapSize2
+	, uniform float4 pssmSplitPoints
+#endif
+
+	) : COLOR
+{
+
+    // look up the diffuse map layer
+    float4 texDiffuse = tex2D(diffuseMap, In.diffuseUV.xy);
+    
+#if SHADOWCASTER
+#  if DEPTH_SHADOWCASTER
+	// early-out with depth (we still include alpha for those cards that support it)
+	return float4(In.depth.xxx, 1);
+#  else
+	return float4(shadowColour.xyz, texDiffuse.a);
+#  endif
+
+#else
+    // compute the ambient contribution (pulled from the diffuse map)
+    float3 vAmbient = texDiffuse.xyz * materialAmbient.xyz;
+    float3 vColor3 = texDiffuse.rgb * In.col.rgb;
+
+#  if DEPTH_SHADOWRECEIVER
+	float camDepth = In.diffuseUV.z;
+	float shadow = calcPSSMDepthShadow(shadowMap0, shadowMap1, shadowMap2, 
+		In.lightSpacePos0, In.lightSpacePos1, In.lightSpacePos2,
+		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
+		pssmSplitPoints, camDepth);
+	vColor3 *= shadow;
+	/*
+	vAmbient = float3(0,0,0);
+	vColor3 = calcPSSMDebugShadow(shadowMap0, shadowMap1, shadowMap2, 
+		In.lightSpacePos0, In.lightSpacePos1, In.lightSpacePos2,
+		inverseShadowmapSize0, inverseShadowmapSize1, inverseShadowmapSize2,
+		pssmSplitPoints, camDepth);
+	*/
+#  endif    
+
+	float4 vColor;
+    vColor = float4(vColor3 + vAmbient, texDiffuse.a);
+    
+#  if FOG
+    // if fog is active, interpolate between the unfogged color and the fog color
+    // based on vertex shader fog value
+    vColor.rgb = mix(vColor.rgb, fogColour, In.diffuseUV.z).rgb;
+#  endif
+
+    return vColor;
+#endif
+
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdrFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdrFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdrFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,15 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D tex;
+varying vec4 ambientUV;
+
+void main ()
+{
+	gl_FragColor = vec4(texture2D(tex, ambientUV.xy));
+
+	// Blow out the light a bit
+	gl_FragColor *= 1.7;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_bloom.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdr_bloom.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdr_bloom.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,25 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D inRTT;
+
+uniform vec4 sampleOffsets[15];
+uniform vec4 sampleWeights[15];
+
+varying vec2 uv;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 1.0);
+	vec2 sampleUV;
+    
+    for( int i = 0; i < 15; i++ )
+    {
+        // Sample from adjacent points, 7 each side and central
+        sampleUV = uv + sampleOffsets[i].xy;
+        accum += sampleWeights[i] * texture2D(inRTT, sampleUV);
+    }
+    
+    gl_FragColor = accum;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale2x2luminence.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale2x2luminence.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale2x2luminence.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,26 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+
+void main()
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+	vec4 LUMINENCE_FACTOR  = vec4(0.27, 0.67, 0.06, 0.0);
+
+    // Get colour from source
+    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, -0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, 0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, 0.5));
+    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, -0.5));
+    
+	// Adjust the accumulated amount by lum factor
+	float lum = dot(accum, LUMINENCE_FACTOR);
+	// take average of 4 samples
+	lum *= 0.25;
+	gl_FragColor = vec4(lum, lum, lum, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,30 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D inRTT;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+
+    // Get colour from source
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+	gl_FragColor = accum;
+
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3brightpass.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3brightpass.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale3x3brightpass.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,64 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D inRTT;
+uniform sampler2D inLum;
+uniform vec2 texelSize;
+
+varying vec2 uv;
+const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
+
+const float MIDDLE_GREY = 0.72;
+const float FUDGE = 0.001;
+const float L_WHITE = 1.5;
+
+/** Tone mapping function 
+ at note Only affects rgb, not a
+ at param inColour The HDR colour
+ at param lum The scene lumninence 
+ at returns Tone mapped colour
+*/
+vec4 toneMap(in vec4 inColour, in float lum)
+{
+	// From Reinhard et al
+	// "Photographic Tone Reproduction for Digital Images"
+	
+	// Initial luminence scaling (equation 2)
+    inColour.rgb *= MIDDLE_GREY / (FUDGE + lum);
+
+	// Control white out (equation 4 nom)
+    inColour.rgb *= (1.0 + inColour.rgb / L_WHITE);
+
+	// Final mapping (equation 4 denom)
+	inColour.rgb /= (1.0 + inColour.rgb);
+	
+	return inColour;
+}
+
+void main(void)
+{
+    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
+
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
+    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
+    
+	// take average of 9 samples
+	accum *= 0.1111111111111111;
+
+    // Reduce bright and clamp
+    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
+
+	// Sample the luminence texture
+	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
+	
+	// Tone map result
+	gl_FragColor = toneMap(accum, lum.r);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_finalToneMapping.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/hdr_finalToneMapping.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/hdr_finalToneMapping.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,54 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D inRTT;
+uniform sampler2D inBloom;
+uniform sampler2D inLum;
+
+varying vec2 uv;
+
+const float MIDDLE_GREY = 0.72;
+const float FUDGE = 0.001;
+const float L_WHITE = 1.5;
+
+/** Tone mapping function 
+ at note Only affects rgb, not a
+ at param inColour The HDR colour
+ at param lum The scene lumninence 
+ at returns Tone mapped colour
+*/
+vec4 toneMap(in vec4 inColour, in float lum)
+{
+	// From Reinhard et al
+	// "Photographic Tone Reproduction for Digital Images"
+	
+	// Initial luminence scaling (equation 2)
+    inColour.rgb *= MIDDLE_GREY / (FUDGE + lum);
+
+	// Control white out (equation 4 nom)
+    inColour.rgb *= (1.0 + inColour.rgb / L_WHITE);
+
+	// Final mapping (equation 4 denom)
+	inColour.rgb /= (1.0 + inColour.rgb);
+	
+	return inColour;
+}
+
+void main(void)
+{
+	// Get main scene colour
+    vec4 sceneCol = texture2D(inRTT, uv);
+
+	// Get luminence value
+	vec4 lum = texture2D(inLum, vec2(0.5, 0.5));
+
+	// tone map this
+	vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r);
+	
+	// Get bloom colour
+    vec4 bloom = texture2D(inBloom, uv);
+
+	// Add scene & bloom
+	gl_FragColor = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/instancingVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/instancingVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/instancingVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,44 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+uniform mat4 worldMatrixArray[80];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 lightPos;
+uniform vec4 ambient;
+uniform vec4 lightDiffuseColour;
+
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 uv0;
+attribute float uv1;
+
+varying vec4 oColor_0;
+#if SHADOW_CASTER
+#else
+varying vec2 oTexcoord2_0;
+#endif
+
+void main()
+{
+	// transform by indexed matrix
+	vec4 transformedPos = vec4((worldMatrixArray[int(uv1)] * position).xyz, 1.0);
+
+	// view / projection
+	gl_Position = viewProjectionMatrix * transformedPos;
+
+#if SHADOW_CASTER
+	
+	oColor_0 = ambient;
+#else
+	oTexcoord2_0 = uv0.xy;
+
+	vec3 norm = mat3(worldMatrixArray[int(uv1)]) * normal;
+	
+	vec3 lightDir = 	normalize(
+		lightPos.xyz -  (transformedPos.xyz * lightPos.w));
+
+	oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour;
+#endif
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_quad.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_quad.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_quad.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,20 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D rt0;
+uniform sampler2D rt1;
+uniform sampler2D rt2;
+uniform sampler2D rt3;
+
+varying vec2 uv;
+
+void main(void)
+{
+    
+    //gl_FragColor = texture2D(rt0, uv);
+    gl_FragColor = texture2D(rt1, uv);
+    //gl_FragColor = texture2D(rt2, uv);
+    //gl_FragColor = texture2D(rt3, uv);
+	
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_scene.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_scene.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/mrttestfp_scene.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,21 @@
+#version 100
+precision mediump int;
+precision mediump float;
+
+uniform sampler2D tex0;
+varying vec4 uv0;
+
+void main()                    
+{
+	vec4 baseColour = texture2D(tex0, uv0.xy);
+
+	gl_FragData[0] = baseColour;
+
+//	gl_FragData[1] = baseColour * vec4(1, 0, 0, 1);
+
+//	float abs = (baseColour.r + baseColour.g + baseColour.b) * 0.333;
+//	gl_FragData[2] = vec4(abs, abs, abs, 1);
+	
+//	float invabs = 1.0 - abs;
+//	gl_FragData[3] = vec4(invabs, invabs, invabs, 1);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,13 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 oDepth;
+uniform vec4 pssmSplitPoints;
+
+void main()
+{
+	float finalDepth = oDepth.x / oDepth.y;
+	gl_FragColor = vec4(finalDepth, finalDepth, finalDepth, 1.0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/pssmCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,21 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+varying vec2 oDepth;
+uniform mat4 worldViewProjMatrix;
+attribute vec4 vertex;
+
+void main()
+{
+	// This is the view space position
+	gl_Position = worldViewProjMatrix * vertex;
+
+	// Depth info for the fragment.
+	oDepth.x = gl_Position.z;
+	oDepth.y = gl_Position.w;
+
+	// Clamp z to zero. seem to do the trick. :-/
+	//oPosition.z = max(oPosition.z, 0);
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmFp.glsles
===================================================================
Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverFp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverFp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverFp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,92 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+float shadowPCF(sampler2D shadowMap, vec4 shadowMapPos, vec2 offset)
+{
+	shadowMapPos = shadowMapPos / shadowMapPos.w;
+	vec2 uv = shadowMapPos.xy;
+	vec3 o = vec3(offset, -offset.x) * 0.3;
+
+	// Note: We using 2x2 PCF. Good enough and is a lot faster.
+	float c =	(shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
+
+	return c / 4.0;
+}
+
+uniform vec4 invShadowMapSize0;
+uniform vec4 invShadowMapSize1;
+uniform vec4 invShadowMapSize2;
+uniform vec4 pssmSplitPoints;
+uniform sampler2D diffuse;
+uniform sampler2D specular;
+uniform sampler2D normalMap;
+uniform sampler2D shadowMap0;
+uniform sampler2D shadowMap1;
+uniform sampler2D shadowMap2;
+uniform vec4 lightDiffuse;
+uniform vec4 lightSpecular;
+uniform vec4 ambient;
+
+varying vec4 oUv0;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oLightPosition0;
+varying vec4 oLightPosition1;
+varying vec4 oLightPosition2;
+varying vec3 oNormal;
+
+// to put it simply, this does 100% per pixel diffuse lighting
+void main()
+{
+	// calculate shadow
+	float shadowing = 1.0;
+	vec4 splitColour;
+	if (oUv0.z <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.1, 0.0, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap0, oLightPosition0, invShadowMapSize0.xy);
+	}
+	else if (oUv0.z <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0.0, 0.1, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap1, oLightPosition1, invShadowMapSize1.xy);
+	}
+	else
+	{
+		splitColour = vec4(0.1, 0.1, 0.0, 1.0);
+		shadowing = shadowPCF(shadowMap2, oLightPosition2, invShadowMapSize2.xy);
+	}
+
+	// retrieve normalised light vector, expand from range-compressed
+	vec3 lightVec = normalize(oLightDir);
+
+	// retrieve half angle and normalise through cube map
+	vec3 halfAngle = normalize(oHalfAngle);
+
+	// get diffuse colour
+	vec4 diffuseColour = texture2D(diffuse, oUv0.xy);
+
+	// specular
+	vec4 specularColour = texture2D(specular, oUv0.xy);
+	float shininess = specularColour.w;
+	specularColour.w = 1.0;
+
+	// calculate lit value.
+	float diffuseCoeff = max(dot(oNormal, lightVec), 0.0);
+	float specularCoeff = step(0.0, dot(oNormal, lightVec)) * max(dot(oNormal, halfAngle) * (shininess * 128.0), 0.0);
+	vec4 lighting;
+	lighting.y = diffuseCoeff * shadowing;
+	lighting.z = specularCoeff * shadowing;
+//	vec4 lighting = lit(dot(oNormal, lightVec), dot(oNormal, halfAngle), shininess * 128.0) * shadowing;
+
+	// final lighting with diffuse and spec
+	gl_FragColor = (diffuseColour * clamp(ambient + lightDiffuse * lighting.y, 0.0, 1.0)) + (lightSpecular * specularColour * lighting.z);
+	gl_FragColor.w = diffuseColour.w;
+
+	//oColour += splitColour;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/pssmReceiverVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,63 @@
+#version 100
+
+precision mediump int;
+precision mediump float;
+
+float shadowPCF(sampler2D shadowMap, vec4 shadowMapPos, vec2 offset)
+{
+	shadowMapPos = shadowMapPos / shadowMapPos.w;
+	vec2 uv = shadowMapPos.xy;
+	vec3 o = vec3(offset, -offset.x) * 0.3;
+
+	// Note: We using 2x2 PCF. Good enough and is a lot faster.
+	float c =	(shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
+	c +=		(shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
+
+	return c / 4.0;
+}
+
+uniform vec4 lightPosition;				// object space
+uniform vec3 eyePosition;					// object space
+uniform mat4 worldViewProjMatrix;
+uniform mat4 texWorldViewProjMatrix0;
+uniform mat4 texWorldViewProjMatrix1;
+uniform mat4 texWorldViewProjMatrix2;
+
+varying vec4 oUv0;
+varying vec3 oLightDir;
+varying vec3 oHalfAngle;
+varying vec4 oLightPosition0;
+varying vec4 oLightPosition1;
+varying vec4 oLightPosition2;
+varying vec3 oNormal;
+
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 uv0;
+
+void main()
+{
+	// Calculate output position
+	gl_Position = worldViewProjMatrix * position;
+
+	// Pass the main uvs straight through unchanged
+	oUv0.xy = uv0.xy;
+	oUv0.z = gl_Position.z;
+
+	// Calculate tangent space light vector
+	// Get object space light direction
+	oLightDir = normalize(lightPosition.xyz - (position * lightPosition.w).xyz);
+
+	// Calculate half-angle in tangent space
+	vec3 eyeDir = normalize(eyePosition - position.xyz);
+	oHalfAngle = normalize(eyeDir + oLightDir);	
+
+	// Calculate the position of vertex in light space
+	oLightPosition0 = texWorldViewProjMatrix0 * position;
+	oLightPosition1 = texWorldViewProjMatrix1 * position;
+	oLightPosition2 = texWorldViewProjMatrix2 * position;
+
+	oNormal = normal;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/pssmVp.glsles
===================================================================
Added: data/branches/Shader_HS18/programs/Example/GLSLES/shadows.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/shadows.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/shadows.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,150 @@
+/* Copyright Torus Knot Software Ltd 2012-2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+Adapted by Matias N. Goldberg (Dark Sylinc) to GLSL based on the Cg file shadows.cg
+*/
+
+#version 300 es
+precision mediump int;
+precision mediump float;
+
+// Simple PCF 
+// Number of samples in one dimension (square for total samples)
+#define NUM_SHADOW_SAMPLES_1D 2.0
+#define SHADOW_FILTER_SCALE 1.0
+
+#define SHADOW_SAMPLES NUM_SHADOW_SAMPLES_1D*NUM_SHADOW_SAMPLES_1D
+
+vec4 offsetSample(vec4 uv, vec2 offset, float invMapSize)
+{
+	return vec4(uv.xy + offset * invMapSize * uv.w, uv.z, uv.w);
+}
+
+float calcDepthShadow(sampler2DShadow shadowMap, vec4 uv, float invShadowMapSize)
+{
+	// 4-sample PCF
+	
+	float shadow = 0.0;
+	float offset = (NUM_SHADOW_SAMPLES_1D/2.0 - 0.5) * SHADOW_FILTER_SCALE;
+	for (float y = -offset; y <= offset; y += SHADOW_FILTER_SCALE)
+		for (float x = -offset; x <= offset; x += SHADOW_FILTER_SCALE)
+		{
+			float depth = textureProj(shadowMap, offsetSample(uv, vec2(x, y), invShadowMapSize));
+			if (depth >= 1.0 || depth >= uv.z)
+				shadow += 1.0;
+		}
+
+	shadow /= SHADOW_SAMPLES;
+
+	return shadow;
+}
+
+
+float calcSimpleShadow(sampler2DShadow shadowMap, vec4 shadowMapPos)
+{
+	return textureProj(shadowMap, shadowMapPos);
+}
+
+float calcPSSMDepthShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	float shadow;
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.3, 0.0, 0, 0);
+		shadow = calcDepthShadow(shadowMap0, lsPos0, invShadowmapSize0);
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0, 0.3, 0, 0);
+		shadow = calcDepthShadow(shadowMap1, lsPos1, invShadowmapSize1);
+	}
+	else
+	{
+		splitColour = vec4(0.0, 0.0, 0.3, 0);
+		shadow = calcDepthShadow(shadowMap2, lsPos2, invShadowmapSize2);
+	}
+
+	return shadow;
+}
+
+float calcPSSMSimpleShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	float shadow;
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		splitColour = vec4(0.3, 0.0, 0, 0);
+		shadow = calcSimpleShadow(shadowMap0, lsPos0);
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		splitColour = vec4(0, 0.3, 0, 0);
+		shadow = calcSimpleShadow(shadowMap1, lsPos1);
+	}
+	else
+	{
+		splitColour = vec4(0.0, 0.0, 0.3, 0);
+		shadow = calcSimpleShadow(shadowMap2, lsPos2);
+	}
+
+	return shadow;
+}
+
+
+
+vec3 calcPSSMDebugShadow(sampler2DShadow shadowMap0, sampler2DShadow shadowMap1, sampler2DShadow shadowMap2, 
+						   vec4 lsPos0, vec4 lsPos1, vec4 lsPos2,
+						   float invShadowmapSize0, float invShadowmapSize1, float invShadowmapSize2,
+						   vec4 pssmSplitPoints, float camDepth)
+{
+
+	vec4 splitColour;
+	// calculate shadow
+	if (camDepth <= pssmSplitPoints.y)
+	{
+		//splitColour = vec4(0.3, 0.0, 0, 0);
+		//splitColour = lsPos0 / lsPos0.w;
+		splitColour.rgb = vec3(textureProj(shadowMap0, lsPos0));
+	}
+	else if (camDepth <= pssmSplitPoints.z)
+	{
+		//splitColour = vec4(0, 0.3, 0, 0);
+		//splitColour = lsPos1 / lsPos1.w;
+		splitColour.rgb = vec3(textureProj(shadowMap1, lsPos1));
+	}
+	else
+	{
+		//splitColour = vec4(0.0, 0.0, 0.3, 0);
+		//splitColour = lsPos2 / lsPos2.w;
+		splitColour.rgb = vec3(textureProj(shadowMap2, lsPos2));
+	}
+
+	return splitColour.rgb;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsShadowCasterVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsShadowCasterVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsShadowCasterVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,46 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+/*
+  Two-weight-per-vertex hardware skinning, shadow caster pass
+*/
+
+attribute vec4 vertex;
+attribute vec4 uv0;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+// 3x4 matrix, passed as vec4's for compatibility with GL ES 2.0
+// Support 24 bones ie 24*3, but use 72 since our parser can pick that out for sizing
+uniform vec4 worldMatrix3x4Array[72];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 ambient;
+
+varying vec4 colour;
+
+void main()
+{
+	vec3 blendPos = vec3(0.0);
+
+	for (int bone = 0; bone < 2; ++bone)
+	{
+		// Perform matrix multiplication manually since no 3x4 matrices
+	    int idx = int(blendIndices[bone]) * 3;
+
+        // Unroll the loop manually
+		mat4 worldMatrix;
+		worldMatrix[0] = worldMatrix3x4Array[idx];
+		worldMatrix[1] = worldMatrix3x4Array[idx + 1];
+		worldMatrix[2] = worldMatrix3x4Array[idx + 2];
+		worldMatrix[3] = vec4(0.0);
+		// Now weight this into final 
+		blendPos += (vertex * worldMatrix).xyz * blendWeights[bone];
+	}
+
+	// Apply view / projection to position
+	gl_Position = viewProjectionMatrix * vec4(blendPos, 1.0);
+
+	colour = ambient;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsVp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsVp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsVp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,63 @@
+#version 100
+
+precision highp int;
+precision highp float;
+
+// Example GLSL ES program for skinning with two bone weights per vertex
+
+attribute vec4 vertex;
+attribute vec4 uv0;
+attribute vec3 normal;
+attribute vec4 blendIndices;
+attribute vec4 blendWeights;
+
+varying vec4 colour;
+varying vec4 uv;
+
+// 3x4 matrix, passed as vec4's for compatibility with GL ES 2.0
+// Support 24 bones ie 24*3, but use 72 since our parser can pick that out for sizing
+uniform vec4 worldMatrix3x4Array[72];
+uniform mat4 viewProjectionMatrix;
+uniform vec4 lightPos[2];
+uniform vec4 lightDiffuseColour[2];
+uniform vec4 ambient;
+uniform vec4 diffuse;
+
+void main()
+{
+	vec3 blendPos = vec3(0.0);
+	vec3 blendNorm = vec3(0.0);
+	
+	for (int bone = 0; bone < 2; ++bone)
+	{
+		// perform matrix multiplication manually since no 3x4 matrices
+	    int idx = int(blendIndices[bone]) * 3;
+
+		mat4 worldMatrix;
+		worldMatrix[0] = worldMatrix3x4Array[idx];
+		worldMatrix[1] = worldMatrix3x4Array[idx + 1];
+		worldMatrix[2] = worldMatrix3x4Array[idx + 2];
+		worldMatrix[3] = vec4(0.0);
+		// now weight this into final 
+	    float weight = blendWeights[bone];
+		blendPos += (vertex * worldMatrix).xyz * weight;
+
+		mat3 worldRotMatrix = mat3(worldMatrix[0].xyz, worldMatrix[1].xyz, worldMatrix[2].xyz);
+		blendNorm += (normal * worldRotMatrix) * weight;
+	}
+
+	// apply view / projection to position
+	gl_Position = viewProjectionMatrix * vec4(blendPos, 1.0);
+
+	// simple vertex lighting model
+	vec3 lightDir0 = normalize(
+		lightPos[0].xyz -  (blendPos.xyz * lightPos[0].w));
+	vec3 lightDir1 = normalize(
+		lightPos[1].xyz -  (blendPos.xyz * lightPos[1].w));
+
+  
+	colour = diffuse * (ambient
+		+ clamp(dot(lightDir0, blendNorm), 0.0, 1.0) * lightDiffuseColour[0]
+		+ clamp(dot(lightDir1, blendNorm), 0.0, 1.0) * lightDiffuseColour[1]);
+    uv = uv0;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcasterfp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcasterfp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcasterfp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,132 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// varianceshadowcasterfp.glsles
+//
+// Hamilton Chong
+// (c) 2006
+// GLSL ES by David Rogers
+//
+// This is an example fragment shader for shadow caster objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+// Define outputs from vertex shader.
+struct VertexOut
+{
+  float4 position   : POSITION;     // can't rely on access to this
+  float4 pos  	    : TEXCOORD0;    // position of fragment (in homogeneous coordinates)
+  float4 normal     : TEXCOORD1;    // un-normalized normal in object space
+  float4 modelPos   : TEXCOORD2;    // coordinates of model in object space at this point
+};
+
+struct FragmentOut
+{
+    float4 color  : COLOR0;
+};
+
+FragmentOut main( VertexOut        In,                     // fragment to process
+                  uniform float    uDepthOffset,           // offset amount (constant in eye space)
+                  uniform float4x4 uProjection             // projection matrix
+              )
+{
+    FragmentOut Out;
+
+    // compute the "normalized device coordinates" (no viewport applied yet)
+    float4 postproj = In.pos / In.pos.w;
+
+    // get the normalized normal of the geometry seen at this point
+    float4 normal = normalize(In.normal);
+
+
+    // -- Computing Depth Bias Quantities -----------------------------
+
+    // We now compute the change in z that would signify a push in the z direction
+    // by 1 unit in eye space.  Note that eye space z is related in a nonlinear way to
+    // screen space z, so this is not just a constant.  
+    // ddepth below is how much screen space z at this point would change for that push.
+    // NOTE: computation of ddepth likely differs from OpenGL's glPolygonOffset "unit"
+    //  computation, which is allowed to be vendor specific.
+    float4 dpwdz = mul(uProjection, float4(0.0, 0.0, 1.0, 0.0));
+    float4 dpdz = (dpwdz - (postproj * dpwdz.w)) / In.pos.w;
+    float  ddepth = abs(dpdz.z);
+
+    // -- End depth bias helper section --------------------------------   
+
+    // We now compute the depth of the fragment.  This is the actual depth value plus
+    // our depth bias.  The depth bias depends on how uncertain we are about the z value
+    // plus some constant push in the z direction.  The exact coefficients to use are
+    // up to you, but at least it should be somewhat intuitive now what the tradeoffs are.
+    float depthval = postproj.z /* + (0.5 * dzlen)*/ + (uDepthOffset * ddepth);
+    depthval = (0.5 * depthval) + 0.5; // put into [0,1] range instead of [-1,1] 
+
+    
+    Out.color = float4(depthval, depthval * depthval, depthval, 0.0);
+    return Out;
+}
+/////////////////////////////////////////////////////////////////////////////////
+//
+// varianceshadowcasterfp.glsles
+//
+// Hamilton Chong
+// (c) 2006
+// GLSL ES by David Rogers
+//
+// This is an example fragment shader for shadow caster objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+// Define outputs from vertex shader.
+struct VertexOut
+{
+  float4 position   : POSITION;     // can't rely on access to this
+  float4 pos  	    : TEXCOORD0;    // position of fragment (in homogeneous coordinates)
+  float4 normal     : TEXCOORD1;    // un-normalized normal in object space
+  float4 modelPos   : TEXCOORD2;    // coordinates of model in object space at this point
+};
+
+struct FragmentOut
+{
+    float4 color  : COLOR0;
+};
+
+FragmentOut main( VertexOut        In,                     // fragment to process
+                  uniform float    uDepthOffset,           // offset amount (constant in eye space)
+                  uniform float4x4 uProjection             // projection matrix
+              )
+{
+    FragmentOut Out;
+
+    // compute the "normalized device coordinates" (no viewport applied yet)
+    float4 postproj = In.pos / In.pos.w;
+
+    // get the normalized normal of the geometry seen at this point
+    float4 normal = normalize(In.normal);
+
+
+    // -- Computing Depth Bias Quantities -----------------------------
+
+    // We now compute the change in z that would signify a push in the z direction
+    // by 1 unit in eye space.  Note that eye space z is related in a nonlinear way to
+    // screen space z, so this is not just a constant.  
+    // ddepth below is how much screen space z at this point would change for that push.
+    // NOTE: computation of ddepth likely differs from OpenGL's glPolygonOffset "unit"
+    //  computation, which is allowed to be vendor specific.
+    float4 dpwdz = mul(uProjection, float4(0.0, 0.0, 1.0, 0.0));
+    float4 dpdz = (dpwdz - (postproj * dpwdz.w)) / In.pos.w;
+    float  ddepth = abs(dpdz.z);
+
+    // -- End depth bias helper section --------------------------------   
+
+    // We now compute the depth of the fragment.  This is the actual depth value plus
+    // our depth bias.  The depth bias depends on how uncertain we are about the z value
+    // plus some constant push in the z direction.  The exact coefficients to use are
+    // up to you, but at least it should be somewhat intuitive now what the tradeoffs are.
+    float depthval = postproj.z /* + (0.5 * dzlen)*/ + (uDepthOffset * ddepth);
+    depthval = (0.5 * depthval) + 0.5; // put into [0,1] range instead of [-1,1] 
+
+    
+    Out.color = float4(depthval, depthval * depthval, depthval, 0.0);
+    return Out;
+}

Added: data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcastervp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcastervp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcastervp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,88 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowcastervp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example vertex shader for shadow caster objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+// Define inputs from application.
+struct VertexIn
+{
+  float4 position : POSITION;       // vertex position in object space
+  float4 normal   : NORMAL;         // vertex normal in object space
+};
+
+// Define outputs from vertex shader.
+struct VertexOut
+{
+  float4 position   : POSITION;     // post projection position coordinates
+  float4 pos  	    : TEXCOORD0;    // ditto. Not all hardware allows access values bound to POSITION in fp.
+  float4 normal     : TEXCOORD1;    // normal in object space (to be interpolated)
+  float4 modelPos   : TEXCOORD2;    // position in object space (to be interpolated) 
+};
+
+VertexOut main( VertexIn         In,                   // vertex to process
+                uniform float4x4 uModelViewProjection  // model-view-projection matrix
+              )
+{
+    VertexOut Out;   // output data
+    
+    // Transform vertex position into post projective (homogenous screen) space.
+    Out.position = mul(uModelViewProjection, In.position);
+    Out.pos      = mul(uModelViewProjection, In.position);
+
+    // copy over data to interpolate using perspective correct interpolation
+    Out.normal = float4(In.normal.x, In.normal.y, In.normal.z, 0.0);
+    Out.modelPos = In.position;
+
+    return Out;
+}
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowcastervp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example vertex shader for shadow caster objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+// Define inputs from application.
+struct VertexIn
+{
+  float4 position : POSITION;       // vertex position in object space
+  float4 normal   : NORMAL;         // vertex normal in object space
+};
+
+// Define outputs from vertex shader.
+struct VertexOut
+{
+  float4 position   : POSITION;     // post projection position coordinates
+  float4 pos  	    : TEXCOORD0;    // ditto. Not all hardware allows access values bound to POSITION in fp.
+  float4 normal     : TEXCOORD1;    // normal in object space (to be interpolated)
+  float4 modelPos   : TEXCOORD2;    // position in object space (to be interpolated) 
+};
+
+VertexOut main( VertexIn         In,                   // vertex to process
+                uniform float4x4 uModelViewProjection  // model-view-projection matrix
+              )
+{
+    VertexOut Out;   // output data
+    
+    // Transform vertex position into post projective (homogenous screen) space.
+    Out.position = mul(uModelViewProjection, In.position);
+    Out.pos      = mul(uModelViewProjection, In.position);
+
+    // copy over data to interpolate using perspective correct interpolation
+    Out.normal = float4(In.normal.x, In.normal.y, In.normal.z, 0.0);
+    Out.modelPos = In.position;
+
+    return Out;
+}
\ No newline at end of file

Added: data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceiverfp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceiverfp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceiverfp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,214 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowreceiverfp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example fragment shader for shadow receiver objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+sampler2D ShadowMap : TEXUNIT0;
+
+// Define outputs from vertex shader.
+struct Vertex
+{
+  float4 position       : POSITION;     // fragment position in post projective space
+  float4 shadowCoord    : TEXCOORD0;    // fragment position in shadow map coordinates
+  float  diffuse        : TEXCOORD1;    // diffuse shading value
+};
+
+struct Fragment
+{
+    float4 color  : COLOR0;
+};
+
+Fragment main(Vertex        In, 
+              uniform float uSTexWidth,
+              uniform float uSTexHeight)
+{
+    Fragment Out;
+
+    // compute the shadow coordinates for texture lookup
+    // NOTE: texture_viewproj_matrix maps z into [0,1] range, not [-1,1], so
+    //  have to make sure shadow caster stores depth values with same convention.
+    float4 scoord = In.shadowCoord / In.shadowCoord.w;
+
+
+    // -- Bilinear Filtering of Sample -------------------------------------------- 
+
+    // One could use scoord.xy to look up the shadow map for depth testing, but
+    // we'll be implementing a simple "percentage closest filtering" algorithm instead.
+    // This mimics the behavior of turning on bilinear filtering on NVIDIA hardware
+    // when also performing shadow comparisons.  This causes bilinear filtering of
+    // depth tests.  Note that this is NOT the same as bilinear filtering the depth
+    // values and then doing the depth comparison.  The two operations are not 
+    // commutative.  PCF is explicitly about filtering the test values since
+    // testing filtered z values is often meaningless.  
+
+    // Real percentage closest filtering should sample from the entire footprint
+    // on the shadow map, not just seek the closest four sample points.  Such 
+    // an improvement is for future work.
+
+    
+    // NOTE: Assuming OpenGL convention for texture lookups with integers in centers.
+    //  DX convention is to have integers mark sample corners
+    float2 tcoord;
+    tcoord.x = (scoord.x * uSTexWidth) - 0.5;
+    tcoord.y = (scoord.y * uSTexHeight) - 0.5;
+    float x0 = floor(tcoord.x);
+    float x1 = ceil(tcoord.x);
+    float fracx = frac(tcoord.x);
+    float y0 = floor(tcoord.y);
+    float y1 = ceil(tcoord.y);
+    float fracy = frac(tcoord.y);
+    
+    // sample coordinates in [0,1]^2 domain
+    float2 t00, t01, t10, t11;
+    float invWidth  = 1.0 / uSTexWidth;
+    float invHeight = 1.0 / uSTexHeight;
+    t00 = float2((x0+0.5) * invWidth, (y0+0.5) * invHeight);
+    t10 = float2((x1+0.5) * invWidth, (y0+0.5) * invHeight);
+    t01 = float2((x0+0.5) * invWidth, (y1+0.5) * invHeight);
+    t11 = float2((x1+0.5) * invWidth, (y1+0.5) * invHeight);
+    
+    // grab the samples
+    float2 z00 = tex2D(ShadowMap, t00).xy;
+    float2 z01 = tex2D(ShadowMap, t01).xy;
+    float2 z10 = tex2D(ShadowMap, t10).xy;
+    float2 z11 = tex2D(ShadowMap, t11).xy;
+
+    // bilinear filter the sample data
+    float2 d0 = ((1.0 - fracx) * z00) + (fracx * z10);
+    float2 d1 = ((1.0 - fracx) * z01) + (fracx * z11);
+    float2 datum = ((1.0 - fracy) * d0) + (fracy * d1);
+
+    // -- Variance Shadow Mapping ---------------------------------------------------
+
+    float zVariance = datum.y - (datum.x * datum.x);
+    float zDeviation = scoord.z - datum.x;
+    zDeviation = (zDeviation < 0.0) ? 0.0 : zDeviation;
+    float visibility = zVariance / (zVariance + (zDeviation * zDeviation));
+    float ztest = (scoord.z < datum.x) ? 1.0:0.0;  // filtering depth ok, because used only for small variance
+    visibility = (zVariance > 0.0) ? visibility : ztest; // if variance too small, we get garbage
+    //0.0000001
+
+    // determine that all geometry within pixel border of shadow map (and outside) is lit
+    float filterBorder = max(invWidth, invHeight);
+    visibility = (all(abs(scoord.xy-0.5)<=0.5-filterBorder)) ? visibility : 1.0;
+
+    // ------------------------------------------------------------------------------
+
+    visibility *= In.diffuse;
+    Out.color = float4(visibility, visibility, visibility, 0.0);
+    return Out;
+}
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowreceiverfp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example fragment shader for shadow receiver objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+sampler2D ShadowMap : TEXUNIT0;
+
+// Define outputs from vertex shader.
+struct Vertex
+{
+  float4 position       : POSITION;     // fragment position in post projective space
+  float4 shadowCoord    : TEXCOORD0;    // fragment position in shadow map coordinates
+  float  diffuse        : TEXCOORD1;    // diffuse shading value
+};
+
+struct Fragment
+{
+    float4 color  : COLOR0;
+};
+
+Fragment main(Vertex        In, 
+              uniform float uSTexWidth,
+              uniform float uSTexHeight)
+{
+    Fragment Out;
+
+    // compute the shadow coordinates for texture lookup
+    // NOTE: texture_viewproj_matrix maps z into [0,1] range, not [-1,1], so
+    //  have to make sure shadow caster stores depth values with same convention.
+    float4 scoord = In.shadowCoord / In.shadowCoord.w;
+
+
+    // -- Bilinear Filtering of Sample -------------------------------------------- 
+
+    // One could use scoord.xy to look up the shadow map for depth testing, but
+    // we'll be implementing a simple "percentage closest filtering" algorithm instead.
+    // This mimics the behavior of turning on bilinear filtering on NVIDIA hardware
+    // when also performing shadow comparisons.  This causes bilinear filtering of
+    // depth tests.  Note that this is NOT the same as bilinear filtering the depth
+    // values and then doing the depth comparison.  The two operations are not 
+    // commutative.  PCF is explicitly about filtering the test values since
+    // testing filtered z values is often meaningless.  
+
+    // Real percentage closest filtering should sample from the entire footprint
+    // on the shadow map, not just seek the closest four sample points.  Such 
+    // an improvement is for future work.
+
+    
+    // NOTE: Assuming OpenGL convention for texture lookups with integers in centers.
+    //  DX convention is to have integers mark sample corners
+    float2 tcoord;
+    tcoord.x = (scoord.x * uSTexWidth) - 0.5;
+    tcoord.y = (scoord.y * uSTexHeight) - 0.5;
+    float x0 = floor(tcoord.x);
+    float x1 = ceil(tcoord.x);
+    float fracx = frac(tcoord.x);
+    float y0 = floor(tcoord.y);
+    float y1 = ceil(tcoord.y);
+    float fracy = frac(tcoord.y);
+    
+    // sample coordinates in [0,1]^2 domain
+    float2 t00, t01, t10, t11;
+    float invWidth  = 1.0 / uSTexWidth;
+    float invHeight = 1.0 / uSTexHeight;
+    t00 = float2((x0+0.5) * invWidth, (y0+0.5) * invHeight);
+    t10 = float2((x1+0.5) * invWidth, (y0+0.5) * invHeight);
+    t01 = float2((x0+0.5) * invWidth, (y1+0.5) * invHeight);
+    t11 = float2((x1+0.5) * invWidth, (y1+0.5) * invHeight);
+    
+    // grab the samples
+    float2 z00 = tex2D(ShadowMap, t00).xy;
+    float2 z01 = tex2D(ShadowMap, t01).xy;
+    float2 z10 = tex2D(ShadowMap, t10).xy;
+    float2 z11 = tex2D(ShadowMap, t11).xy;
+
+    // bilinear filter the sample data
+    float2 d0 = ((1.0 - fracx) * z00) + (fracx * z10);
+    float2 d1 = ((1.0 - fracx) * z01) + (fracx * z11);
+    float2 datum = ((1.0 - fracy) * d0) + (fracy * d1);
+
+    // -- Variance Shadow Mapping ---------------------------------------------------
+
+    float zVariance = datum.y - (datum.x * datum.x);
+    float zDeviation = scoord.z - datum.x;
+    zDeviation = (zDeviation < 0.0) ? 0.0 : zDeviation;
+    float visibility = zVariance / (zVariance + (zDeviation * zDeviation));
+    float ztest = (scoord.z < datum.x) ? 1.0:0.0;  // filtering depth ok, because used only for small variance
+    visibility = (zVariance > 0.0) ? visibility : ztest; // if variance too small, we get garbage
+    //0.0000001
+
+    // determine that all geometry within pixel border of shadow map (and outside) is lit
+    float filterBorder = max(invWidth, invHeight);
+    visibility = (all(abs(scoord.xy-0.5)<=0.5-filterBorder)) ? visibility : 1.0;
+
+    // ------------------------------------------------------------------------------
+
+    visibility *= In.diffuse;
+    Out.color = float4(visibility, visibility, visibility, 0.0);
+    return Out;
+}
\ No newline at end of file

Added: data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceivervp.glsles
===================================================================
--- data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceivervp.glsles	                        (rev 0)
+++ data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowreceivervp.glsles	2018-11-09 12:06:05 UTC (rev 12091)
@@ -0,0 +1,94 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowreceivervp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example vertex shader for shadow receiver objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+// Define inputs from application.
+struct VertexIn
+{
+  float4 position       : POSITION;     // vertex position in object space
+  float4 normal         : NORMAL;       // vertex normal in object space
+};
+
+// Define outputs from vertex shader.
+struct Vertex
+{
+  float4 position       : POSITION;     // vertex position in post projective space
+  float4 shadowCoord    : TEXCOORD0;    // vertex position in shadow map coordinates
+  float  diffuse        : TEXCOORD1;    // diffuse shading value
+};
+
+Vertex main(VertexIn         In,
+            uniform float4x4 uModelViewProjection,   // model-view-projection matrix
+            uniform float4   uLightPosition,         // light position in object space
+            uniform float4x4 uModel,                 // model matrix
+            uniform float4x4 uTextureViewProjection  // shadow map's view projection matrix
+            )
+{
+    Vertex Out;
+
+    // compute diffuse shading
+    float3 lightDirection = normalize(uLightPosition.xyz - In.position.xyz);
+    Out.diffuse = dot(In.normal.xyz, lightDirection);
+
+    // compute shadow map lookup coordinates
+    Out.shadowCoord = mul(uTextureViewProjection, mul(uModel, In.position));
+
+    // compute vertex's homogenous screen-space coordinates
+    Out.position = mul(uModelViewProjection, In.position);
+
+    return Out;
+}
+/////////////////////////////////////////////////////////////////////////////////
+//
+// shadowreceivervp.cg
+//
+// Hamilton Chong
+// (c) 2006
+//
+// This is an example vertex shader for shadow receiver objects.  
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+// Define inputs from application.
+struct VertexIn
+{
+  float4 position       : POSITION;     // vertex position in object space
+  float4 normal         : NORMAL;       // vertex normal in object space
+};
+
+// Define outputs from vertex shader.
+struct Vertex
+{
+  float4 position       : POSITION;     // vertex position in post projective space
+  float4 shadowCoord    : TEXCOORD0;    // vertex position in shadow map coordinates
+  float  diffuse        : TEXCOORD1;    // diffuse shading value
+};
+
+Vertex main(VertexIn         In,
+            uniform float4x4 uModelViewProjection,   // model-view-projection matrix
+            uniform float4   uLightPosition,         // light position in object space
+            uniform float4x4 uModel,                 // model matrix
+            uniform float4x4 uTextureViewProjection  // shadow map's view projection matrix
+            )
+{
+    Vertex Out;
+
+    // compute diffuse shading
+    float3 lightDirection = normalize(uLightPosition.xyz - In.position.xyz);
+    Out.diffuse = dot(In.normal.xyz, lightDirection);
+
+    // compute shadow map lookup coordinates
+    Out.shadowCoord = mul(uTextureViewProjection, mul(uModel, In.position));
+
+    // compute vertex's homogenous screen-space coordinates
+    Out.position = mul(uModelViewProjection, In.position);
+
+    return Out;
+}
\ No newline at end of file

Modified: data/branches/Shader_HS18/resources.oxr
===================================================================
--- data/branches/Shader_HS18/resources.oxr	2018-11-07 10:52:40 UTC (rev 12090)
+++ data/branches/Shader_HS18/resources.oxr	2018-11-09 12:06:05 UTC (rev 12091)
@@ -17,13 +17,15 @@
     <ResourceLocation path = "packs/skybox.zip"  archiveType = "Zip"/>
     
     <ResourceLocation path = "programs"         />
-    <ResourceLocation path = "programs/Cg"      />
     <ResourceLocation path = "programs/GLSL"    />
     <ResourceLocation path = "programs/Example" />
-    <ResourceLocation path = "programs/Example/Cg"      />
     <ResourceLocation path = "programs/Example/GLSL"    />
+    <ResourceLocation path = "programs/Example/GLSL120" />
     <ResourceLocation path = "programs/Example/GLSL150" />
+    <ResourceLocation path = "programs/Example/GLSL400" />
+    <ResourceLocation path = "programs/Example/GLSLES" />
 
+
     <ResourceLocation path = "gui/fonts"        />
     <ResourceLocation path = "gui/imagesets"    />
     <ResourceLocation path = "gui/looknfeels"   />



More information about the Orxonox-commit mailing list