Browse Source

Remove specular color from lights

Panagiotis Christopoulos Charitos 7 years ago
parent
commit
99b242af72

+ 9 - 11
programs/DeferredShading.ankiprog

@@ -55,7 +55,6 @@ struct PointLight
 {
 {
 	vec4 posRadius; // xyz: Light pos in world space. w: The -1/radius
 	vec4 posRadius; // xyz: Light pos in world space. w: The -1/radius
 	vec4 diffuseColorPad1; // xyz: diff color
 	vec4 diffuseColorPad1; // xyz: diff color
-	vec4 specularColorPad1; // xyz: spec color
 };
 };
 
 
 // Spot light
 // Spot light
@@ -63,8 +62,7 @@ struct SpotLight
 {
 {
 	vec4 posRadius; // xyz: Light pos in world space. w: The -1/radius
 	vec4 posRadius; // xyz: Light pos in world space. w: The -1/radius
 	vec4 diffuseColorOuterCos; // xyz: diff color, w: outer cosine of spot
 	vec4 diffuseColorOuterCos; // xyz: diff color, w: outer cosine of spot
-	vec4 specularColorInnerCos; // xyz: spec color, w: inner cosine of spot
-	vec4 lightDirPad1;
+	vec4 lightDirInnerCos; // xyz: light dir, w: inner cosine of spot
 };
 };
 
 
 layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_msRt0;
 layout(ANKI_TEX_BINDING(0, 0)) uniform sampler2D u_msRt0;
@@ -82,16 +80,18 @@ layout(ANKI_UBO_BINDING(0, 1), row_major) uniform u1_
 #elif LIGHT_TYPE == SPOT_LIGHT_TYPE
 #elif LIGHT_TYPE == SPOT_LIGHT_TYPE
 	SpotLight u_light;
 	SpotLight u_light;
 #else
 #else
-#error See file
+#	error See file
 #endif
 #endif
 };
 };
 
 
 #if LIGHT_TYPE == POINT_LIGHT_TYPE
 #if LIGHT_TYPE == POINT_LIGHT_TYPE
-#define u_ldiff u_light.diffuseColorPad1.xyz
-#define u_lspec u_light.specularColorPad1.xyz
+#	define u_ldiff u_light.diffuseColorPad1.xyz
 #else
 #else
-#define u_ldiff u_light.diffuseColorOuterCos.xyz
-#define u_lspec u_light.specularColorInnerCos.xyz
+#	define u_ldiff u_light.diffuseColorOuterCos.xyz
+#	define u_lightDir u_light.lightDirInnerCos.xyz
+#	define u_outerCos u_light.diffuseColorOuterCos.w
+#	define u_innerCos u_light.lightDirInnerCos.w
+#	define u_lightDir u_light.lightDirInnerCos.xyz
 #endif
 #endif
 
 
 #define u_camPos u_camPosPad1.xyz
 #define u_camPos u_camPosPad1.xyz
@@ -131,9 +131,7 @@ void main()
 #if LIGHT_TYPE == POINT_LIGHT_TYPE
 #if LIGHT_TYPE == POINT_LIGHT_TYPE
 	out_color = (specC + diffC) * u_ldiff * (att * max(lambert, gbuffer.subsurface));
 	out_color = (specC + diffC) * u_ldiff * (att * max(lambert, gbuffer.subsurface));
 #else
 #else
-	float spot =
-		computeSpotFactor(l, u_light.diffuseColorOuterCos.w, u_light.specularColorInnerCos.w, u_light.lightDirPad1.xyz);
-
+	float spot = computeSpotFactor(l, u_outerCos, u_innerCos, u_lightDir);
 	out_color = (diffC + specC) * u_ldiff * (att * spot * max(lambert, gbuffer.subsurface));
 	out_color = (diffC + specC) * u_ldiff * (att * spot * max(lambert, gbuffer.subsurface));
 #endif
 #endif
 }
 }

+ 6 - 6
programs/LightShading.ankiprog

@@ -113,17 +113,17 @@ void main()
 
 
 		LIGHTING_COMMON_BRDF();
 		LIGHTING_COMMON_BRDF();
 
 
-		if(light.diffuseColorShadowmapId.w >= 0.0)
+		if(light.diffuseColorTileSize.w >= 0.0)
 		{
 		{
 			float shadow = computeShadowFactorOmni(frag2Light, 
 			float shadow = computeShadowFactorOmni(frag2Light, 
-				light.specularColorRadius.w, 
+				light.radiusPad3.x, 
 				light.atlasTilesPad2.xy, 
 				light.atlasTilesPad2.xy, 
-				light.diffuseColorShadowmapId.w,
+				light.diffuseColorTileSize.w,
 				u_shadowTex);
 				u_shadowTex);
 			lambert *= shadow;
 			lambert *= shadow;
 		}
 		}
 
 
-		outC += (diffC + specC) * light.diffuseColorShadowmapId.rgb * (att * max(gbuffer.subsurface, lambert));
+		outC += (diffC + specC) * light.diffuseColorTileSize.rgb * (att * max(gbuffer.subsurface, lambert));
 	}
 	}
 
 
 	// Spot lights
 	// Spot lights
@@ -135,13 +135,13 @@ void main()
 		LIGHTING_COMMON_BRDF();
 		LIGHTING_COMMON_BRDF();
 
 
 		float spot = computeSpotFactor(
 		float spot = computeSpotFactor(
-			l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDir.xyz);
+			l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDirRadius.xyz);
 
 
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		if(shadowmapLayerIdx >= 0.0)
 		if(shadowmapLayerIdx >= 0.0)
 		{
 		{
 			float shadow = computeShadowFactorSpot(
 			float shadow = computeShadowFactorSpot(
-				light.texProjectionMat, worldPos, light.specularColorRadius.w, u_shadowTex);
+				light.texProjectionMat, worldPos, light.lightDirRadius.w, u_shadowTex);
 			lambert *= shadow;
 			lambert *= shadow;
 		}
 		}
 
 

+ 6 - 6
programs/VolumetricFog.ankiprog

@@ -73,17 +73,17 @@ vec3 computeLightColor(vec3 fragPos, uint plightCount, uint plightIdx, uint slig
 		float factor = computeAttenuationFactor(light.posRadius.w, frag2Light);
 		float factor = computeAttenuationFactor(light.posRadius.w, frag2Light);
 
 
 #if ENABLE_SHADOWS
 #if ENABLE_SHADOWS
-		if(light.diffuseColorShadowmapId.w >= 0.0)
+		if(light.diffuseColorTileSize.w >= 0.0)
 		{
 		{
 			factor *= computeShadowFactorOmni(frag2Light, 
 			factor *= computeShadowFactorOmni(frag2Light, 
-				-1.0 / light.posRadius.w, 
+				light.radiusPad3.x, 
 				light.atlasTilesPad2.xy,
 				light.atlasTilesPad2.xy,
-				light.diffuseColorShadowmapId.w,
+				light.diffuseColorTileSize.w,
 				u_shadowTex);
 				u_shadowTex);
 		}
 		}
 #endif
 #endif
 
 
-		outColor += light.diffuseColorShadowmapId.rgb * factor;
+		outColor += light.diffuseColorTileSize.rgb * factor;
 	}
 	}
 
 
 	// Spot lights
 	// Spot lights
@@ -95,14 +95,14 @@ vec3 computeLightColor(vec3 fragPos, uint plightCount, uint plightIdx, uint slig
 
 
 		vec3 l = normalize(frag2Light);
 		vec3 l = normalize(frag2Light);
 
 
-		factor *= computeSpotFactor(l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDir.xyz);
+		factor *= computeSpotFactor(l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDirRadius.xyz);
 
 
 #if ENABLE_SHADOWS
 #if ENABLE_SHADOWS
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		if(shadowmapLayerIdx >= 0.0)
 		if(shadowmapLayerIdx >= 0.0)
 		{
 		{
 			factor *= computeShadowFactorSpot(
 			factor *= computeShadowFactorSpot(
-				light.texProjectionMat, fragPos, light.specularColorRadius.w, u_shadowTex);
+				light.texProjectionMat, fragPos, light.lightDirRadius.w, u_shadowTex);
 		}
 		}
 #endif
 #endif
 
 

+ 0 - 1
samples/simple_scene/assets/scene.lua

@@ -62,7 +62,6 @@ node:getSceneNodeBase():getMoveComponent():setLocalTransform(trf)
 node = scene:newPointLightNode("Point")
 node = scene:newPointLightNode("Point")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(10, 10, 10, 1))
 lcomp:setDiffuseColor(Vec4.new(10, 10, 10, 1))
-lcomp:setSpecularColor(Vec4.new(10, 10, 10, 1))
 lcomp:setRadius(12.77)
 lcomp:setRadius(12.77)
 trf = Transform.new()
 trf = Transform.new()
 trf:setOrigin(Vec4.new(0.0680842, 9.57987, 0.0302386, 0))
 trf:setOrigin(Vec4.new(0.0680842, 9.57987, 0.0302386, 0))

+ 0 - 5
samples/sponza/assets/scene.lua

@@ -2690,7 +2690,6 @@ node:getSceneNodeBase():getMoveComponent():setLocalTransform(trf)
 node = scene:newSpotLightNode("Lamp")
 node = scene:newSpotLightNode("Lamp")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(15, 15, 15, 1))
 lcomp:setDiffuseColor(Vec4.new(15, 15, 15, 1))
-lcomp:setSpecularColor(Vec4.new(15, 15, 15, 1))
 lcomp:setInnerAngle(0.737402)
 lcomp:setInnerAngle(0.737402)
 lcomp:setOuterAngle(1.4748)
 lcomp:setOuterAngle(1.4748)
 lcomp:setDistance(79.5799)
 lcomp:setDistance(79.5799)
@@ -2706,7 +2705,6 @@ lcomp:setShadowEnabled(1)
 node = scene:newPointLightNode("Point")
 node = scene:newPointLightNode("Point")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
-lcomp:setSpecularColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setRadius(4)
 lcomp:setRadius(4)
 trf = Transform.new()
 trf = Transform.new()
 trf:setOrigin(Vec4.new(8.54617, 2.49423, -3.8305, 0))
 trf:setOrigin(Vec4.new(8.54617, 2.49423, -3.8305, 0))
@@ -2723,7 +2721,6 @@ event:setFrequency(2, 0.02)
 node = scene:newPointLightNode("Point_001")
 node = scene:newPointLightNode("Point_001")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
-lcomp:setSpecularColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setRadius(4)
 lcomp:setRadius(4)
 trf = Transform.new()
 trf = Transform.new()
 trf:setOrigin(Vec4.new(8.54617, 2.49423, 2.5181, 0))
 trf:setOrigin(Vec4.new(8.54617, 2.49423, 2.5181, 0))
@@ -2740,7 +2737,6 @@ event:setFrequency(2, 0.02)
 node = scene:newPointLightNode("Point_002")
 node = scene:newPointLightNode("Point_002")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
-lcomp:setSpecularColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setRadius(4)
 lcomp:setRadius(4)
 trf = Transform.new()
 trf = Transform.new()
 trf:setOrigin(Vec4.new(-10.7834, 2.49423, 2.5181, 0))
 trf:setOrigin(Vec4.new(-10.7834, 2.49423, 2.5181, 0))
@@ -2757,7 +2753,6 @@ event:setFrequency(2, 0.02)
 node = scene:newPointLightNode("Point_003")
 node = scene:newPointLightNode("Point_003")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setDiffuseColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
-lcomp:setSpecularColor(Vec4.new(5.00188, 2.05202, 1.35254, 1))
 lcomp:setRadius(4)
 lcomp:setRadius(4)
 trf = Transform.new()
 trf = Transform.new()
 trf:setOrigin(Vec4.new(-10.7834, 2.49423, -3.84153, 0))
 trf:setOrigin(Vec4.new(-10.7834, 2.49423, -3.84153, 0))

+ 6 - 7
shaders/ClusterLightCommon.glsl

@@ -30,9 +30,9 @@ struct LightingUniforms
 // Point light
 // Point light
 struct PointLight
 struct PointLight
 {
 {
-	vec4 posRadius; // xyz: Light pos in view space. w: The -1/(radius^2)
-	vec4 diffuseColorShadowmapId; // xyz: diff color, w: tile size in the shadow atlas
-	vec4 specularColorRadius; // xyz: spec color, w: radius
+	vec4 posRadius; // xyz: Light pos in world space. w: The 1/(radius^2)
+	vec4 diffuseColorTileSize; // xyz: diff color, w: tile size in the shadow atlas
+	vec4 radiusPad3; // x: radius
 	uvec4 atlasTilesPad2; // x: encodes 6 uints with atlas tile indices in the x dir. y: same for y dir.
 	uvec4 atlasTilesPad2; // x: encodes 6 uints with atlas tile indices in the x dir. y: same for y dir.
 };
 };
 const uint POINT_LIGHT_SIZEOF = (4 * 4) * 4;
 const uint POINT_LIGHT_SIZEOF = (4 * 4) * 4;
@@ -40,14 +40,13 @@ const uint POINT_LIGHT_SIZEOF = (4 * 4) * 4;
 // Spot light
 // Spot light
 struct SpotLight
 struct SpotLight
 {
 {
-	vec4 posRadius; // xyz: Light pos in view space. w: The -1/(radius^2)
+	vec4 posRadius; // xyz: Light pos in world space. w: The 1/(radius^2)
 	vec4 diffuseColorShadowmapId; // xyz: diff color, w: shadowmap tex ID
 	vec4 diffuseColorShadowmapId; // xyz: diff color, w: shadowmap tex ID
-	vec4 specularColorRadius; // xyz: spec color, w: radius
-	vec4 lightDir;
+	vec4 lightDirRadius; // xyz: light direction, w: radius
 	vec4 outerCosInnerCos;
 	vec4 outerCosInnerCos;
 	mat4 texProjectionMat;
 	mat4 texProjectionMat;
 };
 };
