diff --git a/src/main/resources/assets/voxy/shaders/lod/gl46/quads.frag b/src/main/resources/assets/voxy/shaders/lod/gl46/quads.frag index ec1c3f30..7732974e 100644 --- a/src/main/resources/assets/voxy/shaders/lod/gl46/quads.frag +++ b/src/main/resources/assets/voxy/shaders/lod/gl46/quads.frag @@ -10,10 +10,12 @@ layout(location = 2) in flat vec4 tinting; layout(location = 3) in flat vec4 addin; layout(location = 4) in flat uint flags; layout(location = 5) in flat vec4 conditionalTinting; +//layout(location = 6) in flat vec4 solidColour; layout(location = 0) out vec4 outColour; void main() { vec2 uv = mod(uv, vec2(1.0))*(1.0/(vec2(3.0,2.0)*256.0)); + //vec4 colour = solidColour; vec4 colour = texture(blockModelAtlas, uv + baseUV, ((flags>>1)&1u)*-4.0); if ((flags&1u) == 1 && colour.a <= 0.25f) { discard; diff --git a/src/main/resources/assets/voxy/shaders/lod/gl46/quads.vert b/src/main/resources/assets/voxy/shaders/lod/gl46/quads.vert index 01cd4956..add49a11 100644 --- a/src/main/resources/assets/voxy/shaders/lod/gl46/quads.vert +++ b/src/main/resources/assets/voxy/shaders/lod/gl46/quads.vert @@ -12,6 +12,7 @@ layout(location = 2) out flat vec4 tinting; layout(location = 3) out flat vec4 addin; layout(location = 4) out flat uint flags; layout(location = 5) out flat vec4 conditionalTinting; +//layout(location = 6) out flat vec4 solidColour; uint extractLodLevel() { return uint(gl_BaseInstance)>>27; @@ -34,8 +35,12 @@ float getDepthOffset(uint faceData, uint face) { } vec2 getFaceSizeOffset(uint faceData, uint corner) { + float EPSILON = 0.001f; vec4 faceOffsetsSizes = extractFaceSizes(faceData); - return mix(faceOffsetsSizes.xz, -(1.0-faceOffsetsSizes.yw), bvec2(((corner>>1)&1u)==1, (corner&1u)==1)); + //Expand the quads by a very small amount + faceOffsetsSizes.xz -= vec2(EPSILON); + faceOffsetsSizes.yw += vec2(EPSILON); + return mix(faceOffsetsSizes.xz, faceOffsetsSizes.yw-1.0f, bvec2(((corner>>1)&1u)==1, (corner&1u)==1)); } //TODO: add a mechanism so that some quads can ignore backface culling @@ -139,4 +144,7 @@ void main() { tinting.xyz *= 0.95f; } } + + + //solidColour = vec4(vec3(modelId&0xFu, (modelId>>4)&0xFu, (modelId>>8)&0xFu)*(1f/15f),1f); } \ No newline at end of file diff --git a/src/main/resources/assets/voxy/shaders/post/ssao.comp b/src/main/resources/assets/voxy/shaders/post/ssao.comp index 8adec458..ba791e08 100644 --- a/src/main/resources/assets/voxy/shaders/post/ssao.comp +++ b/src/main/resources/assets/voxy/shaders/post/ssao.comp @@ -48,32 +48,38 @@ void main() { if (any(lessThanEqual(size, gl_GlobalInvocationID.xy))) { return; } - vec2 point = vec2(gl_GlobalInvocationID.xy)/size; - float depth = texture(depthTex, point, -4.0f).r; + vec2 scale = vec2(1.0f)/size; + vec2 point = vec2(gl_GlobalInvocationID.xy)*scale; + point += scale*0.5f;//Offset to the center of the textile + float depth = texture(depthTex, point).r; vec4 ocolour = vec4(0); if (depth < 1.0f) { vec4 colour = texture(colourTex, point); - uint metadata = uint(colour.w*255.0f); - uint face = metadata&7u; - uint lod = (metadata>>3)&7u; - bool hasAO = (metadata>>6)!=0; - vec3 pos = rev3d(vec3(point, depth)); + if (colour == vec4(0.0f, 0.0f, 0.0f, 0.0f)) { + ocolour = vec4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + uint metadata = uint(colour.w*255.0f); + uint face = metadata&7u; + uint lod = (metadata>>3)&7u; + bool hasAO = (metadata>>6)!=0; + vec3 pos = rev3d(vec3(point, depth)); - //TODO: TODO: only encode the axis, then use then it as as a mask along with pos and multiply by the -sign of everything - vec3 viewNormal = vec3(uint((face>>1)==2), uint((face>>1)==0), uint((face>>1)==1)) * (float(int(face)&1)*2-1); - //vec3 viewNormal = vec3(uint((face>>1)==2), uint((face>>1)==0), uint((face>>1)==1)) * (-sign(pos)); + //TODO: TODO: only encode the axis, then use then it as as a mask along with pos and multiply by the -sign of everything + vec3 viewNormal = vec3(uint((face>>1)==2), uint((face>>1)==0), uint((face>>1)==1)) * (float(int(face)&1)*2-1); + //vec3 viewNormal = vec3(uint((face>>1)==2), uint((face>>1)==0), uint((face>>1)==1)) * (-sign(pos)); - float d = 0.0; - if (hasAO) { - d = computeAOAngle(pos, 1.0*(1<