Shader fixes

This commit is contained in:
luboslenco
2025-07-10 18:47:43 +02:00
parent 27f1e542fa
commit 274e910a43
4 changed files with 6 additions and 3 deletions
Binary file not shown.
+1 -1
View File
@@ -1,8 +1,8 @@
#[set(everything)]
const constants: {
N: float3x3;
WVP: float4x4;
N: float3x3;
};
struct vert_in {
+2 -2
View File
@@ -1,8 +1,8 @@
#[set(everything)]
const constants: {
N: float3x3;
WVP: float4x4;
N: float3x3;
tex_unpack: float;
};
@@ -74,7 +74,7 @@ fun mesh_posnortex_frag(input: vert_out): float4[3] {
var occlusion: float = 1.0;
// n /= abs(n.x) + abs(n.y) + abs(n.z);
n = (n / abs(n.x) + abs(n.y) + abs(n.z));
n = n / (abs(n.x) + abs(n.y) + abs(n.z));
if (n.z >= 0.0) {
n.xy = n.xy;
}
+3
View File
@@ -59,6 +59,9 @@ fun get_pos_view(view_ray: float3, depth: float): float3 {
fun get_delta_depth(view_ray: float3, hit_coord: float3): float {
var coord: float2 = get_projected_coord(hit_coord);
if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0) {
return 1000.0;
}
var depth: float = sample_lod(gbufferD, sampler_linear, coord, 0.0).r * 2.0 - 1.0;
var p: float3 = get_pos_view(view_ray, depth);
return p.z - hit_coord.z;