SSAO, performance sucks and it flickers so tweaking is needed, also more material support

This commit is contained in:
Halbear 2026-09-01 03:33:26 +01:00
parent 5b231d6920
commit 577836a03f
39 changed files with 889 additions and 74 deletions

View file

@ -1,7 +1,7 @@
#version 450
// Keep in sync manually with Java code
const int MAX_TEXTURES = 256;
const int MAX_TEXTURES = 512;
layout (location = 0) in vec2 inTextCoords;
layout (location = 1) in flat uint inMaterialIdx;
@ -36,6 +36,11 @@ layout(set = 2, binding = 0) readonly buffer MaterialUniform {
void main()
{
Material material = matUniform.materials[inMaterialIdx];
int textureIndex = int(material.textureIdx);
if (textureIndex >= MAX_TEXTURES){
outFragColor = vec2(0.0,0.0);
return;
}
vec4 albedo;
if (material.hasTexture == 1) {
albedo = texture(textSampler[material.textureIdx], inTextCoords);