-const uint SPOT_LIGHT_SIZEOF = (5 * 4 + 16) * 4;
+const uint SPOT_LIGHT_SIZEOF = (4 * 4 + 16) * 4;
 
 
 // Representation of a reflection probe
 // Representation of a reflection probe
 struct ReflectionProbe
 struct ReflectionProbe

+ 6 - 10
shaders/ForwardShadingCommonFrag.glsl

@@ -58,7 +58,7 @@ vec3 computeLightColor(vec3 diffCol, vec3 worldPos)
 	{
 	{
 		PointLight light = u_pointLights[u_lightIndices[idxOffset++]];
 		PointLight light = u_pointLights[u_lightIndices[idxOffset++]];
 
 
-		vec3 diffC = diffuseLambert(diffCol) * light.diffuseColorShadowmapId.rgb;
+		vec3 diffC = diffuseLambert(diffCol) * light.diffuseColorTileSize.rgb;
 
 
 		vec3 frag2Light = light.posRadius.xyz - worldPos;
 		vec3 frag2Light = light.posRadius.xyz - worldPos;
 		float att = computeAttenuationFactor(light.posRadius.w, frag2Light);
 		float att = computeAttenuationFactor(light.posRadius.w, frag2Light);
@@ -67,13 +67,10 @@ vec3 computeLightColor(vec3 diffCol, vec3 worldPos)
 		const float shadow = 1.0;
 		const float shadow = 1.0;
 #else
 #else
 		float shadow = 1.0;
 		float shadow = 1.0;
-		if(light.diffuseColorShadowmapId.w >= 0.0)
+		if(light.diffuseColorTileSize.w >= 0.0)
 		{
 		{
-			shadow = computeShadowFactorOmni(frag2Light,
-				light.specularColorRadius.w,
-				light.atlasTilesPad2.xy,
-				light.diffuseColorShadowmapId.w,
-				u_shadowTex);
+			shadow = computeShadowFactorOmni(
+				frag2Light, light.radiusPad3.x, light.atlasTilesPad2.xy, light.diffuseColorTileSize.w, u_shadowTex);
 		}
 		}
 #endif
 #endif
 
 
@@ -93,7 +90,7 @@ vec3 computeLightColor(vec3 diffCol, vec3 worldPos)
 
 
 		vec3 l = normalize(frag2Light);
 		vec3 l = normalize(frag2Light);
 
 
-		float spot = computeSpotFactor(l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDir.xyz);
+		float spot = computeSpotFactor(l, light.outerCosInnerCos.x, light.outerCosInnerCos.y, light.lightDirRadius.xyz);
 
 
 #if LOD > 1
 #if LOD > 1
 		const float shadow = 1.0;
 		const float shadow = 1.0;
@@ -102,8 +99,7 @@ vec3 computeLightColor(vec3 diffCol, vec3 worldPos)
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		float shadowmapLayerIdx = light.diffuseColorShadowmapId.w;
 		if(shadowmapLayerIdx >= 0.0)
 		if(shadowmapLayerIdx >= 0.0)
 		{
 		{
-			shadow =
-				computeShadowFactorSpot(light.texProjectionMat, worldPos, light.specularColorRadius.w, u_shadowTex);
+			shadow = computeShadowFactorSpot(light.texProjectionMat, worldPos, light.lightDirRadius.w, u_shadowTex);
 		}
 		}
 #endif
 #endif
 
 

+ 4 - 2
shaders/LightFunctions.glsl

@@ -99,7 +99,9 @@ float computeShadowFactorSpot(mat4 lightProjectionMat, vec3 worldPos, float dist
 
 
 	float linearDepth = linearizeDepth(texCoords3.z, near, far);
 	float linearDepth = linearizeDepth(texCoords3.z, near, far);
 
 
-	return clamp(exp(ESM_CONSTANT * (textureLod(spotMapArr, texCoords3.xy, 0.0).r - linearDepth)), 0.0, 1.0);
+	float shadowFactor = textureLod(spotMapArr, texCoords3.xy, 0.0).r;
+
+	return saturate(exp(ESM_CONSTANT * (shadowFactor - linearDepth)));
 }
 }
 
 
 float computeShadowFactorOmni(vec3 frag2Light, float radius, uvec2 atlasTiles, float tileSize, sampler2D shadowMap)
 float computeShadowFactorOmni(vec3 frag2Light, float radius, uvec2 atlasTiles, float tileSize, sampler2D shadowMap)
@@ -131,7 +133,7 @@ float computeShadowFactorOmni(vec3 frag2Light, float radius, uvec2 atlasTiles, f
 		shadowFactor = textureLod(shadowMap, uv, 0.0).r;
 		shadowFactor = textureLod(shadowMap, uv, 0.0).r;
 	}
 	}
 
 
