kong test

This commit is contained in:
luboslenco
2025-04-10 15:40:40 +02:00
parent c4e930ebb6
commit 6be2105514
11 changed files with 94 additions and 71 deletions
+5 -4
View File
@@ -39,7 +39,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
node_shader_add_out(kong, "tex_coord: float2");
kong.frag_wvpposition = true;
node_shader_add_constant(kong, "VP: float4x4", "_view_proj_matrix");
kong.vert_wposition = true;
kong.frag_wposition = true;
let texture_count: i32 = 0;
let displace_strength: f32 = make_material_get_displace_strength();
@@ -48,10 +48,10 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
node_shader_write_vert(kong, "var height: float = 0.0;");
let num_layers: i32 = 1;
let displace_3: string = displace_strength + ", " + displace_strength + ", " + displace_strength;
node_shader_write_vert(kong, "\wposition += wnormal * float3(height, height, height) * float3(" + displace_3 + ");");
node_shader_write_vert(kong, "\output.wposition += wnormal * float3(height, height, height) * float3(" + displace_3 + ");");
}
node_shader_write_vert(kong, "output.pos = constants.VP * float4(\wposition.xyz, 1.0);");
node_shader_write_vert(kong, "output.pos = constants.VP * float4(\output.wposition.xyz, 1.0);");
let brush_scale: f32 = context_raw.brush_scale;
node_shader_add_constant(kong, "tex_scale: float", "_tex_unpack");
node_shader_write_vert(kong, "output.tex_coord = input.tex * " + brush_scale + " * constants.tex_scale;");
@@ -135,7 +135,8 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
node_shader_write_frag(kong, "var f0: float3 = lerp3(float3(0.04, 0.04, 0.04), basecol, metallic);");
kong.frag_vvec = true;
node_shader_write_frag(kong, "var dotnv: float = max(0.0, dot(n, vvec));");
node_shader_write_frag(kong, "var env_brdf: float2 = senvmap_brdf[int2(float2(roughness, 1.0 - dotnv) * 256.0)].xy;");
// node_shader_write_frag(kong, "var env_brdf: float2 = senvmap_brdf[int2(float2(roughness, 1.0 - dotnv) * 256.0)].xy;");
node_shader_write_frag(kong, "var env_brdf: float4 = senvmap_brdf[int2(float2(roughness, 1.0 - dotnv) * 256.0)];");
node_shader_add_constant(kong, "envmap_num_mipmaps: int", "_envmap_num_mipmaps");
node_shader_add_constant(kong, "envmap_data: float4", "_envmap_data"); // angle, sin(angle), cos(angle), strength
node_shader_write_frag(kong, "var wreflect: float3 = reflect(-vvec, n);");