// Copyright (C) 2009-2022, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE #pragma anki mutator LAYER_GROUP 0 1 2 #pragma anki start vert #include #pragma anki end #pragma anki start frag #include layout(set = 0, binding = 0) uniform utexture2D u_inTex; layout(set = 0, binding = 1) uniform sampler u_nearestAnyClampSampler; layout(location = 0) in Vec2 in_uv; layout(location = 0) out Vec3 out_color; void main() { const UVec4 packed = textureLod(u_inTex, u_nearestAnyClampSampler, in_uv, 0.0); F32 shadowFactors[MAX_RT_SHADOW_LAYERS]; unpackRtShadows(packed, shadowFactors); #if LAYER_GROUP == 0 out_color = Vec3(shadowFactors[0], shadowFactors[1], shadowFactors[2]); #elif LAYER_GROUP == 1 out_color = Vec3(shadowFactors[3], shadowFactors[4], shadowFactors[5]); #else out_color = Vec3(shadowFactors[6], shadowFactors[7], 0.0); #endif } #pragma anki end