Interior lights improvements

This commit is contained in:
dexy
2019-12-05 15:04:00 +11:00
Unverified
parent c6aa4c7baf
commit d59663d87e
10 changed files with 13 additions and 12 deletions
+4 -4
View File
@@ -103,8 +103,8 @@ float4 DeferredLODLight(float3 camRel, float3 norm, float4 diffuse, float4 specu
else if (LightType == 2)//spot (cone)
{
float ang = acos(-dot(ldir, lodlight.Direction));
float iang = lodlight.InnerAngle * 0.01745329 * 0.5;
float oang = lodlight.OuterAngleOrCapExt * 0.01745329 * 0.5;
float iang = lodlight.InnerAngle;
float oang = lodlight.OuterAngleOrCapExt;
if (ang > oang) return 0;
lamt *= saturate(1 - ((ang - iang) / (oang - iang)));
lamt *= pow(saturate(1 - (ldist / lodlight.Falloff)), lodlight.FalloffExponent);
@@ -148,8 +148,8 @@ float4 DeferredLight(float3 camRel, float3 norm, float4 diffuse, float4 specular
else if (InstType == 2)//spot (cone)
{
float ang = acos(-dot(ldir, InstDirection));
float iang = InstConeInnerAngle * 0.01745329 * 0.5;
float oang = InstConeOuterAngle * 0.01745329 * 0.5;
float iang = InstConeInnerAngle;
float oang = InstConeOuterAngle;
if (ang > oang) return 0;
lamt *= saturate(1 - ((ang - iang) / (oang - iang)));
lamt *= pow(saturate(1 - (ldist / InstFalloff)), InstFalloffExponent);
+1 -1
View File
@@ -48,7 +48,7 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
}
else if (InstType == 2)//spot (cone)
{
float arads = InstConeOuterAngle * 0.01745329 * 0.5; // deg -> rad
float arads = InstConeOuterAngle;
float3 cpos = ipos.xyz * (tan(arads) * extent);
cpos.y += ipos.w * extent;
opos = (cpos.x * InstTangentX) + (cpos.y * InstDirection) + (cpos.z * InstTangentY);
+2 -2
View File
@@ -46,7 +46,7 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
}
else if (LightType == 2)//spot (cone)
{
float arads = lodlight.OuterAngleOrCapExt * 0.01745329 * 0.5; // deg -> rad
float arads = lodlight.OuterAngleOrCapExt;
float3 cpos = ipos.xyz * (tan(arads) * extent);
cpos.y += ipos.w * extent;
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
@@ -54,7 +54,7 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
else if (LightType == 4)//capsule
{
float3 cpos = ipos.xyz * extent;
cpos.y += (ipos.w * 2 - 1) * lodlight.OuterAngleOrCapExt * 0.1;
cpos.y += (ipos.w * 2 - 1) * lodlight.OuterAngleOrCapExt;
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
}
opos += (lodlight.Position - CameraPos.xyz);