-	return clamp(exp(ESM_CONSTANT * (shadowFactor - linearDepth)), 0.0, 1.0);
+	return saturate(exp(ESM_CONSTANT * (shadowFactor - linearDepth)));
 }
 }
 
 
 // Compute the cubemap texture lookup vector given the reflection vector (r) the radius squared of the probe (R2) and
 // Compute the cubemap texture lookup vector given the reflection vector (r) the radius squared of the probe (R2) and

+ 0 - 3
src/anki/event/LightEvent.cpp

@@ -32,7 +32,6 @@ Error LightEvent::init(F32 startTime, F32 duration, SceneNode* light)
 	}
 	}
 
 
 	m_originalDiffColor = lightc.getDiffuseColor();
 	m_originalDiffColor = lightc.getDiffuseColor();
-	m_originalSpecColor = lightc.getSpecularColor();
 
 
 	return Error::NONE;
 	return Error::NONE;
 }
 }
@@ -76,8 +75,6 @@ Error LightEvent::update(F32 prevUpdateTime, F32 crntTime)
 		lightc.setDiffuseColor(outCol);
 		lightc.setDiffuseColor(outCol);
 	}
 	}
 
 
-	lightc.setSpecularColor(m_originalSpecColor + factor * m_specularIntensityMultiplier);
-
 	return Error::NONE;
 	return Error::NONE;
 }
 }
 
 

+ 0 - 7
src/anki/event/LightEvent.h

@@ -42,11 +42,6 @@ public:
 		m_intensityMultiplier = v;
 		m_intensityMultiplier = v;
 	}
 	}
 
 
-	void setSpecularIntensityMultiplier(const Vec4& v)
-	{
-		m_specularIntensityMultiplier = v;
-	}
-
 	/// Set the frequency of changes.
 	/// Set the frequency of changes.
 	/// @param freq The higher it is the faster things happen.
 	/// @param freq The higher it is the faster things happen.
 	/// @param deviation Add a randomization to the frequency.
 	/// @param deviation Add a randomization to the frequency.
@@ -63,11 +58,9 @@ private:
 	F32 m_freqDeviation = 0.0;
 	F32 m_freqDeviation = 0.0;
 	F32 m_radiusMultiplier = 0.0;
 	F32 m_radiusMultiplier = 0.0;
 	Vec4 m_intensityMultiplier = Vec4(0.0);
 	Vec4 m_intensityMultiplier = Vec4(0.0);
-	Vec4 m_specularIntensityMultiplier = Vec4(0.0);
 
 
 	F32 m_originalRadius;
 	F32 m_originalRadius;
 	Vec4 m_originalDiffColor;
 	Vec4 m_originalDiffColor;
-	Vec4 m_originalSpecColor;
 };
 };
 /// @}
 /// @}
 
 

+ 2 - 7
src/anki/renderer/Indirect.cpp

@@ -27,7 +27,6 @@ struct Indirect::LightPassPointLightUniforms
 	Vec4 m_camPosPad1;
 	Vec4 m_camPosPad1;
 	Vec4 m_posRadius;
 	Vec4 m_posRadius;
 	Vec4 m_diffuseColorPad1;
 	Vec4 m_diffuseColorPad1;
-	Vec4 m_specularColorPad1;
 };
 };
 
 
 struct Indirect::LightPassSpotLightUniforms
 struct Indirect::LightPassSpotLightUniforms
@@ -37,8 +36,7 @@ struct Indirect::LightPassSpotLightUniforms
 	Vec4 m_camPosPad1;
 	Vec4 m_camPosPad1;
 	Vec4 m_posRadius;
 	Vec4 m_posRadius;
 	Vec4 m_diffuseColorOuterCos;
 	Vec4 m_diffuseColorOuterCos;
-	Vec4 m_specularColorInnerCos;
-	Vec4 m_lightDirPad1;
+	Vec4 m_lightDirInnerCos;
 };
 };
 
 
 Indirect::Indirect(Renderer* r)
 Indirect::Indirect(Renderer* r)
@@ -462,7 +460,6 @@ void Indirect::runLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
 			light->m_posRadius =
 			light->m_posRadius =
 				Vec4(plightEl->m_worldPosition.xyz(), 1.0f / (plightEl->m_radius * plightEl->m_radius));
 				Vec4(plightEl->m_worldPosition.xyz(), 1.0f / (plightEl->m_radius * plightEl->m_radius));
 			light->m_diffuseColorPad1 = plightEl->m_diffuseColor.xyz0();
 			light->m_diffuseColorPad1 = plightEl->m_diffuseColor.xyz0();
