project-aster/samples/04_scenes/shader/background.frag.glsl

35 lines
1.1 KiB
GLSL

#version 450
#pragma shader_stage(fragment)
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable
#extension GL_EXT_buffer_reference : require
#extension GL_EXT_nonuniform_qualifier : enable
#include "bindless_structs.glsl"
#include "graphics_bindings.glsl"
layout (location=0) in vec3 in_WorldPosition;
layout (location=0) out vec4 out_Color;
void main()
{
vec3 direction = normalize(in_WorldPosition - camera.m_Position.xyz);
#ifndef _DEBUG
vec4 color = texture(textureCubes[lights.m_EnvCubeHandle], direction);
#else
vec4 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 = texture(textureCubes[lights.m_EnvCubeHandle], direction);
}
#endif
out_Color = vec4(Uncharted2Tonemap(color.rgb), color.a);
}