Fixed light cone angles

This commit is contained in:
dexy 2019-12-04 01:28:58 +11:00
parent 9a53c2147b
commit f22826ea94
2 changed files with 2 additions and 2 deletions

View File

@ -50,8 +50,8 @@ VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
}
else if (LightType == 2)//spot (cone)
{
float arads = lodlight.OuterAngleOrCapExt * 0.01745329 * 1.5;//is this right?
float3 cpos = ipos.xyz * (atan(arads) * extent);
float arads = lodlight.OuterAngleOrCapExt * 0.01745329 * 0.5; // deg -> rad
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);
}

Binary file not shown.