-			light->m_specularColorPad1 = plightEl->m_specularColor.xyz0();
 
 
 			// Draw
 			// Draw
 			cmdb->drawElements(PrimitiveTopology::TRIANGLES, indexCount);
 			cmdb->drawElements(PrimitiveTopology::TRIANGLES, indexCount);
@@ -509,10 +506,8 @@ void Indirect::runLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
 
 
 			light->m_diffuseColorOuterCos = Vec4(splightEl->m_diffuseColor, cos(splightEl->m_outerAngle / 2.0f));
 			light->m_diffuseColorOuterCos = Vec4(splightEl->m_diffuseColor, cos(splightEl->m_outerAngle / 2.0f));
 
 
-			light->m_specularColorInnerCos = Vec4(splightEl->m_specularColor, cos(splightEl->m_innerAngle / 2.0f));
-
 			Vec3 lightDir = -splightEl->m_worldTransform.getZAxis().xyz();
 			Vec3 lightDir = -splightEl->m_worldTransform.getZAxis().xyz();
-			light->m_lightDirPad1 = lightDir.xyz0();
+			light->m_lightDirInnerCos = Vec4(lightDir, cos(splightEl->m_innerAngle / 2.0f));
 
 
 			// Draw
 			// Draw
 			cmdb->drawElements(PrimitiveTopology::TRIANGLES, indexCount);
 			cmdb->drawElements(PrimitiveTopology::TRIANGLES, indexCount);

+ 5 - 9
src/anki/renderer/LightBin.cpp

@@ -30,7 +30,7 @@ class ShaderPointLight
 public:
 public:
 	Vec4 m_posRadius;
 	Vec4 m_posRadius;
 	Vec4 m_diffuseColorTileSize;
 	Vec4 m_diffuseColorTileSize;
-	Vec4 m_specularColorRadius;
+	Vec4 m_radiusPad3;
 	UVec4 m_atlasTilesPad2;
 	UVec4 m_atlasTilesPad2;
 };
 };
 
 
@@ -39,8 +39,7 @@ class ShaderSpotLight
 public:
 public:
 	Vec4 m_posRadius;
 	Vec4 m_posRadius;
 	Vec4 m_diffuseColorShadowmapId;
 	Vec4 m_diffuseColorShadowmapId;
-	Vec4 m_specularColorRadius;
-	Vec4 m_lightDir;
+	Vec4 m_lightDirRadius;
 	Vec4 m_outerCosInnerCos;
 	Vec4 m_outerCosInnerCos;
 	Mat4 m_texProjectionMat; ///< Texture projection matrix
 	Mat4 m_texProjectionMat; ///< Texture projection matrix
 };
 };
@@ -669,7 +668,7 @@ void LightBin::writeAndBinPointLight(
 		slight.m_atlasTilesPad2 = UVec4(lightEl.m_atlasTiles.x(), lightEl.m_atlasTiles.y(), 0, 0);
 		slight.m_atlasTilesPad2 = UVec4(lightEl.m_atlasTiles.x(), lightEl.m_atlasTiles.y(), 0, 0);
 	}
 	}
 
 
-	slight.m_specularColorRadius = Vec4(lightEl.m_specularColor, lightEl.m_radius);
+	slight.m_radiusPad3 = Vec4(lightEl.m_radius);
 
 
 	// Now bin it
 	// Now bin it
 	Sphere sphere(lightEl.m_worldPosition.xyz0(), lightEl.m_radius);
 	Sphere sphere(lightEl.m_worldPosition.xyz0(), lightEl.m_radius);
