Files
Towards/external/loft/examples/viewer/shaders/Transparent.frag.spirv
T

85 lines
12 KiB
Plaintext
Raw Normal View History

2026-07-18 14:31:15 +02:00
# E
SPV_KHR_non_semantic_info NonSemantic.Shader.DebugInfo.100 GLSL.std.450
main¦ì#'2/home/martin/projects/loft/examples/viewer/shaders/Transparent.fraguintmain¼// OpModuleProcessed client vulkan100
// OpModuleProcessed target-env vulkan1.0
// OpModuleProcessed entry-point main
#line 1
#version 450
layout(location = 0) out vec4 fragColor;
layout(location = 1) out vec4 fragNormal;
layout(location = 2) out vec4 fragPosition;
layout(location = 3) out vec4 fragPbr;
layout(location = 0) in vec3 inPos;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inUV;
layout(location = 3) in mat3 inTBN;
layout( push_constant ) uniform constants
{
uint transformIdx;
uint materialIdx;
} PushConstants;
struct Material {
vec4 albedo;
vec4 bsdf;
int colorTexture;
float colorTextureBlend;
int normalTexture;
float normalTextureBlend;
int pbrTexture;
float pbrTextureBlend;
};
layout(set = 2, binding = 0) uniform Materials {
Material materials[128];
} materials;
layout(set = 2, binding = 2) uniform sampler2DArray colorTextures;
layout(set = 2, binding = 3) uniform sampler2DArray normalTextures;
layout(set = 2, binding = 4) uniform sampler2DArray pbrTextures;
void main() {
Material material = materials.materials[PushConstants.materialIdx];
vec4 color = texture(colorTextures, vec3(inUV, material.colorTexture)).rgba;
vec3 normal = texture(normalTextures, vec3(inUV, materials.materials[PushConstants.materialIdx].normalTexture)).rgb;
normal = normalize(normal * 2.0 - 1.0);
vec2 pbr = texture(pbrTextures, vec3(inUV, material.pbrTexture)).bg;
fragColor = vec4(mix(material.albedo.rgb, color.rgb, material.colorTextureBlend), color.a);
fragNormal = vec4(mix(inNormal, normalize(inTBN * normalize(normal)), 1.0), color.a);
fragPosition = vec4(inPos, color.a);
fragPbr = vec4(mix(material.bsdf.xy, pbr, 1.0), 0.0, color.a);
}
float"int&bsdf+pbrTexture/pbrTextureBlend7Material>materialQmaterialsUMaterials^materialIdxbconstantsgPushConstantscolortype.2d.image@type.2d.imageštype.sampled.image@type.sampled.image colorTextures¨inUV·normal½normalTexturesÙpbrßpbrTexturesîfragColorfragNormalinNormalboolinTBN%fragPosition)inPos4fragPbrmain$Material$albedo$bsdf$colorTexture$colorTextureBlend$normalTexture$normalTextureBlend$pbrTexture$pbrTextureBlend<materialBMaterialBalbedoBbsdfBcolorTextureBcolorTextureBlendBnormalTextureBnormalTextureBlendBpbrTextureBpbrTextureBlendOMaterialsOmaterialsXmaterials\constants\transformIdx\materialIdxePushConstantscoloržcolorTextures¦inUVµnormal»normalTextures×pbrÝpbrTexturesìfragColorfragNormalinNormalinTBN#fragPosition'inPos2fragPbrHB#HB#HB# HB#$HB#(HB#,HB#0HB#4GM@GOHO#GX!GX"G\H\#H\#Gž!Gž"G¦G»!G»"GÝ!GÝ"GìGGGG#G'G2! +
+ +  
+
 
 #+*+++   
 
  !  #"
 
$!!!+'+(
% & '(
) & '(
+,+-
* +#,-
+0+1
. /01
2 +#,-
3 /01
4 +#,-
5 /01