Cleanup some old unused shader code

This commit is contained in:
Wojtek Figat
2020-12-20 10:22:54 +01:00
parent afeaaee376
commit 8a870a07ae
25 changed files with 199 additions and 685 deletions

View File

@@ -3,19 +3,13 @@
#ifndef __IES_PROFILE__
#define __IES_PROFILE__
// Apply 1D IES light profile texture
// Calculate IES light profile from 1D texture
float ComputeLightProfileMultiplier(Texture2D tex, float3 worldPosition, float3 lightPosition, float3 lightDirection)
{
float3 negLightDirection = normalize(worldPosition - lightPosition);
// -1..1
float dotProd = dot(negLightDirection, lightDirection);
// -PI..PI (this distortion could be put into the texture but not without quality loss or more memory)
float angle = asin(dotProd);
// 0..1
float normAngle = angle / PI + 0.5f;
return tex.SampleLevel(SamplerLinearClamp, float2(normAngle, 0), 0).r;
float3 l = normalize(worldPosition - lightPosition);
float d = dot(lightPosition, lightDirection);
float angle = asin(d) / PI + 0.5f;
return tex.SampleLevel(SamplerLinearClamp, float2(angle, 0), 0).r;
}
#endif