Author Topic: 2012/09/05 - Blockland r1728  (Read 43208 times)

I thought Shaders were Shadows?
Seems you were mistaken.

Shaders affect more than just shadows.

Badspot

  • Administrator
However, no Point Light emission still.

I cannot telepathically debug this.  You're going to have to post some more information.

Badspot

  • Administrator
I can see shaders!!! But there are no shadows. :/

Here is my console.log when I change my settings from lowest, to second lowest.


I mean from minimum to low.

See this is just the intel driver being bullstuff.  First it says it supports EXT_texture_array, then it says it doesn't.

Quote
Checking for shader shadow support:
   - Enabled via $Shader::Enabled? YES
   - ARB_shader_objects?           YES
   - ARB_shading_language_100?     YES
   - EXT_texture_array?            YES
   - EXT_texture3D?                YES
   - glTexImage3D?                 YES
   - EXT_framebuffer_object?       YES
   - ARB_shadow?                   YES
   - OpenGL Version?               3.1.0 - Build 8.15.10.2752
   - GLSL Language Version?        1.40 - Intel Build 8.15.10.2752
   o Shaders are                   ACTIVE

Regenerating Shadow Map FBOs...
Creating shader program from shaders/renderCsm_vert.glsl and shaders/renderCsm_frag.glsl...
Compile failed on shaders/renderCsm_vert.glsl:
ERROR: 0:2: '' :  extension 'GL_EXT_texture_array' is not supported
WARNING: 0:3: extension 'GL_EXT_texture_array' is not supported


See this is just the intel driver being bullstuff.  First it says it supports EXT_texture_array, then it says it doesn't.


Wow, never realized how stupid intel can be.



Hope you'll find out how it works soon, badspot.

Crucially, it says this:
Code: [Select]
Fragment shader(s) failed to link,  vertex shader(s) linked.
Fragment Shader not supported by HW

Your hardware does not support fragment shaders.  I guess I should find some way to test for this, but there's no way to make it work - the hardware just flat out doesn't support it.

Darn it. Oh well, means I likely need to get a new laptop if I want to see shaders on it. Like getting a new laptop will break my heart lol. >:D

Badspot

  • Administrator
It says now shadows and shaders are active, however it still doesn't works, because an error occurs after applying.

Code: [Select]
   - GLSL Language Version?        1.10 NVIDIA via Cg 1.3 compiler

You need GLSL 1.2 or higher.  You might be able to fix this with updated drivers, but maybe not - the geforce 5600 is pretty old. 

This is great thank you but from changing from minimum to anything above it is not functional.




Working great on my intel computer.

It's on minimum but still this is the first time I got the chance to see them.
Thank you badspot, and great work!

Shadows won't work for me, I'm not sure why because I know nothing about these kind of things so I was going to leave my console.log here, but I can't post it, not in code tags, not as an attachment. It is because (and I'm not even exaggarating here) 99.9% of the entire console.log is made out of this message constantly being repeated:

Code: [Select]
\dev\Blockland\trunk\engine\bricks\octShadows.cpp:679 - GL Error: 1280 - GL_INVALID_ENUM
Trust me, it's insanely huge. The actual console.log is litterally 0.1 percent of this.
« Last Edit: September 05, 2012, 03:31:59 PM by Yosher »

Shaders are still not working. However, I am receiving an error in the console that did not appear to be present prior to Revision 1728.

Code: [Select]
Checking for shader shadow support:
   - Enabled via $Shader::Enabled? YES
   - ARB_shader_objects?           YES
   - ARB_shading_language_100?     YES
   - EXT_texture_array?            NO
   - EXT_texture3D?                YES
   - glTexImage3D?                 YES
   - EXT_framebuffer_object?       YES
   - ARB_shadow?                   YES
   - OpenGL Version?               2.1.2
   - GLSL Language Version?        1.20 NVIDIA via Cg compiler
   o Shaders are                   ACTIVE

\dev\Blockland\trunk\engine\bricks\octShadows.cpp:176 - GL Error: 1281 - GL_INVALID_VALUE
Regenerating Shadow Map FBOs...
Creating shader program from shaders/Minimum_vert.glsl and shaders/Minimum_frag.glsl...
Creating GLSL program...
Attaching shaders...
Linking GLSL program...
Fragment info
-------------
0(80) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(161) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(87) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(92) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(80) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(126) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(87) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
0(92) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable

ERROR: renderCsm_prog shader compilation failed, disabling shaders

Oh, it allows me to change the settings higher than what I can actually see..

So "If you do not meet the minimum requirements for a particular shader level, that option will be disabled in the gui. " doesn't work.

Well, I got this error in console.log.

Quote
Checking for shader shadow support:
   - Enabled via $Shader::Enabled? YES
   - ARB_shader_objects?           YES
   - ARB_shading_language_100?     YES
   - EXT_texture_array?            YES
   - EXT_texture3D?                YES
   - glTexImage3D?                 YES
   - EXT_framebuffer_object?       YES
   - ARB_shadow?                   YES
   - GLSL Language Version?        4.20 NVIDIA via Cg compiler
   o Shaders are                   ACTIVE