@@ -717,12 +716,9 @@ void LightBin::writeAndBinSpotLight(
 	// Diff color and shadowmap ID now
 	// Diff color and shadowmap ID now
 	light.m_diffuseColorShadowmapId = Vec4(lightEl.m_diffuseColor, shadowmapIndex);
 	light.m_diffuseColorShadowmapId = Vec4(lightEl.m_diffuseColor, shadowmapIndex);
 
 
-	// Spec color
-	light.m_specularColorRadius = Vec4(lightEl.m_specularColor, lightEl.m_distance);
-
-	// Light dir
+	// Light dir & radius
 	Vec3 lightDir = -lightEl.m_worldTransform.getRotationPart().getZAxis();
 	Vec3 lightDir = -lightEl.m_worldTransform.getRotationPart().getZAxis();
-	light.m_lightDir = Vec4(lightDir, 0.0f);
+	light.m_lightDirRadius = Vec4(lightDir, lightEl.m_distance);
 
 
 	// Angles
 	// Angles
 	light.m_outerCosInnerCos = Vec4(cos(lightEl.m_outerAngle / 2.0f), cos(lightEl.m_innerAngle / 2.0f), 1.0f, 1.0f);
 	light.m_outerCosInnerCos = Vec4(cos(lightEl.m_outerAngle / 2.0f), cos(lightEl.m_innerAngle / 2.0f), 1.0f, 1.0f);

+ 0 - 2
src/anki/renderer/RenderQueue.h

@@ -67,7 +67,6 @@ public:
 	Vec3 m_worldPosition;
 	Vec3 m_worldPosition;
 	F32 m_radius;
 	F32 m_radius;
 	Vec3 m_diffuseColor;
 	Vec3 m_diffuseColor;
-	Vec3 m_specularColor;
 	Array<RenderQueue*, 6> m_shadowRenderQueues;
 	Array<RenderQueue*, 6> m_shadowRenderQueues;
 	const void* m_userData;
 	const void* m_userData;
 	RenderQueueDrawCallback m_drawCallback;
 	RenderQueueDrawCallback m_drawCallback;
@@ -95,7 +94,6 @@ public:
 	F32 m_outerAngle;
 	F32 m_outerAngle;
 	F32 m_innerAngle;
 	F32 m_innerAngle;
 	Vec3 m_diffuseColor;
 	Vec3 m_diffuseColor;
-	Vec3 m_specularColor;
 	RenderQueue* m_shadowRenderQueue;
 	RenderQueue* m_shadowRenderQueue;
 	const void* m_userData;
 	const void* m_userData;
 	RenderQueueDrawCallback m_drawCallback;
 	RenderQueueDrawCallback m_drawCallback;

+ 0 - 13
src/anki/scene/components/LightComponent.h

@@ -55,16 +55,6 @@ public:
 		m_diffColor = x;
 		m_diffColor = x;
 	}
 	}
 
 
-	const Vec4& getSpecularColor() const
-	{
-		return m_specColor;
-	}
-
-	void setSpecularColor(const Vec4& x)
-	{
-		m_specColor = x;
-	}
-
 	void setRadius(F32 x)
 	void setRadius(F32 x)
 	{
 	{
 		m_radius = x;
 		m_radius = x;
@@ -140,7 +130,6 @@ public:
 		el.m_worldPosition = m_trf.getOrigin().xyz();
 		el.m_worldPosition = m_trf.getOrigin().xyz();
 		el.m_radius = m_radius;
 		el.m_radius = m_radius;
 		el.m_diffuseColor = m_diffColor.xyz();
 		el.m_diffuseColor = m_diffColor.xyz();
-		el.m_specularColor = m_specColor.xyz();
 		el.m_userData = this;
 		el.m_userData = this;
 		el.m_drawCallback = pointLightDebugDrawCallback;
 		el.m_drawCallback = pointLightDebugDrawCallback;
 	}
 	}
@@ -155,7 +144,6 @@ public:
 		el.m_outerAngle = m_outerAngle;
 		el.m_outerAngle = m_outerAngle;
 		el.m_innerAngle = m_innerAngle;
 		el.m_innerAngle = m_innerAngle;
 		el.m_diffuseColor = m_diffColor.xyz();
 		el.m_diffuseColor = m_diffColor.xyz();
-		el.m_specularColor = m_specColor.xyz();
 		el.m_userData = this;
 		el.m_userData = this;
 		el.m_drawCallback = spotLightDebugDrawCallback;
 		el.m_drawCallback = spotLightDebugDrawCallback;
 	}
 	}
@@ -163,7 +151,6 @@ public:
 private:
 private:
 	LightComponentType m_type;
 	LightComponentType m_type;
 	Vec4 m_diffColor = Vec4(0.5f);
 	Vec4 m_diffColor = Vec4(0.5f);
-	Vec4 m_specColor = Vec4(0.5f);
 	union
 	union
 	{
 	{
 		F32 m_radius;
 		F32 m_radius;

+ 0 - 95
src/anki/script/Scene.cpp

@@ -541,99 +541,6 @@ static int wrapLightComponentgetDiffuseColor(lua_State* l)
 	return 0;
 	return 0;
 }
 }
 
 
