rendering settings and dual pipeline transparency rendering
This commit is contained in:
parent
620838a41d
commit
5943effa4e
10 changed files with 340 additions and 72 deletions
|
|
@ -0,0 +1,35 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 500;
|
||||
|
||||
layout(location = 0) in vec2 inTextCoords;
|
||||
layout(location = 0) out vec4 outFragColor;
|
||||
|
||||
struct Material{
|
||||
vec4 diffuseColor;
|
||||
uint hasTexture;
|
||||
uint textureIdx;
|
||||
uint padding[2];
|
||||
};
|
||||
|
||||
layout(set = 2, binding = 0) readonly buffer MaterialUniform{
|
||||
Material materials[];
|
||||
} matUniform;
|
||||
|
||||
layout(set = 3, binding = 0) uniform sampler2D textSampler[MAX_TEXTURES];
|
||||
|
||||
layout(push_constant) uniform pc{
|
||||
layout(offset = 64) uint materialIdx;
|
||||
} push_constants;
|
||||
|
||||
void main()
|
||||
{
|
||||
Material material = matUniform.materials[push_constants.materialIdx];
|
||||
if(material.hasTexture == 1){
|
||||
vec4 texColor = texture(textSampler[material.textureIdx],inTextCoords);
|
||||
if(texColor.a < 0.05 || texColor.a >= 0.9){discard;}
|
||||
outFragColor = texColor;
|
||||
} else{
|
||||
outFragColor = material.diffuseColor;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue