Loading data from cloud storage
--------------------------------------------------------
Files on steam cloud:
No could files found!
Time: 13
--------------------------------------------------------
Version 1.10
-------- THE HPL ENGINE LOG ------------
Creating Engine Modules
--------------------------------------------------------
Creating job manager with 3 threads and 1024 jobs
Creating graphics module
Creating system module
Creating resource module
Creating input module
Creating sound module
Creating physics module
Creating ai module
Creating gui module
Creating generate module
Creating haptic module
Creating scene module
Creating script module
Creating lipsync module
--------------------------------------------------------
Initializing Resources Module
--------------------------------------------------------
Creating loader handlers
Creating resource managers
Adding loaders to handlers
--------------------------------------------------------
Initializing Graphics Module
--------------------------------------------------------
Init lowlevel graphics: -1x-1 bpp:32 rr: 60 fs:0 ms:0 driver: 0 cap:'SOMA Loading...' pos
-1x-1)
Available drivers:
(0) - 'windows'
(1) - 'dummy'
Creating window: (-1,-1) 1280 x 1024 - 32 bpp flags: 3
Setting display mode: 1280 x 1024 - 32 bpp 60 hz
Init Glew...OK
Setting up OpenGL
Vendor: ATI Technologies Inc.
Renderer: AMD RADEON HD 6450
Version: 4.1.10428 Compatibility Profile Context
Max texture image units: 16
Max texture coord units: 16
Max texture buffer size: 268435456
Max texture array slices: 8192
Max user clip planes: 8
Two sided stencil: 1
Vertex Buffer Object: 1
Anisotropic filtering: 1
Max Anisotropic degree: 16
Multisampling: 1
Texture compression: 1
Texture compression S3TC: 1
Texture compression 3DC: 1
Texture sRGB: 1
Geometry Instancing: 1
Auto generate MipMaps: 1
Render to texture: 1
Max draw buffers: 8
Max color render targets: 8
Packed depth-stencil: 1
Texture float: 1
GLSL Version: 4.10
ShaderModel 2: 1
ShaderModel 3: 1
ShaderModel 4: 1
Max vertex uniforms: 16384
Max fragment uniforms: 16384
OGL ATIFragmentShader: 1
Tesselation: 1
MultiBindTex: 0
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Skybox - Fragment Shader
[0007] //
[0008] // samples a cubemap skybox
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013] layout(binding = 0) uniform samplerCube aSkyMap;
[0014]
[0015] in vec4 px_vPosition;
[0016] in vec4 px_vTexCoord0;
[0017] in vec4 px_vColor;
[0018] layout(location = 0) out vec4 out_vColor;
[0019]
[0020] void main()
[0021] {
[0022] vec4 px_vPosition = gl_FragCoord;
[0023] bool px_bFrontFacing = gl_FrontFacing;
[0024] int px_lPrimitiveID = gl_PrimitiveID;
[0025]
[0026]
[0027] vec4 vFinalColor;
[0028]
[0029] ////////////////////
[0030] //Diffuse
[0031] vFinalColor = texture(aSkyMap, px_vTexCoord0.xyz);
[0032]
[0033] //Convert color to linear space if needed
[0034]
[0035] vFinalColor.rgb = pow(vFinalColor.rgb, vec3(2.2));
[0036]
[0037]
[0038]
[0039] // Multiply with 8.0 to increase precision
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:13: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 1 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Heat map a greyscale value
[0007] //
[0008] // A basic fragment with little fancy stuff.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011] //////////////
[0012] // TEXTURES
[0013] layout(binding = 0) uniform sampler2D aComplexityMap;
[0014] layout(binding = 1) uniform sampler2D aSceneMap;
[0015]
[0016] in vec4 px_vPosition;
[0017] in vec4 px_vTexCoord0;
[0018] layout(location = 0) out vec4 out_vColor;
[0019]
[0020] void main()
[0021] {
[0022] vec4 px_vPosition = gl_FragCoord;
[0023] bool px_bFrontFacing = gl_FrontFacing;
[0024] int px_lPrimitiveID = gl_PrimitiveID;
[0025]
[0026]
[0027] float fComplexity = texture(aComplexityMap, px_vTexCoord0.xy).x;
[0028] vec4 vColor = texture(aSceneMap, px_vTexCoord0.xy);
[0029]
[0030] vec4 vFinalColor = vec4(0,0,0,0.5);
[0031]
[0032] if(fComplexity > 1e-4f)
[0033] {
[0034] /////////////
[0035] // Fade from green to red, where green is good and red is bad
[0036] vFinalColor = mix(vec4(0,1,0,0), vec4(1, 0, 0, 0), min(1, fComplexity));
[0037]
[0038] float fLength = length(vFinalColor);
[0039] vFinalColor /= fLength;
[0040]
[0041] vFinalColor = vFinalColor * vFinalColor;
[0042] vFinalColor *= 8.0f;
[0043]
[0044] vFinalColor.a = 0.1 + fComplexity * 0.75f;
[0045] }
[0046]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:13: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:14: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 2 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078]
[0079] in vec4 px_vPosition;
[0080] in vec4 px_vTexCoord0;
[0081] layout(location = 0) out vec4 out_vColor;
[0082]
[0083] void main()
[0084] {
[0085] vec4 px_vPosition = gl_FragCoord;
[0086] bool px_bFrontFacing = gl_FrontFacing;
[0087] int px_lPrimitiveID = gl_PrimitiveID;
[0088]
[0089]
[0090] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0091] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0092] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0093]
[0094]
[0095] float fDepth = vNormalVal.w;
[0096] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0097] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0098] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0099]
[0100] //Convert color to linear space if needed
[0101]
[0102]
[0103] /////////////////////////////////
[0104] //Unpack normal and normalize (if needed)
[0105] vec3 vNormal = vNormalVal.xyz;
[0106]
[0107] ///////////////////////////////
[0108] // Calculate color, multiply with 8.0 to increase precision
[0109] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0110] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0111]
[0112]
[0113] out_vColor.xyz = vColorVal.xyz * vLightColor * 8.0;
[0114]
[0115]
[0116] out_vColor.xyz *= avFogColor.xyz;
[0117]
[0118]
[0119]
[0120]
[0121] ////////////////
[0122] // Falloff
[0123] vBox = abs(vBox);
[0124]
[0125] //////////////
[0126] // Get the spherical and box falloff
[0127] float fSphereFalloff = length(vBox);
[0128]
[0129] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0130] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0131] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0132] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0133]
[0134] //////////
[0135] // Perform smoothstep and add spherical and box togehter
[0136] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0137] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0138] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0139] vFalloff.xz *= vFalloff.xz;
[0140]
[0141] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0142] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0143]
[0144]
[0145] out_vColor.xyz *= fFalloff * fFalloff;
[0146] out_vColor.w = fFalloff;
[0147]
[0148]
[0149]
[0150] }
[0151]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078] vec3 GetSH(vec3 avDir)
[0079] {
[0080] vec3 vCoeff0 = avDir;
[0081] vec3 vCoeff1 = avDir * avDir.yzx;
[0082] vec3 vCoeff2 = avDir * avDir;
[0083]
[0084] vec3 vSH = avBand[0];
[0085]
[0086] vSH += avBand[1] * vCoeff0.y;
[0087] vSH += avBand[2] * vCoeff0.z;
[0088] vSH += avBand[3] * vCoeff0.x;
[0089]
[0090] vSH += avBand[4] * vCoeff1.x;
[0091] vSH += avBand[5] * vCoeff1.y;
[0092] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0093] vSH += avBand[7] * vCoeff1.z;
[0094] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0095]
[0096] return vSH;
[0097] }
[0098]
[0099] vec3 GetReflectedSH(vec3 avDir, float afSpecularPow)
[0100] {
[0101] vec3 vRoughness = clamp((vec3(0.5, 0.75, 1.0) - vec3(afSpecularPow)) * 4.0, vec3(0.0), vec3(1.0));
[0102]
[0103] vec3 vCoeff0 = avDir * vRoughness.y;
[0104] vec3 vCoeff1 = avDir * avDir.yzx * vRoughness.z;
[0105] vec3 vCoeff2 = avDir * avDir * vRoughness.z;
[0106]
[0107] vec3 vSH = avBand[0] * vRoughness.x;
[0108]
[0109] vSH += avBand[1] * vCoeff0.y;
[0110] vSH += avBand[2] * vCoeff0.z;
[0111] vSH += avBand[3] * vCoeff0.x;
[0112]
[0113] vSH += avBand[4] * vCoeff1.x;
[0114] vSH += avBand[5] * vCoeff1.y;
[0115] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0116] vSH += avBand[7] * vCoeff1.z;
[0117] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0118]
[0119] return vSH;
[0120] }
[0121]
[0122]
[0123] in vec4 px_vPosition;
[0124] in vec4 px_vTexCoord0;
[0125] layout(location = 0) out vec4 out_vColor;
[0126]
[0127] void main()
[0128] {
[0129] vec4 px_vPosition = gl_FragCoord;
[0130] bool px_bFrontFacing = gl_FrontFacing;
[0131] int px_lPrimitiveID = gl_PrimitiveID;
[0132]
[0133]
[0134] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0135] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0136] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0137]
[0138] vec4 vSpecVal = texture(aSpecularMap, vMapCoords);
[0139]
[0140]
[0141] float fDepth = vNormalVal.w;
[0142] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0143] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0144] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0145]
[0146] //Convert color to linear space if needed
[0147]
[0148]
[0149] /////////////////////////////////
[0150] //Unpack normal and normalize (if needed)
[0151] vec3 vNormal = vNormalVal.xyz;
[0152]
[0153] ///////////////////////////////
[0154] // Calculate color, multiply with 8.0 to increase precision
[0155] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0156] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0157]
[0158]
[0159] ////////////////
[0160] // Caluclate SH color
[0161] vec3 vWorldNormal = ((a_mtxInvView) * (vec4(vNormal,0.0))).xyz;
[0162] vWorldView = normalize(vWorldView);
[0163] vec3 vReflected = reflect(vWorldView, vWorldNormal);
[0164]
[0165] float fSpecularMul = pow(0.5 + dot(vReflected, vWorldView) * 0.5, 1.0 + vSpecVal.a * 3.0) * (3.0 / (2.6 - vSpecVal.a * 0.9));
[0166]
[0167] vWorldNormal = normalize(vWorldNormal +vBox * 0.25); //slightly skew the normal toward the edge of the box for more detail
[0168]
[0169] vec3 vSH = GetSH(vWorldNormal);
[0170] vec3 vSHSpec = GetReflectedSH(vReflected, vSpecVal.a) * fSpecularMul;
[0171]
[0172] out_vColor.xyz = (max(vec3(0.0), vSH) * vColorVal.xyz +
[0173] max(vec3(0.0), vSHSpec) * vSpecVal.xyz) * vLightColor * 8.0;
[0174]
[0175]
[0176]
[0177] ////////////////
[0178] // Falloff
[0179] vBox = abs(vBox);
[0180]
[0181] //////////////
[0182] // Get the spherical and box falloff
[0183] float fSphereFalloff = length(vBox);
[0184]
[0185] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0186] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0187] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0188] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0189]
[0190] //////////
[0191] // Perform smoothstep and add spherical and box togehter
[0192] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0193] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0194] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0195] vFalloff.xz *= vFalloff.xz;
[0196]
[0197] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0198] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0199]
[0200]
[0201] out_vColor.xyz *= fFalloff * fFalloff;
[0202] out_vColor.w = fFalloff;
[0203]
[0204]
[0205]
[0206] }
[0207]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078]
[0079] in vec4 px_vPosition;
[0080] in vec4 px_vTexCoord0;
[0081] layout(location = 0) out vec4 out_vColor;
[0082]
[0083] void main()
[0084] {
[0085] vec4 px_vPosition = gl_FragCoord;
[0086] bool px_bFrontFacing = gl_FrontFacing;
[0087] int px_lPrimitiveID = gl_PrimitiveID;
[0088]
[0089]
[0090] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0091] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0092] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0093]
[0094]
[0095] float fDepth = vNormalVal.w;
[0096] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0097] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0098] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0099]
[0100] //Convert color to linear space if needed
[0101]
[0102]
[0103] /////////////////////////////////
[0104] //Unpack normal and normalize (if needed)
[0105] vec3 vNormal = vNormalVal.xyz;
[0106]
[0107] ///////////////////////////////
[0108] // Calculate color, multiply with 8.0 to increase precision
[0109] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0110] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0111]
[0112]
[0113] out_vColor.xyz = vColorVal.xyz * vLightColor * 8.0;
[0114]
[0115]
[0116] out_vColor.xyz *= avFogColor.xyz;
[0117]
[0118]
[0119]
[0120]
[0121] ////////////////
[0122] // Falloff
[0123] vBox = abs(vBox);
[0124]
[0125] //////////////
[0126] // Get the spherical and box falloff
[0127] float fSphereFalloff = length(vBox);
[0128]
[0129] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0130] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0131] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0132] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0133]
[0134] //////////
[0135] // Perform smoothstep and add spherical and box togehter
[0136] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0137] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0138] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0139] vFalloff.xz *= vFalloff.xz;
[0140]
[0141] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0142] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0143]
[0144]
[0145] out_vColor.xyz *= fFalloff;
[0146] out_vColor.w = 0;
[0147]
[0148]
[0149]
[0150] }
[0151]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078] vec3 GetSH(vec3 avDir)
[0079] {
[0080] vec3 vCoeff0 = avDir;
[0081] vec3 vCoeff1 = avDir * avDir.yzx;
[0082] vec3 vCoeff2 = avDir * avDir;
[0083]
[0084] vec3 vSH = avBand[0];
[0085]
[0086] vSH += avBand[1] * vCoeff0.y;
[0087] vSH += avBand[2] * vCoeff0.z;
[0088] vSH += avBand[3] * vCoeff0.x;
[0089]
[0090] vSH += avBand[4] * vCoeff1.x;
[0091] vSH += avBand[5] * vCoeff1.y;
[0092] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0093] vSH += avBand[7] * vCoeff1.z;
[0094] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0095]
[0096] return vSH;
[0097] }
[0098]
[0099] vec3 GetReflectedSH(vec3 avDir, float afSpecularPow)
[0100] {
[0101] vec3 vRoughness = clamp((vec3(0.5, 0.75, 1.0) - vec3(afSpecularPow)) * 4.0, vec3(0.0), vec3(1.0));
[0102]
[0103] vec3 vCoeff0 = avDir * vRoughness.y;
[0104] vec3 vCoeff1 = avDir * avDir.yzx * vRoughness.z;
[0105] vec3 vCoeff2 = avDir * avDir * vRoughness.z;
[0106]
[0107] vec3 vSH = avBand[0] * vRoughness.x;
[0108]
[0109] vSH += avBand[1] * vCoeff0.y;
[0110] vSH += avBand[2] * vCoeff0.z;
[0111] vSH += avBand[3] * vCoeff0.x;
[0112]
[0113] vSH += avBand[4] * vCoeff1.x;
[0114] vSH += avBand[5] * vCoeff1.y;
[0115] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0116] vSH += avBand[7] * vCoeff1.z;
[0117] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0118]
[0119] return vSH;
[0120] }
[0121]
[0122]
[0123] in vec4 px_vPosition;
[0124] in vec4 px_vTexCoord0;
[0125] layout(location = 0) out vec4 out_vColor;
[0126]
[0127] void main()
[0128] {
[0129] vec4 px_vPosition = gl_FragCoord;
[0130] bool px_bFrontFacing = gl_FrontFacing;
[0131] int px_lPrimitiveID = gl_PrimitiveID;
[0132]
[0133]
[0134] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0135] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0136] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0137]
[0138] vec4 vSpecVal = texture(aSpecularMap, vMapCoords);
[0139]
[0140]
[0141] float fDepth = vNormalVal.w;
[0142] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0143] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0144] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0145]
[0146] //Convert color to linear space if needed
[0147]
[0148]
[0149] /////////////////////////////////
[0150] //Unpack normal and normalize (if needed)
[0151] vec3 vNormal = vNormalVal.xyz;
[0152]
[0153] ///////////////////////////////
[0154] // Calculate color, multiply with 8.0 to increase precision
[0155] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0156] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0157]
[0158]
[0159] ////////////////
[0160] // Caluclate SH color
[0161] vec3 vWorldNormal = ((a_mtxInvView) * (vec4(vNormal,0.0))).xyz;
[0162] vWorldView = normalize(vWorldView);
[0163] vec3 vReflected = reflect(vWorldView, vWorldNormal);
[0164]
[0165] float fSpecularMul = pow(0.5 + dot(vReflected, vWorldView) * 0.5, 1.0 + vSpecVal.a * 3.0) * (3.0 / (2.6 - vSpecVal.a * 0.9));
[0166]
[0167] vWorldNormal = normalize(vWorldNormal +vBox * 0.25); //slightly skew the normal toward the edge of the box for more detail
[0168]
[0169] vec3 vSH = GetSH(vWorldNormal);
[0170] vec3 vSHSpec = GetReflectedSH(vReflected, vSpecVal.a) * fSpecularMul;
[0171]
[0172] out_vColor.xyz = (max(vec3(0.0), vSH) * vColorVal.xyz +
[0173] max(vec3(0.0), vSHSpec) * vSpecVal.xyz) * vLightColor * 8.0;
[0174]
[0175]
[0176]
[0177] ////////////////
[0178] // Falloff
[0179] vBox = abs(vBox);
[0180]
[0181] //////////////
[0182] // Get the spherical and box falloff
[0183] float fSphereFalloff = length(vBox);
[0184]
[0185] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0186] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0187] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0188] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0189]
[0190] //////////
[0191] // Perform smoothstep and add spherical and box togehter
[0192] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0193] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0194] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0195] vFalloff.xz *= vFalloff.xz;
[0196]
[0197] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0198] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0199]
[0200]
[0201] out_vColor.xyz *= fFalloff;
[0202] out_vColor.w = 0;
[0203]
[0204]
[0205]
[0206] }
[0207]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078]
[0079] in vec4 px_vPosition;
[0080] in vec4 px_vTexCoord0;
[0081] layout(location = 0) out vec4 out_vColor;
[0082]
[0083] void main()
[0084] {
[0085] vec4 px_vPosition = gl_FragCoord;
[0086] bool px_bFrontFacing = gl_FrontFacing;
[0087] int px_lPrimitiveID = gl_PrimitiveID;
[0088]
[0089]
[0090] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0091] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0092] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0093]
[0094]
[0095] float fDepth = vNormalVal.w;
[0096] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0097] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0098] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0099]
[0100] //Convert color to linear space if needed
[0101]
[0102]
[0103] /////////////////////////////////
[0104] //Unpack normal and normalize (if needed)
[0105] vec3 vNormal = vNormalVal.xyz;
[0106]
[0107] ///////////////////////////////
[0108] // Calculate color, multiply with 8.0 to increase precision
[0109] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0110] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0111]
[0112]
[0113] out_vColor.xyz = vColorVal.xyz * vLightColor * 8.0;
[0114]
[0115]
[0116] out_vColor.xyz *= avFogColor.xyz;
[0117]
[0118]
[0119]
[0120]
[0121] ////////////////
[0122] // Falloff
[0123] vBox = abs(vBox);
[0124]
[0125] //////////////
[0126] // Get the spherical and box falloff
[0127] float fSphereFalloff = length(vBox);
[0128]
[0129] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0130] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0131] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0132] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0133]
[0134] //////////
[0135] // Perform smoothstep and add spherical and box togehter
[0136] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0137] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0138] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0139] vFalloff.xz *= vFalloff.xz;
[0140]
[0141] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0142] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0143]
[0144]
[0145] out_vColor.xyz *= fFalloff * fWeight;
[0146] out_vColor.w = fWeight * afWeight;
[0147]
[0148]
[0149]
[0150] }
[0151]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] // BACKWARD COMBATABLITY FOR NOW
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] ////////////////////
[0048] //Textures
[0049] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0050] layout(binding = 1) uniform sampler2D aNormalMap;
[0051] layout(binding = 2) uniform sampler2D aSpecularMap;
[0052]
[0053] ////////////////////
[0054] //Uniform varaibles
[0055] uniform vec3 avAmbientColorSky;
[0056] uniform vec3 avAmbientColorGround;
[0057]
[0058] uniform vec4 avScreenToFarPlane;
[0059] uniform float afNegFarPlane;
[0060] uniform vec2 avInvScreenSize;
[0061]
[0062] uniform vec3 avBoxCenter;
[0063] uniform vec3 avBoxExtent;
[0064] uniform float afFalloff;
[0065] uniform float afBevel;
[0066] uniform float afWeight;
[0067]
[0068] uniform vec3 avViewSpaceUp;
[0069]
[0070] uniform mat4 a_mtxInvView;
[0071] uniform vec3 avBand[9];
[0072]
[0073]
[0074] uniform vec4 avFogColor;
[0075]
[0076]
[0077]
[0078] vec3 GetSH(vec3 avDir)
[0079] {
[0080] vec3 vCoeff0 = avDir;
[0081] vec3 vCoeff1 = avDir * avDir.yzx;
[0082] vec3 vCoeff2 = avDir * avDir;
[0083]
[0084] vec3 vSH = avBand[0];
[0085]
[0086] vSH += avBand[1] * vCoeff0.y;
[0087] vSH += avBand[2] * vCoeff0.z;
[0088] vSH += avBand[3] * vCoeff0.x;
[0089]
[0090] vSH += avBand[4] * vCoeff1.x;
[0091] vSH += avBand[5] * vCoeff1.y;
[0092] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0093] vSH += avBand[7] * vCoeff1.z;
[0094] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0095]
[0096] return vSH;
[0097] }
[0098]
[0099] vec3 GetReflectedSH(vec3 avDir, float afSpecularPow)
[0100] {
[0101] vec3 vRoughness = clamp((vec3(0.5, 0.75, 1.0) - vec3(afSpecularPow)) * 4.0, vec3(0.0), vec3(1.0));
[0102]
[0103] vec3 vCoeff0 = avDir * vRoughness.y;
[0104] vec3 vCoeff1 = avDir * avDir.yzx * vRoughness.z;
[0105] vec3 vCoeff2 = avDir * avDir * vRoughness.z;
[0106]
[0107] vec3 vSH = avBand[0] * vRoughness.x;
[0108]
[0109] vSH += avBand[1] * vCoeff0.y;
[0110] vSH += avBand[2] * vCoeff0.z;
[0111] vSH += avBand[3] * vCoeff0.x;
[0112]
[0113] vSH += avBand[4] * vCoeff1.x;
[0114] vSH += avBand[5] * vCoeff1.y;
[0115] vSH += avBand[6] * (3.0 * vCoeff2.z - 1.0);
[0116] vSH += avBand[7] * vCoeff1.z;
[0117] vSH += avBand[8] * (vCoeff2.x - vCoeff2.y);
[0118]
[0119] return vSH;
[0120] }
[0121]
[0122]
[0123] in vec4 px_vPosition;
[0124] in vec4 px_vTexCoord0;
[0125] layout(location = 0) out vec4 out_vColor;
[0126]
[0127] void main()
[0128] {
[0129] vec4 px_vPosition = gl_FragCoord;
[0130] bool px_bFrontFacing = gl_FrontFacing;
[0131] int px_lPrimitiveID = gl_PrimitiveID;
[0132]
[0133]
[0134] vec2 vMapCoords = px_vPosition.xy * avInvScreenSize;
[0135] vec4 vColorVal = texture(aDiffuseMap, vMapCoords);
[0136] vec4 vNormalVal = texture(aNormalMap, vMapCoords);
[0137]
[0138] vec4 vSpecVal = texture(aSpecularMap, vMapCoords);
[0139]
[0140]
[0141] float fDepth = vNormalVal.w;
[0142] vec3 vPos = vec3(px_vPosition.xy * avScreenToFarPlane.xy + avScreenToFarPlane.zw, afNegFarPlane) * fDepth;
[0143] vec3 vWorldView = ((a_mtxInvView) * (vec4(vPos, 0.0))).xyz;
[0144] vec3 vBox = (avBoxCenter - vWorldView) / avBoxExtent;
[0145]
[0146] //Convert color to linear space if needed
[0147]
[0148]
[0149] /////////////////////////////////
[0150] //Unpack normal and normalize (if needed)
[0151] vec3 vNormal = vNormalVal.xyz;
[0152]
[0153] ///////////////////////////////
[0154] // Calculate color, multiply with 8.0 to increase precision
[0155] float fUpAmount = dot( avViewSpaceUp, vNormal.xyz)*0.5 + 0.5;
[0156] vec3 vLightColor = mix(avAmbientColorGround, avAmbientColorSky, fUpAmount);
[0157]
[0158]
[0159] ////////////////
[0160] // Caluclate SH color
[0161] vec3 vWorldNormal = ((a_mtxInvView) * (vec4(vNormal,0.0))).xyz;
[0162] vWorldView = normalize(vWorldView);
[0163] vec3 vReflected = reflect(vWorldView, vWorldNormal);
[0164]
[0165] float fSpecularMul = pow(0.5 + dot(vReflected, vWorldView) * 0.5, 1.0 + vSpecVal.a * 3.0) * (3.0 / (2.6 - vSpecVal.a * 0.9));
[0166]
[0167] vWorldNormal = normalize(vWorldNormal +vBox * 0.25); //slightly skew the normal toward the edge of the box for more detail
[0168]
[0169] vec3 vSH = GetSH(vWorldNormal);
[0170] vec3 vSHSpec = GetReflectedSH(vReflected, vSpecVal.a) * fSpecularMul;
[0171]
[0172] out_vColor.xyz = (max(vec3(0.0), vSH) * vColorVal.xyz +
[0173] max(vec3(0.0), vSHSpec) * vSpecVal.xyz) * vLightColor * 8.0;
[0174]
[0175]
[0176]
[0177] ////////////////
[0178] // Falloff
[0179] vBox = abs(vBox);
[0180]
[0181] //////////////
[0182] // Get the spherical and box falloff
[0183] float fSphereFalloff = length(vBox);
[0184]
[0185] vBox = max(vec3(0.0), vec3(1.0) - vBox);
[0186] vec3 vBoxFalloff = vec3(1.0) / vBox;
[0187] float fBoxFalloff = sqrt(1.0 / (vBoxFalloff.x + vBoxFalloff.y + vBoxFalloff.y));
[0188] float fCutoff = min(min(vBox.x, vBox.y), vBox.z);
[0189]
[0190] //////////
[0191] // Perform smoothstep and add spherical and box togehter
[0192] float fBevel = sqrt(mix(3.0, 1.0, afBevel));
[0193] vec3 vFalloff = smoothstep(vec3(0.0, 0.0, fBevel),
[0194] vec3(1.0, 0.125, 0.0), vec3(fBoxFalloff, fCutoff, fSphereFalloff));
[0195] vFalloff.xz *= vFalloff.xz;
[0196]
[0197] float fWeight = vFalloff.x * vFalloff.y * vFalloff.z;
[0198] float fFalloff = pow(fWeight, afFalloff+1e-5f) * afWeight;
[0199]
[0200]
[0201] out_vColor.xyz *= fFalloff * fWeight;
[0202] out_vColor.w = fWeight * afWeight;
[0203]
[0204]
[0205]
[0206] }
[0207]
---------------------
Compile log:
---------------------
Fragment shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:49: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:51: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 3 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] #extension GL_ARB_draw_instanced : enable
[0006] ////////////////////////////////////////////////////////
[0007] // Deferred Light - Vertex Shader
[0008] //
[0009] //
[0010] ////////////////////////////////////////////////////////
[0011]
[0012] //---------------------------------------------
[0013]
[0014] //////////////////
[0015] // Arguments
[0016]
[0017] layout(std140, binding = 0) uniform cLightArguments
[0018] {
[0019] mat4 a_mtxViewProjection;
[0020] mat4 a_mtxProjection;
[0021] mat4 a_mtxView;
[0022] mat4 a_mtxInvViewProjection;
[0023] mat4 a_mtxInvProjection;
[0024] mat4 a_mtxInvView;
[0025]
[0026] float afFarPlane;
[0027] float afNearPlane;
[0028] float afNearByFarPlane;
[0029] float afInvFarPlane;
[0030]
[0031] vec4 avScreenToFarPlane;
[0032] vec2 avInvScreenSize;
[0033]
[0034] vec2 avFogStartAndLength;
[0035] vec4 avFogColor;
[0036]
[0037] vec3 avViewSpaceUp;
[0038] float afFogFalloffExp;
[0039]
[0040] int alInstanceOffset;
[0041] int alInstanceStride;
[0042] vec2 avPadding;
[0043]
[0044]
[0045] };
[0046]
[0047]
[0048] ///////////////////////
[0049] // Instancing
[0050] layout(binding = 15) uniform samplerBuffer aInstanceBuffer;
[0051]
[0052] //---------------------------------------------
[0053]
[0054] ///////////////////////////////
[0055] // Main program
[0056] in vec4 vtx_vPosition;
[0057] out vec3 px_vBoxCenter;
[0058] out vec3 px_vBoxExtent;
[0059] out vec4 px_vSkyColor;
[0060] out vec4 px_vGroundColor;
[0061] out float px_fFalloff;
[0062] out float px_fBevel;
[0063] out float px_fWeight;
[0064]
[0065] void main()
[0066] {
[0067] int vtx_lVertexID = gl_VertexID;
[0068] int vtx_lInstanceID = gl_InstanceID;
[0069]
[0070] vec4 px_vPosition = vec4(0);
[0071]
[0072]
[0073] /////////////
[0074] // load instance data
[0075] vec4 vSample;
[0076] int lBaseOffset = int(alInstanceOffset + vtx_lInstanceID * alInstanceStride);
[0077]
[0078]
[0079] mat4 mtxModel = mat4(texelFetch(aInstanceBuffer, lBaseOffset),
[0080] texelFetch(aInstanceBuffer, lBaseOffset + 1),
[0081] texelFetch(aInstanceBuffer, lBaseOffset + 2),
[0082] texelFetch(aInstanceBuffer, lBaseOffset + 3));
[0083]
[0084]
[0085]
[0086] px_vBoxCenter = texelFetch(aInstanceBuffer, lBaseOffset + 4).xyz;
[0087] px_vBoxExtent = texelFetch(aInstanceBuffer, lBaseOffset + 5).xyz;
[0088] px_vSkyColor = texelFetch(aInstanceBuffer, lBaseOffset + 6);
[0089] px_vGroundColor = texelFetch(aInstanceBuffer, lBaseOffset + 7);
[0090]
[0091] vSample = texelFetch(aInstanceBuffer, lBaseOffset + 8);
[0092] px_fFalloff = vSample.x;
[0093] px_fBevel = vSample.y;
[0094] px_fWeight = vSample.z;
[0095]
[0096] lBaseOffset += 9;
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110] ///////////
[0111] // Apply model matrix for instance
[0112] vec4 vLocalVertexPos = ((mtxModel) * (vec4(vtx_vPosition.xyz, 1.0)));
[0113] px_vPosition = ((a_mtxViewProjection) * (vLocalVertexPos));
[0114]
[0115]
[0116] gl_Position = px_vPosition;
[0117] }
---------------------
Compile log:
---------------------
Vertex shader failed to compile with the following errors:
WARNING: 0:4: warning(#62) enable/warn/disable extension isn't found, extension 'GL_ARB_shading_language_420pack' is not supported
ERROR: 0:17: error(#279) Invalid layout qualifier 'binding'
ERROR: 0:50: error(#279) Invalid layout qualifier 'binding'
ERROR: error(#273) 2 compilation errors. No code generated
---------------------
ERROR: Failed to compile GLSL shader ''!
Shader code:
-------------------
[0001] #version 330
[0002] #extension GL_ARB_explicit_attrib_location : enable
[0003] #extension GL_ARB_uniform_buffer_object : enable
[0004] #extension GL_ARB_shading_language_420pack: enable
[0005] ////////////////////////////////////////////////////////
[0006] // Deferred Light Box - Fragment Shader
[0007] //
[0008] // Fragment program to draw a light box.
[0009] ////////////////////////////////////////////////////////
[0010]
[0011]
[0012]
[0013]
[0014]
[0015] ////////////////////
[0016] //Textures
[0017] layout(binding = 0) uniform sampler2D aDiffuseMap;
[0018] layout(binding = 1) uniform sampler2D aNormalMap;
[0019] layout(binding = 2) uniform sampler2D aSpecularMap;
[0020]
[0021] ////////////////////
[0022] //Uniform varaibles
[0023]
[0024] layout(std140, binding = 0) uniform cLightArguments
[0025] {
[0026] mat4 a_mtxViewProjection;
[0027] mat4 a_mtxProjection;
[0028] mat4 a_mtxView;
[0029] mat4 a_mtxInvViewProjection;
[0030] mat4 a_mtxInvProjection;
[0031] mat4 a_mtxInvView;
[0032]
[0033] float afFarPlane;
[0034] float afNearPlane;
[0035] float afNearByFarPlane;
[0036] float afInvFarPlane;
[0037]
[0038] vec4 avScreenToFarPlane;