-/// Pre-wrap method LightComponent::setSpecularColor.
-static inline int pwrapLightComponentsetSpecularColor(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 2);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud))
-	{
-		return -1;
-	}
-
-	LightComponent* self = ud->getData<LightComponent>();
-
-	// Pop arguments
-	if(LuaBinder::checkUserData(l, 2, "Vec4", 6804478823655046386, ud))
-	{
-		return -1;
-	}
-
-	Vec4* iarg0 = ud->getData<Vec4>();
-	const Vec4& arg0(*iarg0);
-
-	// Call the method
-	self->setSpecularColor(arg0);
-
-	return 0;
-}
-
-/// Wrap method LightComponent::setSpecularColor.
-static int wrapLightComponentsetSpecularColor(lua_State* l)
-{
-	int res = pwrapLightComponentsetSpecularColor(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
-/// Pre-wrap method LightComponent::getSpecularColor.
-static inline int pwrapLightComponentgetSpecularColor(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 1);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud))
-	{
-		return -1;
-	}
-
-	LightComponent* self = ud->getData<LightComponent>();
-
-	// Call the method
-	const Vec4& ret = self->getSpecularColor();
-
-	// Push return value
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "Vec4");
-	ud->initPointed(6804478823655046386, const_cast<Vec4*>(&ret));
-
-	return 1;
-}
-
-/// Wrap method LightComponent::getSpecularColor.
-static int wrapLightComponentgetSpecularColor(lua_State* l)
-{
-	int res = pwrapLightComponentgetSpecularColor(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
 /// Pre-wrap method LightComponent::setRadius.
 /// Pre-wrap method LightComponent::setRadius.
 static inline int pwrapLightComponentsetRadius(lua_State* l)
 static inline int pwrapLightComponentsetRadius(lua_State* l)
 {
 {
@@ -1080,8 +987,6 @@ static inline void wrapLightComponent(lua_State* l)
 	LuaBinder::createClass(l, classnameLightComponent);
 	LuaBinder::createClass(l, classnameLightComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "setDiffuseColor", wrapLightComponentsetDiffuseColor);
 	LuaBinder::pushLuaCFuncMethod(l, "setDiffuseColor", wrapLightComponentsetDiffuseColor);
 	LuaBinder::pushLuaCFuncMethod(l, "getDiffuseColor", wrapLightComponentgetDiffuseColor);
 	LuaBinder::pushLuaCFuncMethod(l, "getDiffuseColor", wrapLightComponentgetDiffuseColor);
-	LuaBinder::pushLuaCFuncMethod(l, "setSpecularColor", wrapLightComponentsetSpecularColor);
-	LuaBinder::pushLuaCFuncMethod(l, "getSpecularColor", wrapLightComponentgetSpecularColor);
 	LuaBinder::pushLuaCFuncMethod(l, "setRadius", wrapLightComponentsetRadius);
 	LuaBinder::pushLuaCFuncMethod(l, "setRadius", wrapLightComponentsetRadius);
 	LuaBinder::pushLuaCFuncMethod(l, "getRadius", wrapLightComponentgetRadius);
 	LuaBinder::pushLuaCFuncMethod(l, "getRadius", wrapLightComponentgetRadius);
 	LuaBinder::pushLuaCFuncMethod(l, "setDistance", wrapLightComponentsetDistance);
 	LuaBinder::pushLuaCFuncMethod(l, "setDistance", wrapLightComponentsetDistance);

+ 0 - 8
src/anki/script/Scene.xml

@@ -87,14 +87,6 @@ static SceneGraph* getSceneGraph(lua_State* l)
 				<method name="getDiffuseColor">
 				<method name="getDiffuseColor">
 					<return>const Vec4&amp;</return>
 					<return>const Vec4&amp;</return>
 				</method>
 				</method>
-				<method name="setSpecularColor">
-					<args>
-						<arg>const Vec4&amp;</arg>
-					</args>
-				</method>
-				<method name="getSpecularColor">
-					<return>const Vec4&amp;</return>
-				</method>
 				<method name="setRadius">
 				<method name="setRadius">
 					<args>
 					<args>
 						<arg>F32</arg>
 						<arg>F32</arg>

+ 0 - 8
tools/scene/Exporter.cpp

@@ -473,14 +473,6 @@ void Exporter::exportLight(const aiLight& light)
 	aiVector3D linear(light.mColorDiffuse[0], light.mColorDiffuse[1], light.mColorDiffuse[2]);
 	aiVector3D linear(light.mColorDiffuse[0], light.mColorDiffuse[1], light.mColorDiffuse[2]);
 	file << "lcomp:setDiffuseColor(Vec4.new(" << linear[0] << ", " << linear[1] << ", " << linear[2] << ", 1))\n";
 	file << "lcomp:setDiffuseColor(Vec4.new(" << linear[0] << ", " << linear[1] << ", " << linear[2] << ", 1))\n";
 
 
-	// linear = computeLightColor(light.mColorSpecular);
-	if(light.mProperties.find("specular_color") != light.mProperties.end())
-	{
-		stringToFloatArray<3>(light.mProperties.at("specular_color"), linear);
-	}
-
-	file << "lcomp:setSpecularColor(Vec4.new(" << linear[0] << ", " << linear[1] << ", " << linear[2] << ", 1))\n";
-
 	// Geometry
 	// Geometry
 	aiVector3D direction(0.0, 0.0, 1.0);
 	aiVector3D direction(0.0, 0.0, 1.0);