38 lines
1.1 KiB
HLSL
38 lines
1.1 KiB
HLSL
#include "graphics_structs.hlsli"
|
|
|
|
struct PS_Input
|
|
{
|
|
float3 WorldPosition : POSITION;
|
|
};
|
|
|
|
struct PS_Output
|
|
{
|
|
float4 Color : SV_Target0;
|
|
};
|
|
|
|
PS_Output main(PS_Input StageInput)
|
|
{
|
|
PS_Output StageOutput;
|
|
|
|
float3 Direction = normalize(StageInput.WorldPosition - Camera.Position.xyz);
|
|
#ifndef _DEBUG
|
|
float4 Color = TextureCubes[Lights.EnvCubeHandle].Sample(ImmutableSamplers[Lights.EnvCubeHandle], Direction);
|
|
#else
|
|
float4 Color;
|
|
if ((PushConstant.DebugFlags & SHOW_DIFFUSE_BIT) > 0)
|
|
{
|
|
Color = TextureCubes[Lights.DiffuseIrradianceHandle].Sample(ImmutableSamplers[Lights.DiffuseIrradianceHandle], Direction);
|
|
}
|
|
else if ((PushConstant.DebugFlags & SHOW_PREFILTER_BIT) > 0)
|
|
{
|
|
Color = TextureCubes[Lights.PrefilterHandle].Sample(ImmutableSamplers[Lights.PrefilterHandle], Direction);
|
|
}
|
|
else
|
|
{
|
|
Color = TextureCubes[Lights.EnvCubeHandle].Sample(ImmutableSamplers[Lights.EnvCubeHandle], Direction);
|
|
}
|
|
#endif
|
|
StageOutput.Color = float4(Uncharted2Tonemap(Color.rgb), Color.a);
|
|
|
|
return StageOutput;
|
|
} |