Refactor shadows rendering to use Shadow Map Atlas

This commit is contained in:
Wojtek Figat
2024-04-04 12:54:07 +02:00
parent 017def29d4
commit 61323f8526
31 changed files with 1115 additions and 1826 deletions

View File

@@ -43,55 +43,82 @@ struct RenderLightData
StaticFlags StaticFlags;
ShadowsCastingMode ShadowsMode;
float IndirectLightingIntensity;
int16 ShadowDataIndex = -1;
uint8 HasShadow : 1;
uint8 CastVolumetricShadow : 1;
uint8 RenderedVolumetricFog : 1;
uint8 UseInverseSquaredFalloff : 1;
uint8 IsDirectionalLight : 1;
uint8 IsPointLight : 1;
uint8 IsSpotLight : 1;
uint8 IsSkyLight : 1;
float VolumetricScatteringIntensity;
float ContactShadowsLength;
float ScreenSize;
uint32 ShadowsBufferAddress;
RenderLightData()
{
Platform::MemoryClear(this, sizeof(RenderLightData));
}
POD_COPYABLE(RenderLightData);
bool CanRenderShadow(const RenderView& view) const;
};
struct RenderDirectionalLightData : RenderLightData
{
PartitionMode PartitionMode;
int32 CascadeCount;
float Cascade1Spacing;
float Cascade2Spacing;
float Cascade3Spacing;
float Cascade4Spacing;
PartitionMode PartitionMode;
int32 CascadeCount;
RenderDirectionalLightData()
{
IsDirectionalLight = 1;
}
void SetShaderData(ShaderLightData& data, bool useShadow) const;
};
struct RenderSpotLightData : RenderLightData
struct RenderLocalLightData : RenderLightData
{
GPUTexture* IESTexture;
float Radius;
float SourceRadius;
bool CanRenderShadow(const RenderView& view) const;
};
struct RenderSpotLightData : RenderLocalLightData
{
Float3 UpVector;
float OuterConeAngle;
float CosOuterCone;
float InvCosConeDifference;
float FallOffExponent;
uint8 UseInverseSquaredFalloff : 1;
GPUTexture* IESTexture;
RenderSpotLightData()
{
IsSpotLight = 1;
}
void SetShaderData(ShaderLightData& data, bool useShadow) const;
};
struct RenderPointLightData : RenderLightData
struct RenderPointLightData : RenderLocalLightData
{
float Radius;
float SourceRadius;
float FallOffExponent;
float SourceLength;
uint8 UseInverseSquaredFalloff : 1;
GPUTexture* IESTexture;
RenderPointLightData()
{
IsPointLight = 1;
}
void SetShaderData(ShaderLightData& data, bool useShadow) const;
};
@@ -103,6 +130,11 @@ struct RenderSkyLightData : RenderLightData
CubeTexture* Image;
RenderSkyLightData()
{
IsSkyLight = 1;
}
void SetShaderData(ShaderLightData& data, bool useShadow) const;
};