2020-10-01 19:46:25 +00:00
|
|
|
#include "Macros.fxh" // from FNA
|
|
|
|
|
|
|
|
DECLARE_TEXTURE(gPosition, 0);
|
|
|
|
DECLARE_TEXTURE(gAlbedo, 1);
|
|
|
|
|
2020-10-01 21:52:19 +00:00
|
|
|
BEGIN_CONSTANTS
|
|
|
|
|
|
|
|
float3 AmbientLightColor _ps(c0) _cb(c0);
|
|
|
|
|
|
|
|
END_CONSTANTS
|
|
|
|
|
2020-10-01 19:46:25 +00:00
|
|
|
struct VertexInput
|
|
|
|
{
|
|
|
|
float4 Position : POSITION;
|
|
|
|
float2 TexCoord : TEXCOORD;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PixelInput
|
|
|
|
{
|
|
|
|
float4 Position : SV_POSITION;
|
|
|
|
float2 TexCoord : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
PixelInput main_vs(VertexInput input)
|
|
|
|
{
|
|
|
|
PixelInput output;
|
|
|
|
|
|
|
|
output.Position = input.Position;
|
|
|
|
output.TexCoord = input.TexCoord;
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
float4 ComputeColor(
|
|
|
|
float3 worldPosition,
|
|
|
|
float3 albedo
|
|
|
|
) {
|
2020-10-01 21:52:19 +00:00
|
|
|
float3 color = AmbientLightColor * albedo;
|
2020-10-01 19:46:25 +00:00
|
|
|
return float4(color, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
float4 main_ps(PixelInput input) : SV_TARGET0
|
|
|
|
{
|
|
|
|
float3 worldPosition = SAMPLE_TEXTURE(gPosition, input.TexCoord).rgb;
|
|
|
|
float3 albedo = SAMPLE_TEXTURE(gAlbedo, input.TexCoord).rgb;
|
|
|
|
|
|
|
|
return ComputeColor(
|
|
|
|
worldPosition,
|
|
|
|
albedo
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Technique DeferredPBR_Ambient
|
|
|
|
{
|
|
|
|
Pass
|
|
|
|
{
|
|
|
|
VertexShader = compile vs_3_0 main_vs();
|
|
|
|
PixelShader = compile ps_3_0 main_ps();
|
|
|
|
}
|
|
|
|
}
|