Cabin
Junior Member
Posts: 2
Threads: 1
Joined: May 2011
Reputation:
0
|
Demo Graphics - black and white background objects/textures
I've been perusing the current threads and haven't found anything similar to what I'm experiencing, so hopefully someone will be able to help.
I just downloaded the demo today and noticed it is very difficult to see anything, even near candles. Background objects and textures also seem to be in black and white. However, other things do have colors, such as the pink/purple trail you are meant to follow.
I have already tried running through the troubleshooting guide and lowering all the options to the lowest qualities, but to no avail.
Here is a picture of what I am experiencing:
My specs are:
NVIDIA GeForce Go 7600
Intel Core 2 CPU T7200 2ghz each
2gb RAM
Vista 32bit
hpl.log:
Version 1.10
-------- THE HPL ENGINE LOG ------------
Engine build ID 20100818114615
Creating Engine Modules
--------------------------------------------------------
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
--------------------------------------------------------
Initializing Resources Module
--------------------------------------------------------
Creating loader handlers
Creating resource managers
Adding loaders to handlers
--------------------------------------------------------
Initializing Graphics Module
--------------------------------------------------------
Init lowlevel graphics: 1440x900 bpp:32 fs:0 ms:0 gpufmt:2 cap:'Amnesia - The Dark Descent - Loading...' pos:(-1x-1)
Setting video mode: 1440 x 900 - 32 bpp
Init Glew...OK
Setting up OpenGL
Vendor: NVIDIA Corporation
Renderer: GeForce Go 7600/PCI/SSE2
Version: 2.1.0
Max texture image units: 16
Max texture coord units: 8
Max user clip planes: 6
Two sided stencil: 1
Vertex Buffer Object: 1
Anisotropic filtering: 1
Max Anisotropic degree: 16
Multisampling: 1
Texture compression: 1
Texture compression S3TC: 1
Auto generate MipMaps: 1
Render to texture: 1
Max draw buffers: 4
Max color render targets: 4
Packed depth-stencil: 1
Texture float: 1
GLSL Version: 1.20 NVIDIA via Cg compiler
ShaderModel 2: 1
ShaderModel 3: 1
ShaderModel 4: 0
OGL ATIFragmentShader: 0
ATTENTION: System does not support const arrays in glsl!
Setting up G-Bugger: type: 0 texturenum: 3
Adding engine materials
Initializing DevIL
Vendor String: Abysmal Software
Version String: Developer's Image Library (DevIL) 1.6.8pre Aug 12 2006
Version Number: 168
Adding engine post effects
--------------------------------------------------------
Initializing Sound Module
--------------------------------------------------------
Initializing OpenAL
Available OpenAL devices:
0. Generic Software on Speakers / Headphones (SigmaTel High Definition Audio CODEC)(OpenAL default)
1. Generic Software on Digital Output Device (S/PDIF and HDMI) (SigmaTel High Definition Audio CODEC)
Trying to open device 'Generic Software on Speakers / Headphones (SigmaTel High Definition Audio CODEC)'... Success!
Number of mono sources: 32
Streaming setup: 4 Buffers x 262144 bytes each
--------------------------------------------------------
Initializing Game Module
--------------------------------------------------------
Adding engine updates
Initializing script functions
--------------------------------------------------------
User Initialization
--------------------------------------------------------
- DEMO VERSION -
--------------------------------------------------------
Game Running
--------------------------------------------------------
-------- Loading map 'menu_bg.map' ---------
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067] varying vec3 gvTangent;
[0068] varying vec3 gvBinormal;
[0069]
[0070]
[0071] /////////////////////
[0072] //Extra interpolated values
[0073]
[0074] //32 bit G-Buffer
[0075]
[0076] varying float gfLinearDepth;
[0077]
[0078]
[0079] //64 bit G-Buffer
[0080]
[0081]
[0082] ////////////////////
[0083] //Textures
[0084] uniform sampler2D aDiffuseMap;
[0085]
[0086]
[0087]
[0088] uniform sampler2D aNormalMap;
[0089]
[0090]
[0091]
[0092]
[0093] uniform sampler2D aSpecularMap;
[0094]
[0095]
[0096]
[0097]
[0098] uniform sampler2D aHeightMap;
[0099]
[0100]
[0101] uniform vec2 avHeightMapScaleAndBias;
[0102]
[0103] varying vec3 gvTangentEyePos;
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111] //--------------------------------------------------
[0112]
[0113] ///////////////////////////////
[0114] // Relief mapping helpers
[0115]
[0116] //Optimize by getting 4 depths at once somehow?
[0117] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0118] {
[0119] const int lSearchSteps = 8;
[0120]
[0121] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0122]
[0123] for(int i=0; i<lSearchSteps-1; i++)
[0124] {
[0125] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0126] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0127] }
[0128] }
[0129]
[0130] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0131] {
[0132] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0133]
[0134] for(int i=0; i<afSearchSteps-1; i++)
[0135] {
[0136] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0137] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0138] }
[0139] }
[0140]
[0141]
[0142] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0143] {
[0144] const int lSearchSteps = 6;
[0145] for(int i=0; i<lSearchSteps; i++)
[0146] {
[0147] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0148] if(avPosition.z < fDepth)
[0149] avPosition += avEyeVec;
[0150]
[0151] avEyeVec *= 0.5;
[0152] avPosition -= avEyeVec;
[0153] }
[0154] }
[0155]
[0156]
[0157]
[0158] //--------------------------------------------------
[0159]
[0160] ///////////////////////////////
[0161] // Main program
[0162] void main()
[0163] {
[0164] //////////////////////////////////
[0165] //Diffuse
[0166]
[0167]
[0168] //RELIEF PARALLAX:
[0169]
[0170] vec3 vEyeVec = normalize(gvTangentEyePos);
[0171] float fHeight = texture2D(aHeightMap, gl_TexCoord[0].xy).w;
[0172]
[0173] float fDisplacement = fHeight * avHeightMapScaleAndBias.x;// + avHeightMapScaleAndBias.y; <- skip bias, since relief does not support it!
[0174]
[0175] vec2 vTexCoord = (vEyeVec * fDisplacement + gl_TexCoord[0].xyz).xy;
[0176]
[0177]
[0178] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0179]
[0180] //gl_FragData[0] = vec4(0,0,0,1);
[0181] //gl_FragData[0].xyz = vec3(vHeightMapPos.z);
[0182] //gl_FragData[0].xyz = vec3(texture2D(aHeightMap, gl_TexCoord[0].xy).w);
[0183]
[0184]
[0185]
[0186] //////////////////////////////////
[0187] //Set Diffuse color if no environemnt mapping is used.
[0188]
[0189] gl_FragData[0] = vDiffuseColor;
[0190]
[0191]
[0192] //////////////////////////////////
[0193] //Normal
[0194]
[0195] vec3 vNormal = texture2D(aNormalMap,vTexCoord).xyz - 0.5; //No need for full unpack x*2-1, becuase normal is normalized. (but now we do not normalize...)
[0196] vec3 vScreenNormal = normalize(vNormal.x * gvTangent + vNormal.y * gvBinormal + vNormal.z * gvNormal);
[0197]
[0198] //If 32 bit we need to pack, else no packing is needed.
[0199]
[0200] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0201]
[0202]
[0203]
[0204] //////////////////////////////////
[0205] //Environment Map
[0206]
[0207]
[0208]
[0209] //////////////////////////////////
[0210] //Depth
[0211]
[0212] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0213]
[0214]
[0215] //////////////////////////////////
[0216] //Specular
[0217]
[0218]
[0219] vec2 vSpecVals = texture2D(aSpecularMap, vTexCoord).xy;
[0220] gl_FragData[1].w = vSpecVals.x;
[0221] gl_FragData[2].w = vSpecVals.y;
[0222]
[0223]
---------------------
Compile log:
---------------------
(189) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067] varying vec3 gvTangent;
[0068] varying vec3 gvBinormal;
[0069]
[0070]
[0071] /////////////////////
[0072] //Extra interpolated values
[0073]
[0074] //32 bit G-Buffer
[0075]
[0076] varying float gfLinearDepth;
[0077]
[0078]
[0079] //64 bit G-Buffer
[0080]
[0081]
[0082] ////////////////////
[0083] //Textures
[0084] uniform sampler2D aDiffuseMap;
[0085]
[0086]
[0087]
[0088] uniform sampler2D aNormalMap;
[0089]
[0090]
[0091]
[0092]
[0093] uniform sampler2D aSpecularMap;
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104] //--------------------------------------------------
[0105]
[0106] ///////////////////////////////
[0107] // Relief mapping helpers
[0108]
[0109] //Optimize by getting 4 depths at once somehow?
[0110] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0111] {
[0112] const int lSearchSteps = 8;
[0113]
[0114] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0115]
[0116] for(int i=0; i<lSearchSteps-1; i++)
[0117] {
[0118] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0119] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0120] }
[0121] }
[0122]
[0123] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0124] {
[0125] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0126]
[0127] for(int i=0; i<afSearchSteps-1; i++)
[0128] {
[0129] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0130] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0131] }
[0132] }
[0133]
[0134]
[0135] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0136] {
[0137] const int lSearchSteps = 6;
[0138] for(int i=0; i<lSearchSteps; i++)
[0139] {
[0140] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0141] if(avPosition.z < fDepth)
[0142] avPosition += avEyeVec;
[0143]
[0144] avEyeVec *= 0.5;
[0145] avPosition -= avEyeVec;
[0146] }
[0147] }
[0148]
[0149]
[0150]
[0151] //--------------------------------------------------
[0152]
[0153] ///////////////////////////////
[0154] // Main program
[0155] void main()
[0156] {
[0157] //////////////////////////////////
[0158] //Diffuse
[0159]
[0160] vec2 vTexCoord = gl_TexCoord[0].xy;
[0161] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0162]
[0163]
[0164]
[0165] //////////////////////////////////
[0166] //Set Diffuse color if no environemnt mapping is used.
[0167]
[0168] gl_FragData[0] = vDiffuseColor;
[0169]
[0170]
[0171] //////////////////////////////////
[0172] //Normal
[0173]
[0174] vec3 vNormal = texture2D(aNormalMap,vTexCoord).xyz - 0.5; //No need for full unpack x*2-1, becuase normal is normalized. (but now we do not normalize...)
[0175] vec3 vScreenNormal = normalize(vNormal.x * gvTangent + vNormal.y * gvBinormal + vNormal.z * gvNormal);
[0176]
[0177] //If 32 bit we need to pack, else no packing is needed.
[0178]
[0179] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0180]
[0181]
[0182]
[0183] //////////////////////////////////
[0184] //Environment Map
[0185]
[0186]
[0187]
[0188] //////////////////////////////////
[0189] //Depth
[0190]
[0191] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0192]
[0193]
[0194] //////////////////////////////////
[0195] //Specular
[0196]
[0197]
[0198] vec2 vSpecVals = texture2D(aSpecularMap, vTexCoord).xy;
[0199] gl_FragData[1].w = vSpecVals.x;
[0200] gl_FragData[2].w = vSpecVals.y;
[0201]
[0202]
---------------------
Compile log:
---------------------
(168) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067]
[0068] /////////////////////
[0069] //Extra interpolated values
[0070]
[0071] //32 bit G-Buffer
[0072]
[0073] varying float gfLinearDepth;
[0074]
[0075]
[0076] //64 bit G-Buffer
[0077]
[0078]
[0079] ////////////////////
[0080] //Textures
[0081] uniform sampler2D aDiffuseMap;
[0082]
[0083]
[0084]
[0085]
[0086]
[0087] uniform sampler2D aSpecularMap;
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098] //--------------------------------------------------
[0099]
[0100] ///////////////////////////////
[0101] // Relief mapping helpers
[0102]
[0103] //Optimize by getting 4 depths at once somehow?
[0104] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0105] {
[0106] const int lSearchSteps = 8;
[0107]
[0108] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0109]
[0110] for(int i=0; i<lSearchSteps-1; i++)
[0111] {
[0112] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0113] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0114] }
[0115] }
[0116]
[0117] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0118] {
[0119] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0120]
[0121] for(int i=0; i<afSearchSteps-1; i++)
[0122] {
[0123] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0124] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0125] }
[0126] }
[0127]
[0128]
[0129] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0130] {
[0131] const int lSearchSteps = 6;
[0132] for(int i=0; i<lSearchSteps; i++)
[0133] {
[0134] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0135] if(avPosition.z < fDepth)
[0136] avPosition += avEyeVec;
[0137]
[0138] avEyeVec *= 0.5;
[0139] avPosition -= avEyeVec;
[0140] }
[0141] }
[0142]
[0143]
[0144]
[0145] //--------------------------------------------------
[0146]
[0147] ///////////////////////////////
[0148] // Main program
[0149] void main()
[0150] {
[0151] //////////////////////////////////
[0152] //Diffuse
[0153]
[0154] vec2 vTexCoord = gl_TexCoord[0].xy;
[0155] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0156]
[0157]
[0158]
[0159] //////////////////////////////////
[0160] //Set Diffuse color if no environemnt mapping is used.
[0161]
[0162] gl_FragData[0] = vDiffuseColor;
[0163]
[0164]
[0165] //////////////////////////////////
[0166] //Normal
[0167]
[0168] vec3 vScreenNormal = normalize(gvNormal);
[0169]
[0170] //If 32 bit we need to pack, else no packing is needed.
[0171]
[0172] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0173]
[0174]
[0175]
[0176] //////////////////////////////////
[0177] //Environment Map
[0178]
[0179]
[0180]
[0181] //////////////////////////////////
[0182] //Depth
[0183]
[0184] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0185]
[0186]
[0187] //////////////////////////////////
[0188] //Specular
[0189]
[0190]
[0191] vec2 vSpecVals = texture2D(aSpecularMap, vTexCoord).xy;
[0192] gl_FragData[1].w = vSpecVals.x;
[0193] gl_FragData[2].w = vSpecVals.y;
[0194]
[0195]
---------------------
Compile log:
---------------------
(162) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067]
[0068] /////////////////////
[0069] //Extra interpolated values
[0070]
[0071] //32 bit G-Buffer
[0072]
[0073] varying float gfLinearDepth;
[0074]
[0075]
[0076] //64 bit G-Buffer
[0077]
[0078]
[0079] ////////////////////
[0080] //Textures
[0081] uniform sampler2D aDiffuseMap;
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095] //--------------------------------------------------
[0096]
[0097] ///////////////////////////////
[0098] // Relief mapping helpers
[0099]
[0100] //Optimize by getting 4 depths at once somehow?
[0101] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0102] {
[0103] const int lSearchSteps = 8;
[0104]
[0105] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0106]
[0107] for(int i=0; i<lSearchSteps-1; i++)
[0108] {
[0109] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0110] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0111] }
[0112] }
[0113]
[0114] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0115] {
[0116] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0117]
[0118] for(int i=0; i<afSearchSteps-1; i++)
[0119] {
[0120] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0121] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0122] }
[0123] }
[0124]
[0125]
[0126] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0127] {
[0128] const int lSearchSteps = 6;
[0129] for(int i=0; i<lSearchSteps; i++)
[0130] {
[0131] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0132] if(avPosition.z < fDepth)
[0133] avPosition += avEyeVec;
[0134]
[0135] avEyeVec *= 0.5;
[0136] avPosition -= avEyeVec;
[0137] }
[0138] }
[0139]
[0140]
[0141]
[0142] //--------------------------------------------------
[0143]
[0144] ///////////////////////////////
[0145] // Main program
[0146] void main()
[0147] {
[0148] //////////////////////////////////
[0149] //Diffuse
[0150]
[0151] vec2 vTexCoord = gl_TexCoord[0].xy;
[0152] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0153]
[0154]
[0155]
[0156] //////////////////////////////////
[0157] //Set Diffuse color if no environemnt mapping is used.
[0158]
[0159] gl_FragData[0] = vDiffuseColor;
[0160]
[0161]
[0162] //////////////////////////////////
[0163] //Normal
[0164]
[0165] vec3 vScreenNormal = normalize(gvNormal);
[0166]
[0167] //If 32 bit we need to pack, else no packing is needed.
[0168]
[0169] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0170]
[0171]
[0172]
[0173] //////////////////////////////////
[0174] //Environment Map
[0175]
[0176]
[0177]
[0178] //////////////////////////////////
[0179] //Depth
[0180]
[0181] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0182]
[0183]
[0184] //////////////////////////////////
[0185] //Specular
[0186]
[0187]
[0188] gl_FragData[1].w = 0.0;
[0189] gl_FragData[2].w = 0.0;
[0190]
[0191]
---------------------
Compile log:
---------------------
(159) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
Cache Loading: 3860 ms
Entities: 631 ms
Compilation: 2 ms
Total: 4520 ms
Meshes created: 27
Bodies created: 5
-------- Loading complete ---------
Setting profile: 'Chris' Path: 'C:\Users\Chris\Documents/Amnesia/MainDemo/Chris/'
-------- BEGIN LOAD FROM C:\Users\Chris\Documents/Amnesia/MainDemo/Chris/AutoSave_Distillery_2011_5_28_5_58_41_0.sav ---------
LOADING SAVE GAME!
-------- Loading map 'demo_06_distillery.map' ---------
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067] varying vec3 gvTangent;
[0068] varying vec3 gvBinormal;
[0069]
[0070]
[0071] /////////////////////
[0072] //Extra interpolated values
[0073]
[0074] //32 bit G-Buffer
[0075]
[0076] varying float gfLinearDepth;
[0077]
[0078]
[0079] //64 bit G-Buffer
[0080]
[0081]
[0082] ////////////////////
[0083] //Textures
[0084] uniform sampler2D aDiffuseMap;
[0085]
[0086]
[0087]
[0088] uniform sampler2D aNormalMap;
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101] //--------------------------------------------------
[0102]
[0103] ///////////////////////////////
[0104] // Relief mapping helpers
[0105]
[0106] //Optimize by getting 4 depths at once somehow?
[0107] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0108] {
[0109] const int lSearchSteps = 8;
[0110]
[0111] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0112]
[0113] for(int i=0; i<lSearchSteps-1; i++)
[0114] {
[0115] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0116] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0117] }
[0118] }
[0119]
[0120] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0121] {
[0122] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0123]
[0124] for(int i=0; i<afSearchSteps-1; i++)
[0125] {
[0126] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0127] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0128] }
[0129] }
[0130]
[0131]
[0132] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0133] {
[0134] const int lSearchSteps = 6;
[0135] for(int i=0; i<lSearchSteps; i++)
[0136] {
[0137] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0138] if(avPosition.z < fDepth)
[0139] avPosition += avEyeVec;
[0140]
[0141] avEyeVec *= 0.5;
[0142] avPosition -= avEyeVec;
[0143] }
[0144] }
[0145]
[0146]
[0147]
[0148] //--------------------------------------------------
[0149]
[0150] ///////////////////////////////
[0151] // Main program
[0152] void main()
[0153] {
[0154] //////////////////////////////////
[0155] //Diffuse
[0156]
[0157] vec2 vTexCoord = gl_TexCoord[0].xy;
[0158] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0159]
[0160]
[0161]
[0162] //////////////////////////////////
[0163] //Set Diffuse color if no environemnt mapping is used.
[0164]
[0165] gl_FragData[0] = vDiffuseColor;
[0166]
[0167]
[0168] //////////////////////////////////
[0169] //Normal
[0170]
[0171] vec3 vNormal = texture2D(aNormalMap,vTexCoord).xyz - 0.5; //No need for full unpack x*2-1, becuase normal is normalized. (but now we do not normalize...)
[0172] vec3 vScreenNormal = normalize(vNormal.x * gvTangent + vNormal.y * gvBinormal + vNormal.z * gvNormal);
[0173]
[0174] //If 32 bit we need to pack, else no packing is needed.
[0175]
[0176] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0177]
[0178]
[0179]
[0180] //////////////////////////////////
[0181] //Environment Map
[0182]
[0183]
[0184]
[0185] //////////////////////////////////
[0186] //Depth
[0187]
[0188] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0189]
[0190]
[0191] //////////////////////////////////
[0192] //Specular
[0193]
[0194]
[0195] gl_FragData[1].w = 0.0;
[0196] gl_FragData[2].w = 0.0;
[0197]
[0198]
---------------------
Compile log:
---------------------
(165) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067] varying vec3 gvTangent;
[0068] varying vec3 gvBinormal;
[0069]
[0070]
[0071] /////////////////////
[0072] //Extra interpolated values
[0073]
[0074] //32 bit G-Buffer
[0075]
[0076] varying float gfLinearDepth;
[0077]
[0078]
[0079] //64 bit G-Buffer
[0080]
[0081]
[0082] ////////////////////
[0083] //Textures
[0084] uniform sampler2D aDiffuseMap;
[0085]
[0086]
[0087]
[0088] uniform sampler2D aNormalMap;
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095] uniform sampler2D aHeightMap;
[0096]
[0097]
[0098] uniform vec2 avHeightMapScaleAndBias;
[0099]
[0100] varying vec3 gvTangentEyePos;
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108] //--------------------------------------------------
[0109]
[0110] ///////////////////////////////
[0111] // Relief mapping helpers
[0112]
[0113] //Optimize by getting 4 depths at once somehow?
[0114] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0115] {
[0116] const int lSearchSteps = 8;
[0117]
[0118] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0119]
[0120] for(int i=0; i<lSearchSteps-1; i++)
[0121] {
[0122] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0123] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0124] }
[0125] }
[0126]
[0127] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0128] {
[0129] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0130]
[0131] for(int i=0; i<afSearchSteps-1; i++)
[0132] {
[0133] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0134] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0135] }
[0136] }
[0137]
[0138]
[0139] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0140] {
[0141] const int lSearchSteps = 6;
[0142] for(int i=0; i<lSearchSteps; i++)
[0143] {
[0144] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0145] if(avPosition.z < fDepth)
[0146] avPosition += avEyeVec;
[0147]
[0148] avEyeVec *= 0.5;
[0149] avPosition -= avEyeVec;
[0150] }
[0151] }
[0152]
[0153]
[0154]
[0155] //--------------------------------------------------
[0156]
[0157] ///////////////////////////////
[0158] // Main program
[0159] void main()
[0160] {
[0161] //////////////////////////////////
[0162] //Diffuse
[0163]
[0164]
[0165] //RELIEF PARALLAX:
[0166]
[0167] vec3 vEyeVec = normalize(gvTangentEyePos);
[0168] float fHeight = texture2D(aHeightMap, gl_TexCoord[0].xy).w;
[0169]
[0170] float fDisplacement = fHeight * avHeightMapScaleAndBias.x;// + avHeightMapScaleAndBias.y; <- skip bias, since relief does not support it!
[0171]
[0172] vec2 vTexCoord = (vEyeVec * fDisplacement + gl_TexCoord[0].xyz).xy;
[0173]
[0174]
[0175] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0176]
[0177] //gl_FragData[0] = vec4(0,0,0,1);
[0178] //gl_FragData[0].xyz = vec3(vHeightMapPos.z);
[0179] //gl_FragData[0].xyz = vec3(texture2D(aHeightMap, gl_TexCoord[0].xy).w);
[0180]
[0181]
[0182]
[0183] //////////////////////////////////
[0184] //Set Diffuse color if no environemnt mapping is used.
[0185]
[0186] gl_FragData[0] = vDiffuseColor;
[0187]
[0188]
[0189] //////////////////////////////////
[0190] //Normal
[0191]
[0192] vec3 vNormal = texture2D(aNormalMap,vTexCoord).xyz - 0.5; //No need for full unpack x*2-1, becuase normal is normalized. (but now we do not normalize...)
[0193] vec3 vScreenNormal = normalize(vNormal.x * gvTangent + vNormal.y * gvBinormal + vNormal.z * gvNormal);
[0194]
[0195] //If 32 bit we need to pack, else no packing is needed.
[0196]
[0197] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0198]
[0199]
[0200]
[0201] //////////////////////////////////
[0202] //Environment Map
[0203]
[0204]
[0205]
[0206] //////////////////////////////////
[0207] //Depth
[0208]
[0209] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0210]
[0211]
[0212] //////////////////////////////////
[0213] //Specular
[0214]
[0215]
[0216] gl_FragData[1].w = 0.0;
[0217] gl_FragData[2].w = 0.0;
[0218]
[0219]
---------------------
Compile log:
---------------------
(186) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
Cache Loading: 5602 ms
Entities: 4922 ms
Compilation: 48 ms
Total: 11411 ms
Meshes created: 234
Bodies created: 101
-------- Loading complete ---------
WARNING: Could not find player start node ''
ERROR: StartPos '' does not exist!
ERROR: Failed to compile GLSL shader 'C:/Program Files/Amnesia - The Dark Descent Demo/redist/core/shaders/deferred_gbuffer_solid_frag.glsl'!
Shader code:
-------------------
[0001] ////////////////////////////////////////////////////////
[0002] // Deferred G-Buffer Solid - Fragment Shader
[0003] //
[0004] //
[0005] ////////////////////////////////////////////////////////
[0006] #version 120
[0007] #extension GL_ARB_texture_rectangle : enable
[0008]
[0009] // Pack a float in a 2d vector
[0010] vec2 PackFloatInVec2(float afX)
[0011] {
[0012] vec2 vRet;
[0013] afX *= 255.0;
[0014] vRet.x = floor(afX);
[0015] vRet.y = (afX - vRet.x);
[0016] vRet.x *= (1.0 / 255.0);
[0017] return vRet;
[0018] }
[0019]
[0020] //------------------------------------
[0021]
[0022] // Pack a float in a 3d vector
[0023] vec3 PackFloatInVec3(float afX)
[0024] {
[0025] vec3 vRet;
[0026] afX *= 255.0;
[0027] vRet.x = floor(afX);
[0028] afX = (afX - vRet.x) * 255.0;
[0029] vRet.y = floor(afX);
[0030] vRet.z = afX - vRet.y;
[0031] vRet.xy *= (1.0 / 255.0);
[0032]
[0033] return vRet;
[0034] }
[0035]
[0036] //------------------------------------
[0037]
[0038] // Unpack a 2d vector to a float
[0039] float UnpackVec2ToFloat(vec2 avVal)
[0040] {
[0041] return dot(avVal, vec2(1.0, 1.0/255.0) );
[0042] }
[0043]
[0044] //------------------------------------
[0045]
[0046] // Unpack a 3d vector to a float
[0047] float UnpackVec3ToFloat(vec3 avVal)
[0048] {
[0049] return dot(avVal, vec3(1.0, 1.0/255.0, 1.0 / (255.0*255.0 )) );
[0050] }
[0051]
[0052] //-----------------------------------------
[0053] // Caclulate the fresnel term.
[0054] float Fresnel(float afEDotN, float afFresnelBias, float afFresnelPow)
[0055] {
[0056] float fFacing = 1.0 - afEDotN;
[0057] return max(afFresnelBias+ (1.0-afFresnelBias)* pow(fFacing,afFresnelPow), 0.0);
[0058] }
[0059]
[0060] //-----------------------------------------
[0061]
[0062] ////////////////////
[0063] //Normal interpolated values
[0064] varying vec3 gvNormal;
[0065]
[0066]
[0067] varying vec3 gvTangent;
[0068] varying vec3 gvBinormal;
[0069]
[0070]
[0071] /////////////////////
[0072] //Extra interpolated values
[0073]
[0074] //32 bit G-Buffer
[0075]
[0076] varying float gfLinearDepth;
[0077]
[0078]
[0079] //64 bit G-Buffer
[0080]
[0081] varying vec3 gvVertexPos;
[0082]
[0083]
[0084] ////////////////////
[0085] //Textures
[0086] uniform sampler2D aDiffuseMap;
[0087]
[0088]
[0089]
[0090] uniform sampler2D aNormalMap;
[0091]
[0092]
[0093]
[0094]
[0095] uniform sampler2D aSpecularMap;
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102] uniform samplerCube aEnvMap;
[0103]
[0104]
[0105] uniform vec2 avFrenselBiasPow;
[0106] uniform mat4 a_mtxInvViewRotation;
[0107]
[0108]
[0109]
[0110] uniform sampler2D aEnvMapAlphaMap;
[0111]
[0112]
[0113]
[0114]
[0115]
[0116] //--------------------------------------------------
[0117]
[0118] ///////////////////////////////
[0119] // Relief mapping helpers
[0120]
[0121] //Optimize by getting 4 depths at once somehow?
[0122] void RayLinearIntersectionSM2(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0123] {
[0124] const int lSearchSteps = 8;
[0125]
[0126] avEyeVec /= lSearchSteps; //Split up the eye vector into the number of steps
[0127]
[0128] for(int i=0; i<lSearchSteps-1; i++)
[0129] {
[0130] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0131] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0132] }
[0133] }
[0134]
[0135] void RayLinearIntersectionSM3(sampler2D aHeightMap, float afSearchSteps, inout vec3 avPosition, inout vec3 avEyeVec)
[0136] {
[0137] avEyeVec /= afSearchSteps; //Split up the eye vector into the number of steps
[0138]
[0139] for(int i=0; i<afSearchSteps-1; i++)
[0140] {
[0141] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0142] if(avPosition.z < fDepth) avPosition += avEyeVec;
[0143] }
[0144] }
[0145]
[0146]
[0147] void RayBinaryIntersection(sampler2D aHeightMap, inout vec3 avPosition, inout vec3 avEyeVec)
[0148] {
[0149] const int lSearchSteps = 6;
[0150] for(int i=0; i<lSearchSteps; i++)
[0151] {
[0152] float fDepth = texture2D(aHeightMap, avPosition.xy).w;
[0153] if(avPosition.z < fDepth)
[0154] avPosition += avEyeVec;
[0155]
[0156] avEyeVec *= 0.5;
[0157] avPosition -= avEyeVec;
[0158] }
[0159] }
[0160]
[0161]
[0162]
[0163] //--------------------------------------------------
[0164]
[0165] ///////////////////////////////
[0166] // Main program
[0167] void main()
[0168] {
[0169] //////////////////////////////////
[0170] //Diffuse
[0171]
[0172] vec2 vTexCoord = gl_TexCoord[0].xy;
[0173] vec4 vDiffuseColor = texture2D(aDiffuseMap, vTexCoord);
[0174]
[0175]
[0176]
[0177] //////////////////////////////////
[0178] //Set Diffuse color if no environemnt mapping is used.
[0179]
[0180]
[0181]
[0182] //////////////////////////////////
[0183] //Normal
[0184]
[0185] vec3 vNormal = texture2D(aNormalMap,vTexCoord).xyz - 0.5; //No need for full unpack x*2-1, becuase normal is normalized. (but now we do not normalize...)
[0186] vec3 vScreenNormal = normalize(vNormal.x * gvTangent + vNormal.y * gvBinormal + vNormal.z * gvNormal);
[0187]
[0188] //If 32 bit we need to pack, else no packing is needed.
[0189]
[0190] gl_FragData[1].xyz = vScreenNormal*0.5 + 0.5;
[0191]
[0192]
[0193]
[0194] //////////////////////////////////
[0195] //Environment Map
[0196]
[0197] vec3 vCameraSpaceEyeVec = normalize(gvVertexPos);
[0198]
[0199] vec3 vEnvUv = reflect(vCameraSpaceEyeVec, vScreenNormal);
[0200] vEnvUv = (a_mtxInvViewRotation * vec4(vEnvUv,1)).xyz;
[0201]
[0202] vec4 vReflectionColor = textureCube(aEnvMap, vEnvUv);
[0203]
[0204] float afEDotN = max(dot(-vCameraSpaceEyeVec, vScreenNormal),0.0);
[0205] float fFresnel = Fresnel(afEDotN, avFrenselBiasPow.x, avFrenselBiasPow.y);
[0206]
[0207]
[0208] float fEnvMapAlpha = texture2D(aEnvMapAlphaMap, vTexCoord).w;
[0209] vReflectionColor *= fEnvMapAlpha;
[0210]
[0211]
[0212] gl_FragData[0] = vDiffuseColor + vReflectionColor * fFresnel;
[0213]
[0214]
[0215]
[0216] //////////////////////////////////
[0217] //Depth
[0218]
[0219] gl_FragData[2].xyz = PackFloatInVec3(gfLinearDepth);
[0220]
[0221]
[0222] //////////////////////////////////
[0223] //Specular
[0224]
[0225]
[0226] vec2 vSpecVals = texture2D(aSpecularMap, vTexCoord).xy;
[0227] gl_FragData[1].w = vSpecVals.x;
[0228] gl_FragData[2].w = vSpecVals.y;
[0229]
[0230]
---------------------
Compile log:
---------------------
(190) : error C7531: global variable gl_FragData requires "#extension GL_ARB_draw_buffers : enable" before use
---------------------
ERROR: Couldn't create program 'deferred_gbuffer_solid_frag.glsl'
ERROR: Could not load material 'soliddiffuse' shader 'deferred_gbuffer_solid_frag.glsl'
ERROR: Couldn't create SoundEntity 'grunt/notice.snt'
WARNING: Couldn't preload sound entity 'grunt/notice'
-------- END LOAD ---------
-------- Loading map 'menu_bg.map' ---------
Cache Loading: 4020 ms
Entities: 678 ms
Compilation: 3 ms
Total: 4745 ms
Meshes created: 27
Bodies created: 5
-------- Loading complete ---------
--------------------------------------------------------
Statistics
--------------------------------------------------------
Medium framerate: 2.658338
--------------------------------------------------------
User Exit
--------------------------------------------------------
Saving main config.
Saving user config.
Deleting game modules.
'LuxInputHandler'
'LuxHelpFuncs'
'LuxSaveHandler'
'LuxScriptHandler'
'LuxProgressLogHandler'
'LuxMapHandler'
'LuxMapHelper'
'LuxPlayer'
'LuxInsanityHandler'
'LuxDebugHandler'
'LuxEffectRenderer'
'LuxMusicHandler'
'LuxMusicHandler'
'LuxEffectHandler'
'LuxCompletionCountHandler'
'LuxGlobalDataHandler'
'LuxHintHandler'
'LuxPostEffectHandler'
'LuxPreMenu'
'LuxDebugHandler'
'LuxInventory'
'LuxJournal'
'LuxDemoEnd'
'LuxLoadScreenHandler'
Deleting config files.
--------------------------------------------------------
Exiting Gui Module
--------------------------------------------------------
Deleting all sets
Deleting all skins
Deleting all gfx elements
Deleting all materials
--------------------------------------------------------
Exiting Generate Module
--------------------------------------------------------
--------------------------------------------------------
Exiting Scene Module
--------------------------------------------------------
--------------------------------------------------------
Exiting Input Module
--------------------------------------------------------
--------------------------------------------------------
Exiting Sound Module
--------------------------------------------------------
--------------------------------------------------------
Exiting Graphics Module
--------------------------------------------------------
--------------------------------------------------------
Exiting Resources Module
--------------------------------------------------------
Done with fonts
Done with scripts
Done with particles
Done with sounds
Done with meshes
Done with materials
Done with Gpu programs
Done with images
Destroyed all textures
Done with sound entities
Done with animations
Done with ent files
All resources deleted
--------------------------------------------------------
Exiting Physics Module
--------------------------------------------------------
--------------------------------------------------------
Exiting System Module
--------------------------------------------------------
--------------------------------------------------------
Deleting game setup provided by user
- Deleting lowlevel stuff.
Physics
Sound
Input
Resources
System
Graphics
Haptic
HPL Exit was successful!
|--Memory Manager Report-------------------------------|
|
| No memory leaks detected. Memory left: 0
|
|------------------------------------------------------|
Any help would be greatly appreciated!
(This post was last modified: 05-28-2011, 01:31 PM by Cabin.)
|
|