%
Creating shader program from shaders/renderCsm_vert.glsl and shaders/renderCsm_f
rag.glsl...
Compile failed:
0(245) : error C0000: syntax error, unexpected $undefined at token "#"
0(251) : error C1038: declaration of "worldNormal" conflicts with previous decla
ration at 0(6)
0(252) : error C1038: declaration of "worldPos" conflicts with previous declarat
ion at 0(

ERROR: renderCsm_prog shader compilation failed, disabling shaders
%

Looked in the shader files, found that there was a lot shared between common as well as the two shaders.  Removed the parts common to the two and now it works.

Quote from: renderCsm_frag.glsl
//#version 120
#extension GL_EXT_texture_array : require
#extension GL_EXT_texture_array : enable

uniform int glow;

uniform sampler2DArray stex;

float shadowCoef()
{
   float blend = 0.0f;
   vec4 shadow_coordA = vec4(0.0f, 0.0f, 0.0f, 0.0f);
   vec4 shadow_coordB = vec4(0.0f, 0.0f, 0.0f, 0.0f);

   calculateShadowCoords(shadow_coordA, shadow_coordB, blend);
   
   float shadowA = texture2DArray(stex, shadow_coordA.xyz).x; // get the stored depth
   float diffA   = shadowA - shadow_coordA.w;                 // get the difference of the stored depth and the distance of this fragment to the light

   if(diffA > 0.0f)
      diffA = 1.0f;
   else
      diffA = 0.0f;

   if(blend > 0.0f)
   {
      float shadowB = texture2DArray(stex, shadow_coordB.xyz).x; // get the stored depth
      float diffB   = shadowB - shadow_coordB.w;                 // get the difference of the stored depth and the distance of this fragment to the light
     
      if(diffB > 0.0f)
         diffB = 1.0f;
      else
         diffB = 0.0f;
         
      float total = (diffB * blend) + (diffA * (1.0f - blend));
      total = clamp(total, 0.0f, 1.0f);

      return total;
   }
   else
   {     
      return diffA;
   }
}

void main()
{
   vec4 albedo = vec4(0.0f, 0.0f, 0.0f, 0.0f);
   calculateSurface(gl_Color, albedo);

   float occlusionFactor = 0.0f;
   if(NdotL > -0.01f)
   {
      if(shadowSplitCount <= 0)
         occlusionFactor = 1.0f;
      else
         occlusionFactor = shadowCoef();
   }

   // Apply lighting and fog.
   vec4 fragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
   if(isParticle == 1)
   {
      vec4 texAlbedo = texture2D(tex, texCoord);
      if(particleGlow == 1)
      {
         fragColor = texAlbedo * gl_Color;
         applyFog(fragColor);
         fragColor.a = texAlbedo.a * gl_Color.a;
      }
      else
      {
         vec4 dirLightDirect = (dirLightColor * occlusionFactor) + (dirLightAmbient * occlusionFactor) + (dirShadowColor * (1.0f - occlusionFactor));
         vec4 plt = accumulatePointLights();

         vec4 lightTotal = dirLightDirect + plt;
         lightTotal.x = clamp(lightTotal.x, 0.0f, 1.2f);
         lightTotal.y = clamp(lightTotal.y, 0.0f, 1.2f);
         lightTotal.z = clamp(lightTotal.z, 0.0f, 1.2f);
         
         fragColor = texAlbedo * gl_Color * lightTotal;

         applyFog(fragColor);
         fragColor.a = texAlbedo.a * gl_Color.a;
      }
   }
   else
   {
      applyLighting(fragColor, albedo, occlusionFactor);
      applyFog(fragColor);
   }
   
   // Uncomment to viz depth in B.
   //fragColor.z = vPos.y * 0.01f;

   gl_FragColor = fragColor;
}

Quote from: renderCsm_vert.glsl
//#version 120
#extension GL_EXT_texture_array : require
#extension GL_EXT_texture_array : enable

void main()
{
   // Bricks always in world space.
    worldPos = (obj2World * vec4(gl_Vertex.xyz, 1.0f)).xyz;
    worldNormal = ((obj2World * vec4(gl_Normal.xyz, 0.0f)).xyz);

    if(length(gl_Normal.xyz) < 1.1f)
       worldNormal.xyz = normalize(worldNormal.xyz);

   // Do some camera delta math.
   viewDelta.xyz = worldPos - camPos;
   viewDelta.w   = length(viewDelta.xyz);
   viewDelta.xyz = -normalize(viewDelta.xyz);

   // Fog can be done per-vertex.
   fogCoords.x = clamp((fogConsts.y - viewDelta.w) * fogConsts.x, 0.0f, 1.0f);
   fogCoords.y = clamp((worldPos.z - fogConsts.z) * fogConsts.w, 0.0f, 1.0f);

    // Project the brick pos and normal.
   vPos = world2Cam * vec4(worldPos, 1.0f);
   gl_Position = gl_ProjectionMatrix * vPos;

   // Pass color through.
   gl_FrontColor = gl_Color;
   
   // Pass texcoords through.
   texCoord = gl_MultiTexCoord0.st;   
}

I had this for awhile but never posted..

The sun comes thru the brick.
« Last Edit: September 05, 2012, 03:32:30 PM by Glassy »

uhh

Transparent bricks do this to non-transparent and FX colored bricks that are just created/loaded/painted a different color.




Badspot

  • Administrator
Well, I got this error in console.log.

Looked in the shader files, found that there was a lot shared between common as well as the two shaders.  Removed the parts common to the two and now it works.


common.glsl is no longer used.  You have not fully updated the game (master server shows you still running r1715) and and thus your executable is trying to use common and renderCSM, thus having duplicate variable definitions.