Spot lights geometry improvement, LodLights cone angles and game crash fixes

This commit is contained in:
dexy
2021-05-01 21:17:43 +10:00
Unverified
parent ea876743bc
commit 77e036e750
10 changed files with 178 additions and 24 deletions
+3 -3
View File
@@ -49,9 +49,9 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
else if (InstType == 2)//spot (cone)
{
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);
float3 tpos = (ipos.xyz * sin(arads)) + float3(0, 0, ipos.w * cos(arads));
float3 cpos = ((ipos.w > 0) ? normalize(tpos) : tpos) * extent;
opos = (cpos.x * InstTangentX) + (cpos.y * InstTangentY) + (cpos.z * InstDirection);
}
else if (InstType == 4)//capsule
{
+3 -3
View File
@@ -47,9 +47,9 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
else if (LightType == 2)//spot (cone)
{
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);
float3 tpos = (ipos.xyz * sin(arads)) + float3(0, 0, ipos.w * cos(arads));
float3 cpos = ((ipos.w>0) ? normalize(tpos) : tpos) * extent;
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.TangentY.xyz) + (cpos.z * lodlight.Direction.xyz);
}
else if (LightType == 4)//capsule
{