GLSL issue and Karith textures

Hello…I’m trying to do this with texture karith/base_wall …I’ve created normal map and spec map…added naming convention so base_wall_local.tga and base_wall_s.tga and moved in a folder called gl2 (textures/karith/gl2) , modified only one shader from eX.mtr and saved as karith.mtr.
When I load the map texture appear plain…no bump and no spec effect. If I enable r_cubemapping 1 I get shader compilation error…even if I put the entity called misc_cubemap.
What am I doing wrong? Here is the log…
Edit: eX map works fine with all effects, bumps, refl., shadows…despite my old laptop.

tty console mode disabled
Have SSE support
----- FS_Startup -----
We are looking in the current search path:
/media/bitflow/extramem/Apps/Tremulous/gpp
/media/bitflow/extramem/Apps/Tremulous/gpp/vms-v1.3.0-alpha.0.13.pk3 (4 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-uncreation-1.1.0.pk3 (110 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-tremor-1.1.0.pk3 (45 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-transit-1.1.0.pk3 (135 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-niveus-1.1.0.pk3 (134 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-nexus6-1.1.0.pk3 (151 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-karith-1.1.0.pk3 (118 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-eXcs-07022016-1.pk3 (44 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-atcs-1.1.0.pk3 (87 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/map-arachnid2-1.1.0.pk3 (67 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/data-v1.3.0-alpha.0.13.pk3 (166 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/data-gpp1.pk3 (263 files)
/media/bitflow/extramem/Apps/Tremulous/gpp/data-1.1.0.pk3 (1229 files)
/home/bitflow/.tremulous/gpp
/home/bitflow/.tremulous/base
/home/bitflow/.tremulous/base/texturepack-eX-gl2-07022016-1.pk3 (142 files)
/home/bitflow/.tremulous/base/texturepack-eX-gl1-07022016-1.pk3 (80 files)
/home/bitflow/.tremulous/base/map-zittrig-arena-gt5b.pk3 (6 files)
/home/bitflow/.tremulous/base/map-utcsud_v4.3-final.pk3 (60 files)
/home/bitflow/.tremulous/base/map-base-a51_b2.pk3 (66 files)
/home/bitflow/.tremulous/base/curry.pk3 (4 files)
/home/bitflow/.tremulous/base/common-spog.pk3 (29 files)
/home/bitflow/.tremulous/base/common-q3map2.pk3 (14 files)
/media/bitflow/extramem/Apps/Tremulous/base

----------------------
2954 files in pk3 files
execing default.cfg
execing autogen.cfg
couldn't exec autoexec.cfg
Hunk_Clear: reset the hunk ok
----- Client Initialization -----
----- Initializing Renderer ----
Trying to load "renderer_opengl2.so" from "/media/bitflow/extramem/Apps/Tremulous"...
Trying to load "renderer_opengl2.so" from "/media/bitflow/extramem/Apps/Tremulous"...
-------------------------------
QKEY found.
----- Client Initialization Complete -----
----- R_Init -----
SDL using driver "x11"
Initializing OpenGL display
Display aspect: 1.779
...setting mode 1366x768
Trying to get an OpenGL 3.2 core context
SDL_GL_CreateContext failed: Could not create GL context: GLXBadFBConfig
Reverting to default context
Using 24 color bits, 24 depth, 8 stencil display.
Available modes: '640x360 720x405 864x486 960x540 1024x576 1280x720 1366x768 680x384 640x480 800x600 1024x768'
GL_RENDERER: Mesa DRI Intel(R) Ironlake Mobile 
Initializing OpenGL extensions
...ignoring GL_EXT_texture_compression_s3tc
...ignoring GL_S3_s3tc
...using GL_EXT_texture_env_add
...using GL_ARB_multitexture
...using GL_EXT_compiled_vertex_array
...ignoring GL_EXT_texture_filter_anisotropic
...using OpenGL 2.1 Mesa 18.0.5
...using GL_ARB_framebuffer_object
...using GL_ARB_vertex_array_object
...using GL_ARB_texture_float
...using GL_ARB_depth_clamp
...ignoring GL_ARB_seamless_cube_map
...using GLSL version 1.20
...GL_NVX_gpu_memory_info not found
...GL_ATI_meminfo not found
...ignoring GL_ARB_texture_compression_rgtc
...GL_ARB_texture_compression_bptc not found
...GL_EXT_direct_state_access not found
------- FBO_Init -------
------- GLSL_InitGPUShaders -------
Shader source:
#version 120
#define shadow2D(a,b) shadow2D(a,b).r 
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef deformGen_t
#define deformGen_t
#define DGEN_WAVE_SIN 1
#define DGEN_WAVE_SQUARE 2
#define DGEN_WAVE_TRIANGLE 3
#define DGEN_WAVE_SAWTOOTH 4
#define DGEN_WAVE_INVERSE_SAWTOOTH 5
#define DGEN_BULGE 7
#define DGEN_MOVE 8
#endif
#ifndef tcGen_t
#define tcGen_t
#define TCGEN_LIGHTMAP 2
#define TCGEN_TEXTURE 3
#define TCGEN_ENVIRONMENT_MAPPED 4
#define TCGEN_FOG 5
#define TCGEN_VECTOR 6
#endif
#ifndef colorGen_t
#define colorGen_t
#define CGEN_LIGHTING_DIFFUSE 11
#endif
#ifndef alphaGen_t
#define alphaGen_t
#define AGEN_LIGHTING_SPECULAR 6
#define AGEN_PORTAL 8
#endif
#ifndef texenv_t
#define texenv_t
#define TEXENV_MODULATE 8448
#define TEXENV_ADD 260
#define TEXENV_REPLACE 7681
#endif
#ifndef r_FBufScale
#define r_FBufScale vec2(0.000732, 0.001302)
#endif
#define ROUGHNESS_MIPS float(6)
#define USE_LIGHT
#define USE_LIGHTMAP
#define USE_DELUXEMAP
#define USE_NORMALMAP
#define USE_SPECULARMAP
#define USE_CUBEMAP
#define GLOSS_IS_SMOOTHNESS
#line 0
uniform sampler2D u_DiffuseMap;

#if defined(USE_LIGHTMAP)
uniform sampler2D u_LightMap;
#endif

#if defined(USE_NORMALMAP)
uniform sampler2D u_NormalMap;
#endif

#if defined(USE_DELUXEMAP)
uniform sampler2D u_DeluxeMap;
#endif

#if defined(USE_SPECULARMAP)
uniform sampler2D u_SpecularMap;
#endif

#if defined(USE_SHADOWMAP)
uniform sampler2D u_ShadowMap;
#endif

#if defined(USE_CUBEMAP)
uniform samplerCube u_CubeMap;
#endif

#if defined(USE_NORMALMAP) || defined(USE_DELUXEMAP) || defined(USE_SPECULARMAP) || defined(USE_CUBEMAP)
// y = deluxe, w = cube
uniform vec4      u_EnableTextures; 
#endif

#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
uniform vec3  u_PrimaryLightColor;
uniform vec3  u_PrimaryLightAmbient;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
uniform vec4      u_NormalScale;
uniform vec4      u_SpecularScale;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_CUBEMAP)
uniform vec4      u_CubeMapInfo;
#endif
#endif

uniform int       u_AlphaTest;

varying vec4      var_TexCoords;

varying vec4      var_Color;
#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
varying vec4      var_ColorAmbient;
#endif

#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
varying vec4   var_Normal;
varying vec4   var_Tangent;
varying vec4   var_Bitangent;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
varying vec4      var_LightDir;
#endif

#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
varying vec4      var_PrimaryLightDir;
#endif


#define EPSILON 0.00000001

#if defined(USE_PARALLAXMAP)
float SampleDepth(sampler2D normalMap, vec2 t)
{
  #if defined(SWIZZLE_NORMALMAP)
	return 1.0 - texture2D(normalMap, t).r;
  #else
	return 1.0 - texture2D(normalMap, t).a;
  #endif
}

float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
{
	const int linearSearchSteps = 16;
	const int binarySearchSteps = 6;

	// current size of search window
	float size = 1.0 / float(linearSearchSteps);

	// current depth position
	float depth = 0.0;

	// best match found (starts with last position 1.0)
	float bestDepth = 1.0;

	// texture depth at best depth
	float texDepth = 0.0;

	float prevT = SampleDepth(normalMap, dp);
	float prevTexDepth = prevT;

	// search front to back for first point inside object
	for(int i = 0; i < linearSearchSteps - 1; ++i)
	{
		depth += size;
		
		float t = SampleDepth(normalMap, dp + ds * depth);
		
		if(bestDepth > 0.996)		// if no depth found yet
			if(depth >= t)
			{
				bestDepth = depth;	// store best depth
				texDepth = t;
				prevTexDepth = prevT;
			}
		prevT = t;
	}

	depth = bestDepth;

#if !defined (USE_RELIEFMAP)
	float div = 1.0 / (1.0 + (prevTexDepth - texDepth) * float(linearSearchSteps));
	bestDepth -= (depth - size - prevTexDepth) * div;
#else
	// recurse around first point (depth) for closest match
	for(int i = 0; i < binarySearchSteps; ++i)
	{
		size *= 0.5;

		float t = SampleDepth(normalMap, dp + ds * depth);
		
		if(depth >= t)
		{
			bestDepth = depth;
			depth -= 2.0 * size;
		}

		depth += size;
	}
#endif

	return bestDepth;
}
#endif

vec3 CalcDiffuse(vec3 diffuseAlbedo, float NH, float EH, float roughness)
{
#if defined(USE_BURLEY)
	// modified from https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf
	float fd90 = -0.5 + EH * EH * roughness;
	float burley = 1.0 + fd90 * 0.04 / NH;
	burley *= burley;
	return diffuseAlbedo * burley;
#else
	return diffuseAlbedo;
#endif
}

vec3 EnvironmentBRDF(float roughness, float NE, vec3 specular)
{
	// from http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
	float v = 1.0 - max(roughness, NE);
	v *= v * v;
	return vec3(v) + specular;
}

vec3 CalcSpecular(vec3 specular, float NH, float EH, float roughness)
{
	// from http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
	float rr = roughness*roughness;
	float rrrr = rr*rr;
	float d = (NH * NH) * (rrrr - 1.0) + 1.0;
	float v = (EH * EH) * (roughness + 0.5);
	return specular * (rrrr / (4.0 * d * d * v));
}


float CalcLightAttenuation(float point, float normDist)
{
	// zero light at 1.0, approximating q3 style
	// also don't attenuate directional light
	float attenuation = (0.5 * normDist - 1.5) * point + 1.0;

	// clamp attenuation
	#if defined(NO_LIGHT_CLAMP)
	attenuation = max(attenuation, 0.0);
	#else
	attenuation = clamp(attenuation, 0.0, 1.0);
	#endif

	return attenuation;
}


void main()
{
	vec3 viewDir, lightColor, ambientColor, reflectance;
	vec3 L, N, E, H;
	float NL, NH, NE, EH, attenuation;

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
	mat3 tangentToWorld = mat3(var_Tangent.xyz, var_Bitangent.xyz, var_Normal.xyz);
	viewDir = vec3(var_Normal.w, var_Tangent.w, var_Bitangent.w);
	E = normalize(viewDir);
#endif

	lightColor = var_Color.rgb;

#if defined(USE_LIGHTMAP)
	vec4 lightmapColor = texture2D(u_LightMap, var_TexCoords.zw);
  #if defined(RGBM_LIGHTMAP)
	lightmapColor.rgb *= lightmapColor.a;
  #endif
  #if defined(USE_PBR) && !defined(USE_FAST_LIGHT)
	lightmapColor.rgb *= lightmapColor.rgb;
  #endif
	lightColor *= lightmapColor.rgb;
#endif

	vec2 texCoords = var_TexCoords.xy;

#if defined(USE_PARALLAXMAP)
	vec3 offsetDir = viewDir * tangentToWorld;

	offsetDir.xy *= -u_NormalScale.a / offsetDir.z;

	texCoords += offsetDir.xy * RayIntersectDisplaceMap(texCoords, offsetDir.xy, u_NormalMap);
#endif

	vec4 diffuse = texture2D(u_DiffuseMap, texCoords);
	
	float alpha = diffuse.a * var_Color.a;
	if (u_AlphaTest == 1)
	{
		if (alpha == 0.0)
			discard;
	}
	else if (u_AlphaTest == 2)
	{
		if (alpha >= 0.5)
			discard;
	}
	else if (u_AlphaTest == 3)
	{
		if (alpha < 0.5)
			discard;
	}

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
	L = var_LightDir.xyz;
  #if defined(USE_DELUXEMAP)
	L += (texture2D(u_DeluxeMap, var_TexCoords.zw).xyz - vec3(0.5)) * u_EnableTextures.y;
  #endif
	float sqrLightDist = dot(L, L);
	L /= sqrt(sqrLightDist);

  #if defined(USE_LIGHT_VECTOR)
	attenuation  = CalcLightAttenuation(float(var_LightDir.w > 0.0), var_LightDir.w / sqrLightDist);
  #else
	attenuation  = 1.0;
  #endif

  #if defined(USE_NORMALMAP)
    #if defined(SWIZZLE_NORMALMAP)
	N.xy = texture2D(u_NormalMap, texCoords).ag - vec2(0.5);
    #else
	N.xy = texture2D(u_NormalMap, texCoords).rg - vec2(0.5);
    #endif
	N.xy *= u_NormalScale.xy;
	N.z = sqrt(clamp((0.25 - N.x * N.x) - N.y * N.y, 0.0, 1.0));
	N = tangentToWorld * N;
  #else
	N = var_Normal.xyz;
  #endif

	N = normalize(N);

  #if defined(USE_SHADOWMAP) 
	vec2 shadowTex = gl_FragCoord.xy * r_FBufScale;
	float shadowValue = texture2D(u_ShadowMap, shadowTex).r;

	// surfaces not facing the light are always shadowed
	shadowValue *= clamp(dot(N, var_PrimaryLightDir.xyz), 0.0, 1.0);

    #if defined(SHADOWMAP_MODULATE)
	lightColor *= shadowValue * (1.0 - u_PrimaryLightAmbient.r) + u_PrimaryLightAmbient.r;
    #endif
  #endif

  #if !defined(USE_LIGHT_VECTOR)
	ambientColor = lightColor;
	float surfNL = clamp(dot(var_Normal.xyz, L), 0.0, 1.0);

	// reserve 25% ambient to avoid black areas on normalmaps
	lightColor *= 0.75;

	// Scale the incoming light to compensate for the baked-in light angle
	// attenuation.
	lightColor /= max(surfNL, 0.25);

	// Recover any unused light as ambient, in case attenuation is over 4x or
	// light is below the surface
	ambientColor = max(ambientColor - lightColor * surfNL, vec3(0.0));
  #else
	ambientColor = var_ColorAmbient.rgb;
  #endif

	NL = clamp(dot(N, L), 0.0, 1.0);
	NE = clamp(dot(N, E), 0.0, 1.0);

  #if defined(USE_SPECULARMAP)
	vec4 specular = texture2D(u_SpecularMap, texCoords);
  #else
	vec4 specular = vec4(1.0);
  #endif
	specular *= u_SpecularScale;

  #if defined(USE_PBR)
	diffuse.rgb *= diffuse.rgb;
  #endif

  #if defined(USE_PBR)
	// diffuse rgb is base color
	// specular red is gloss
	// specular green is metallicness
	float gloss = specular.r;
	float metal = specular.g;
	specular.rgb = metal * diffuse.rgb + vec3(0.04 - 0.04 * metal);
	diffuse.rgb *= 1.0 - metal;
  #else
	// diffuse rgb is diffuse
	// specular rgb is specular reflectance at normal incidence
	// specular alpha is gloss
	float gloss = specular.a;

	// adjust diffuse by specular reflectance, to maintain energy conservation
	diffuse.rgb *= vec3(1.0) - specular.rgb;
  #endif

  #if defined(GLOSS_IS_GLOSS)
	float roughness = exp2(-3.0 * gloss);
  #elif defined(GLOSS_IS_SMOOTHNESS)
	float roughness = 1.0 - gloss;
  #elif defined(GLOSS_IS_ROUGHNESS)
	float roughness = gloss;
  #elif defined(GLOSS_IS_SHININESS)
	float roughness = pow(2.0 / (8190.0 * gloss + 2.0), 0.25);
  #endif

	reflectance  = CalcDiffuse(diffuse.rgb, NH, EH, roughness);

	gl_FragColor.rgb  = lightColor   * reflectance * (attenuation * NL);
	gl_FragColor.rgb += ambientColor * diffuse.rgb;

  #if defined(USE_CUBEMAP)
	reflectance = EnvironmentBRDF(roughness, NE, specular.rgb);

	vec3 R = reflect(E, N);

	// parallax corrected cubemap (cheaper trick)
	// from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
	vec3 parallax = u_CubeMapInfo.xyz + u_CubeMapInfo.w * viewDir;

	vec3 cubeLightColor = textureCubeLod(u_CubeMap, R + parallax, ROUGHNESS_MIPS * roughness).rgb * u_EnableTextures.w;

	// normalize cubemap based on last roughness mip (~diffuse)
	// multiplying cubemap values by lighting below depends on either this or the cubemap being normalized at generation
	//vec3 cubeLightDiffuse = max(textureCubeLod(u_CubeMap, N, ROUGHNESS_MIPS).rgb, 0.5 / 255.0);
	//cubeLightColor /= dot(cubeLightDiffuse, vec3(0.2125, 0.7154, 0.0721));

    #if defined(USE_PBR)
	cubeLightColor *= cubeLightColor;
    #endif

	// multiply cubemap values by lighting
	// not technically correct, but helps make reflections look less unnatural
	//cubeLightColor *= lightColor * (attenuation * NL) + ambientColor;

	gl_FragColor.rgb += cubeLightColor * reflectance;
  #endif

  #if defined(USE_PRIMARY_LIGHT) || defined(SHADOWMAP_MODULATE)
	vec3 L2, H2;
	float NL2, EH2, NH2;

	L2 = var_PrimaryLightDir.xyz;

	// enable when point lights are supported as primary lights
	//sqrLightDist = dot(L2, L2);
	//L2 /= sqrt(sqrLightDist);

	NL2 = clamp(dot(N, L2), 0.0, 1.0);
	H2 = normalize(L2 + E);
	EH2 = clamp(dot(E, H2), 0.0, 1.0);
	NH2 = clamp(dot(N, H2), 0.0, 1.0);

	reflectance  = CalcSpecular(specular.rgb, NH2, EH2, roughness);

	// bit of a hack, with modulated shadowmaps, ignore diffuse
    #if !defined(SHADOWMAP_MODULATE)
	reflectance += CalcDiffuse(diffuse.rgb, NH2, EH2, roughness);
    #endif

	lightColor = u_PrimaryLightColor;

    #if defined(USE_SHADOWMAP)
	lightColor *= shadowValue;
    #endif

	// enable when point lights are supported as primary lights
	//lightColor *= CalcLightAttenuation(float(u_PrimaryLightDir.w > 0.0), u_PrimaryLightDir.w / sqrLightDist);

	gl_FragColor.rgb += lightColor * reflectance * NL2;
  #endif

  #if defined(USE_PBR)
	gl_FragColor.rgb = sqrt(gl_FragColor.rgb);
  #endif

#else

	gl_FragColor.rgb = diffuse.rgb * lightColor;

#endif

	gl_FragColor.a = alpha;
}

Shader info log:
0:352(41): warning: `NH' used uninitialized
0:352(45): warning: `EH' used uninitialized
0:366(24): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:366(24): error: type mismatch
0:366(24): error: operands to arithmetic operators must be numeric
0:381(22): warning: `cubeLightColor' used uninitialized

********************
ERROR: Couldn't compile shader
********************
RE_Shutdown( 0 )
Hunk_Clear: reset the hunk ok
----- R_Init -----
------- FBO_Init -------
------- GLSL_InitGPUShaders -------
Shader source:
#version 120
#define shadow2D(a,b) shadow2D(a,b).r 
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef deformGen_t
#define deformGen_t
#define DGEN_WAVE_SIN 1
#define DGEN_WAVE_SQUARE 2
#define DGEN_WAVE_TRIANGLE 3
#define DGEN_WAVE_SAWTOOTH 4
#define DGEN_WAVE_INVERSE_SAWTOOTH 5
#define DGEN_BULGE 7
#define DGEN_MOVE 8
#endif
#ifndef tcGen_t
#define tcGen_t
#define TCGEN_LIGHTMAP 2
#define TCGEN_TEXTURE 3
#define TCGEN_ENVIRONMENT_MAPPED 4
#define TCGEN_FOG 5
#define TCGEN_VECTOR 6
#endif
#ifndef colorGen_t
#define colorGen_t
#define CGEN_LIGHTING_DIFFUSE 11
#endif
#ifndef alphaGen_t
#define alphaGen_t
#define AGEN_LIGHTING_SPECULAR 6
#define AGEN_PORTAL 8
#endif
#ifndef texenv_t
#define texenv_t
#define TEXENV_MODULATE 8448
#define TEXENV_ADD 260
#define TEXENV_REPLACE 7681
#endif
#ifndef r_FBufScale
#define r_FBufScale vec2(0.000732, 0.001302)
#endif
#define ROUGHNESS_MIPS float(6)
#define USE_LIGHT
#define USE_LIGHTMAP
#define USE_DELUXEMAP
#define USE_NORMALMAP
#define USE_SPECULARMAP
#define USE_CUBEMAP
#define GLOSS_IS_SMOOTHNESS
#line 0
uniform sampler2D u_DiffuseMap;

#if defined(USE_LIGHTMAP)
uniform sampler2D u_LightMap;
#endif

#if defined(USE_NORMALMAP)
uniform sampler2D u_NormalMap;
#endif

#if defined(USE_DELUXEMAP)
uniform sampler2D u_DeluxeMap;
#endif

#if defined(USE_SPECULARMAP)
uniform sampler2D u_SpecularMap;
#endif

#if defined(USE_SHADOWMAP)
uniform sampler2D u_ShadowMap;
#endif

#if defined(USE_CUBEMAP)
uniform samplerCube u_CubeMap;
#endif

#if defined(USE_NORMALMAP) || defined(USE_DELUXEMAP) || defined(USE_SPECULARMAP) || defined(USE_CUBEMAP)
// y = deluxe, w = cube
uniform vec4      u_EnableTextures; 
#endif

#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
uniform vec3  u_PrimaryLightColor;
uniform vec3  u_PrimaryLightAmbient;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
uniform vec4      u_NormalScale;
uniform vec4      u_SpecularScale;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_CUBEMAP)
uniform vec4      u_CubeMapInfo;
#endif
#endif

uniform int       u_AlphaTest;

varying vec4      var_TexCoords;

varying vec4      var_Color;
#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
varying vec4      var_ColorAmbient;
#endif

#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
varying vec4   var_Normal;
varying vec4   var_Tangent;
varying vec4   var_Bitangent;
#endif

#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
varying vec4      var_LightDir;
#endif

#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
varying vec4      var_PrimaryLightDir;
#endif


#define EPSILON 0.00000001

…cut

	vec3 R = reflect(E, N);

	// parallax corrected cubemap (cheaper trick)
	// from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
	vec3 parallax = u_CubeMapInfo.xyz + u_CubeMapInfo.w * viewDir;

	vec3 cubeLightColor = textureCubeLod(u_CubeMap, R + parallax, ROUGHNESS_MIPS * roughness).rgb * u_EnableTextures.w;

	// normalize cubemap based on last roughness mip (~diffuse)
	// multiplying cubemap values by lighting below depends on either this or the cubemap being normalized at generation
	//vec3 cubeLightDiffuse = max(textureCubeLod(u_CubeMap, N, ROUGHNESS_MIPS).rgb, 0.5 / 255.0);
	//cubeLightColor /= dot(cubeLightDiffuse, vec3(0.2125, 0.7154, 0.0721));

    #if defined(USE_PBR)
	cubeLightColor *= cubeLightColor;
    #endif

	// multiply cubemap values by lighting
	// not technically correct, but helps make reflections look less unnatural
	//cubeLightColor *= lightColor * (attenuation * NL) + ambientColor;

	gl_FragColor.rgb += cubeLightColor * reflectance;
  #endif

  #if defined(USE_PRIMARY_LIGHT) || defined(SHADOWMAP_MODULATE)
	vec3 L2, H2;
	float NL2, EH2, NH2;

	L2 = var_PrimaryLightDir.xyz;

	// enable when point lights are supported as primary lights
	//sqrLightDist = dot(L2, L2);
	//L2 /= sqrt(sqrLightDist);

	NL2 = clamp(dot(N, L2), 0.0, 1.0);
	H2 = normalize(L2 + E);
	EH2 = clamp(dot(E, H2), 0.0, 1.0);
	NH2 = clamp(dot(N, H2), 0.0, 1.0);

	reflectance  = CalcSpecular(specular.rgb, NH2, EH2, roughness);

	// bit of a hack, with modulated shadowmaps, ignore diffuse
    #if !defined(SHADOWMAP_MODULATE)
	reflectance += CalcDiffuse(diffuse.rgb, NH2, EH2, roughness);
    #endif

	lightColor = u_PrimaryLightColor;

    #if defined(USE_SHADOWMAP)
	lightColor *= shadowValue;
    #endif

	// enable when point lights are supported as primary lights
	//lightColor *= CalcLightAttenuation(float(u_PrimaryLightDir.w > 0.0), u_PrimaryLightDir.w / sqrLightDist);

	gl_FragColor.rgb += lightColor * reflectance * NL2;
  #endif

  #if defined(USE_PBR)
	gl_FragColor.rgb = sqrt(gl_FragColor.rgb);
  #endif

#else

	gl_FragColor.rgb = diffuse.rgb * lightColor;

#endif

	gl_FragColor.a = alpha;
}

Shader info log:
0:352(41): warning: `NH' used uninitialized
0:352(45): warning: `EH' used uninitialized
0:366(24): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:366(24): error: type mismatch
0:366(24): error: operands to arithmetic operators must be numeric
0:381(22): warning: `cubeLightColor' used uninitialized

recursive error after: Couldn't compile shader
3 Likes

Hi @bitflow can you post (pastebin? https://p.grangerhub.org ) your actual .mtr, also is there anything weird about the assets you’re using?

What program are using to save the assets? Do the TGAs have alpha channels?

2 Likes

I haven’t worked much with .mtr files, but I’d like to add that this can be a helpful resource for that subject:

3 Likes

Hi @romdos, pastebin gave me error so I’m pasting here…the textures are created in gimp and they have both alpha channel, but now I notice that diffuse stage map (karith/base_wall) is jpg…maybe that can lead the compiler to error?
Here are the textures:
http://cauldron.altervista.org/trem/base_wall_local.tga
http://cauldron.altervista.org/trem/base_wall_s.tga

and karith.mtr

// written for ioquake3/renderergl2 by mega, aka odin
// original by evillair
textures/karith/base_wall
{
	qer_editorimage textures/karith/base_wall
	{
		map textures/karith/base_wall
	}
	{
		stage normalmap
		map textures/karith/gl2/base_wall_local
	}
	{
		stage specularmap
		map textures/karith/gl2/base_wall_s
		specularreflectance 0.52050
		specularexponent 128
	}
	{
		map $lightmap
		blendfunc filter
	}
}
3 Likes

Also @bitflow how are you trying to load these files? Did you package things up as a pk3 or using a .pk3dir folder?

3 Likes

The only thing different about the attached files is they have no alpha channel,
butttt

Also I threw the original Karith texture into BMP2MAT and then also rendered out a quick normal map from Blender for hard detail, composited together in GIMP…
The result looks like:

Included as a .tga along with the originals (minus alpha channels):
base_wall_local_and _s.zip (1.1 MB)

Looks pretty ok in Blender:

4 Likes

I’m working with unpacked pk3 in user folder, not the install dir but .tremulous in home folder. Then I run the map with +set sv_pure 0

3 Likes

Nice bumping on your version!! I can notice now the bump in game…but no specular…maybe becouse I’m not using lights but textures with light shader…for example karith/e8tinylight ?
Also if I enable r_cubemapping 1 I get a strange compilation error when I start the map…

4 Likes

Any difference using \devmap karith ? I don’t know if it makes a difference to use an “unpacked” file vs using a karith.pk3dir folder (as a subfolder inside of .tremulous\base\ - and it’s own subfolders would be like textures, scripts, etc) - have you tried that?

3 Likes

Yes I am using devmap mapname …but I’m not trying this shader on map karith…but on my map…which I’m trying to renew after some years…I think it shouldn’t make difference. I never used to do that folder trick…I didn’t even know it was possible…I always used “base” even if now I’m working in gpp folder…and i never had issue apart from this…but I can try…

3 Likes

If you want, try packaging everything new up and send to me and I’ll see if I can make it work

4 Likes

You are mixing GLSL files. Please use stock ioQ3 or use build-in GLSL files

2 Likes