kong test
This commit is contained in:
@@ -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, "\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(\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;");
|
||||
@@ -89,15 +89,15 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
|
||||
}
|
||||
|
||||
node_shader_add_shared_sampler(kong, "texpaint");
|
||||
node_shader_write_frag(kong, "texpaint_sample = sample_lod_shared(texpaint" + ", input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "texpaint_sample = sample_lod(texpaint, shared_sampler, input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "texpaint_opac = texpaint_sample.a;");
|
||||
|
||||
node_shader_write_frag(kong, "basecol = texpaint_sample.rgb * texpaint_opac;");
|
||||
node_shader_add_shared_sampler(kong, "texpaint_nor");
|
||||
node_shader_write_frag(kong, "texpaint_nor_sample = sample_lod_shared(texpaint_nor" + ", input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "ntex = lerp(ntex, texpaint_nor_sample.rgb, texpaint_opac);");
|
||||
node_shader_write_frag(kong, "texpaint_nor_sample = sample_lod(texpaint_nor, shared_sampler, input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "ntex = lerp3(ntex, texpaint_nor_sample.rgb, texpaint_opac);");
|
||||
node_shader_add_shared_sampler(kong, "texpaint_pack");
|
||||
node_shader_write_frag(kong, "texpaint_pack_sample = sample_lod_shared(texpaint_pack" + ", input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "texpaint_pack_sample = sample_lod(texpaint_pack, shared_sampler, input.tex_coord, 0.0);");
|
||||
node_shader_write_frag(kong, "occlusion = lerp(occlusion, texpaint_pack_sample.r, texpaint_opac);");
|
||||
node_shader_write_frag(kong, "roughness = lerp(roughness, texpaint_pack_sample.g, texpaint_opac);");
|
||||
node_shader_write_frag(kong, "metallic = lerp(metallic, texpaint_pack_sample.b, texpaint_opac);");
|
||||
@@ -122,7 +122,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
|
||||
|
||||
if (context_raw.viewport_mode == viewport_mode_t.LIT || context_raw.viewport_mode == viewport_mode_t.PATH_TRACE) {
|
||||
|
||||
node_shader_write_frag(kong, "basecol = pow(basecol, float3(2.2, 2.2, 2.2));");
|
||||
node_shader_write_frag(kong, "basecol = pow3(basecol, float3(2.2, 2.2, 2.2));");
|
||||
|
||||
if (context_raw.viewport_shader != null) {
|
||||
node_shader_write_frag(kong, "output_color: float3;");
|
||||
@@ -131,8 +131,8 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
|
||||
}
|
||||
else if (context_raw.render_mode == render_mode_t.FORWARD && context_raw.viewport_mode != viewport_mode_t.PATH_TRACE) {
|
||||
kong.frag_wposition = true;
|
||||
node_shader_write_frag(kong, "var albedo: float3 = lerp(basecol, float3(0.0, 0.0, 0.0), metallic);");
|
||||
node_shader_write_frag(kong, "var f0: float3 = lerp(float3(0.04, 0.04, 0.04), basecol, metallic);");
|
||||
node_shader_write_frag(kong, "var albedo: float3 = lerp3(basecol, float3(0.0, 0.0, 0.0), metallic);");
|
||||
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;");
|
||||
@@ -141,7 +141,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
|
||||
node_shader_write_frag(kong, "var wreflect: float3 = reflect(-vvec, n);");
|
||||
node_shader_write_frag(kong, "var envlod: float = roughness * float(constants.envmap_num_mipmaps);");
|
||||
node_shader_add_function(frag, str_envmap_equirect);
|
||||
node_shader_write_frag(kong, "var prefiltered_color: float3 = sample_lod(senvmap_radiance, envmap_equirect(wreflect, constants.envmap_data.x), envlod).rgb;");
|
||||
node_shader_write_frag(kong, "var prefiltered_color: float3 = sample_lod(senvmap_radiance, senvmap_radiance_sampler, envmap_equirect(wreflect, constants.envmap_data.x), envlod).rgb;");
|
||||
// node_shader_add_constant(kong, "shirr: float4[7]", "_envmap_irradiance");
|
||||
node_shader_add_constant(kong, "shirr0: float4", "_envmap_irradiance0");
|
||||
node_shader_add_constant(kong, "shirr1: float4", "_envmap_irradiance1");
|
||||
@@ -186,7 +186,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
|
||||
}
|
||||
|
||||
if (context_raw.viewport_mode != viewport_mode_t.LIT && context_raw.viewport_mode != viewport_mode_t.PATH_TRACE) {
|
||||
node_shader_write_frag(kong, "output[1].rgb = pow(output[1].rgb, float3(2.2, 2.2, 2.2));");
|
||||
node_shader_write_frag(kong, "output[1].rgb = pow3(output[1].rgb, float3(2.2, 2.2, 2.2));");
|
||||
}
|
||||
|
||||
node_shader_write_frag(kong, "n /= (abs(n.x) + abs(n.y) + abs(n.z));");
|
||||
|
||||
@@ -54,9 +54,9 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
|
||||
node_shader_add_texture(kong, "texpaint");
|
||||
node_shader_add_texture(kong, "texpaint_nor");
|
||||
node_shader_add_texture(kong, "texpaint_pack");
|
||||
node_shader_write_frag(kong, "output[0].rgba = sample_lod(texpaint, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[1].rgba = sample_lod(texpaint_nor, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[2].rgba = sample_lod(texpaint_pack, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[0].rgba = sample_lod(texpaint, texpaint_sampler, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[1].rgba = sample_lod(texpaint_nor, texpaint_nor_sampler, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[2].rgba = sample_lod(texpaint_pack, texpaint_pack_sampler, tex_coord_inp, 0.0);");
|
||||
node_shader_write_frag(kong, "output[3].rg = tex_coord_inp.xy;");
|
||||
con_paint.data.shader_from_source = true;
|
||||
gpu_create_shaders_from_kong(node_shader_get(kong), ADDRESS(con_paint.data.vertex_shader), ADDRESS(con_paint.data.fragment_shader));
|
||||
@@ -98,7 +98,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
|
||||
|
||||
node_shader_write_frag(kong, "var dist: float = 0.0;");
|
||||
|
||||
node_shader_write_frag(kong, "var depth: float = sample_lod(gbufferD, constants.inp.xy, 0.0).r;");
|
||||
node_shader_write_frag(kong, "var depth: float = sample_lod(gbufferD, gbufferD_sampler, constants.inp.xy, 0.0).r;");
|
||||
|
||||
node_shader_add_constant(kong, "invVP: float4x4", "_inv_view_proj_matrix");
|
||||
node_shader_write_frag(kong, "var winp: float4 = float4(float2(constants.inp.x, 1.0 - constants.inp.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);");
|
||||
@@ -106,13 +106,13 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
|
||||
node_shader_write_frag(kong, "winp.xyz /= winp.w;");
|
||||
kong.frag_wposition = true;
|
||||
|
||||
node_shader_write_frag(kong, "var depthlast: float = sample_lod(gbufferD, constants.inplast.xy, 0.0).r;");
|
||||
node_shader_write_frag(kong, "var depthlast: float = sample_lod(gbufferD, gbufferD_sampler, constants.inplast.xy, 0.0).r;");
|
||||
|
||||
node_shader_write_frag(kong, "var winplast: float4 = float4(float2(constants.inplast.x, 1.0 - constants.inplast.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);");
|
||||
node_shader_write_frag(kong, "winplast = constants.invVP * winplast;");
|
||||
node_shader_write_frag(kong, "winplast.xyz /= winplast.w;");
|
||||
|
||||
node_shader_write_frag(kong, "var pa: float3 = wposition - winp.xyz;");
|
||||
node_shader_write_frag(kong, "var pa: float3 = input.wposition - winp.xyz;");
|
||||
node_shader_write_frag(kong, "var ba: float3 = winplast.xyz - winp.xyz;");
|
||||
|
||||
// Capsule
|
||||
@@ -142,14 +142,14 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
|
||||
|
||||
// Manual blending to preserve memory
|
||||
kong.frag_wvpposition = true;
|
||||
node_shader_write_frag(kong, "var sample_tc: float2 = float2(wvpposition.xy / wvpposition.w) * 0.5 + 0.5;");
|
||||
node_shader_write_frag(kong, "var sample_tc: float2 = float2(input.wvpposition.xy / input.wvpposition.w) * 0.5 + 0.5;");
|
||||
node_shader_write_frag(kong, "sample_tc.y = 1.0 - sample_tc.y;");
|
||||
node_shader_add_texture(kong, "paintmask");
|
||||
node_shader_write_frag(kong, "var sample_mask: float = sample_lod(paintmask, sample_tc, 0.0).r;");
|
||||
node_shader_write_frag(kong, "var sample_mask: float = sample_lod(paintmask, paintmask_sampler, sample_tc, 0.0).r;");
|
||||
node_shader_write_frag(kong, "str = max(str, sample_mask);");
|
||||
|
||||
node_shader_add_texture(kong, "texpaint_undo", "_texpaint_undo");
|
||||
node_shader_write_frag(kong, "var sample_undo: float4 = sample_lod(texpaint_undo, sample_tc, 0.0);");
|
||||
node_shader_write_frag(kong, "var sample_undo: float4 = sample_lod(texpaint_undo, texpaint_undo_sampler, sample_tc, 0.0);");
|
||||
|
||||
if (context_raw.tool == workspace_tool_t.ERASER) {
|
||||
node_shader_write_frag(kong, "output[0].rgba = float4(0.0, 0.0, 0.0, 0.0);");
|
||||
|
||||
Reference in New Issue
Block a user