paint: height parse fixes
This commit is contained in:
@@ -45,6 +45,11 @@ void parser_material_init() {
|
|||||||
parser_material_parsing_basecolor = false;
|
parser_material_parsing_basecolor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parser_material_is_default_normal(char *s) {
|
||||||
|
// Enable height socket when normal map socket is not connected for now
|
||||||
|
return string_equals(s, "float3(0.500000, 0.500000, 1.000000)");
|
||||||
|
}
|
||||||
|
|
||||||
void parse_normal_map_color_input(ui_node_socket_t *inp) {
|
void parse_normal_map_color_input(ui_node_socket_t *inp) {
|
||||||
parser_material_kong->frag_write_normal++;
|
parser_material_kong->frag_write_normal++;
|
||||||
gc_unroot(parser_material_out_normaltan);
|
gc_unroot(parser_material_out_normaltan);
|
||||||
@@ -90,7 +95,7 @@ shader_out_t *parser_material_parse_shader(ui_node_t *node, ui_node_socket_t *so
|
|||||||
// Opacity
|
// Opacity
|
||||||
sout->out_opacity = string_copy(parser_material_parse_value_input(node->inputs->buffer[1], false));
|
sout->out_opacity = string_copy(parser_material_parse_value_input(node->inputs->buffer[1], false));
|
||||||
// Height
|
// Height
|
||||||
if (parser_material_parse_height) {
|
if (parser_material_parse_height && parser_material_is_default_normal(parser_material_out_normaltan)) {
|
||||||
sout->out_height = string_copy(parser_material_parse_value_input(node->inputs->buffer[7], false));
|
sout->out_height = string_copy(parser_material_parse_value_input(node->inputs->buffer[7], false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,10 +250,9 @@ node_shader_context_t *make_paint_run(material_t *data, material_context_t *matc
|
|||||||
depth_reject = false;
|
depth_reject = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: sp.z needs to take height channel into account
|
|
||||||
bool particle = g_context->tool == TOOL_TYPE_PARTICLE;
|
bool particle = g_context->tool == TOOL_TYPE_PARTICLE;
|
||||||
if (!decal && !particle) {
|
if (!decal && !particle) {
|
||||||
if (make_material_height_used || g_context->sym_x || g_context->sym_y || g_context->sym_z) {
|
if (g_context->sym_x || g_context->sym_y || g_context->sym_z) {
|
||||||
depth_reject = false;
|
depth_reject = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,8 +370,6 @@ node_shader_context_t *make_paint_run(material_t *data, material_context_t *matc
|
|||||||
}
|
}
|
||||||
if (!make_material_height_used && !make_paint_is_zero_constant(height)) {
|
if (!make_material_height_used && !make_paint_is_zero_constant(height)) {
|
||||||
make_material_height_used = true;
|
make_material_height_used = true;
|
||||||
// Height used for the first time, also rebuild vertex shader
|
|
||||||
return make_paint_run(data, matcon);
|
|
||||||
}
|
}
|
||||||
make_material_emis_used = parse_float(emis) != 0.0;
|
make_material_emis_used = parse_float(emis) != 0.0;
|
||||||
make_material_subs_used = parse_float(subs) != 0.0;
|
make_material_subs_used = parse_float(subs) != 0.0;
|
||||||
|
|||||||
@@ -481,11 +481,9 @@ node_shader_context_t *sculpt_make_sculpt_run(material_t *data, material_context
|
|||||||
|
|
||||||
// parser_material_parse may add vertex elements
|
// parser_material_parse may add vertex elements
|
||||||
i32 velen = con_paint->data->vertex_elements->length;
|
i32 velen = con_paint->data->vertex_elements->length;
|
||||||
// parser_material_parse_height = true;
|
|
||||||
shader_out_t *sout = parser_material_parse(g_context->material->canvas, con_paint, kong, matcon);
|
shader_out_t *sout = parser_material_parse(g_context->material->canvas, con_paint, kong, matcon);
|
||||||
con_paint->data->vertex_elements->length = velen;
|
con_paint->data->vertex_elements->length = velen;
|
||||||
parser_material_triplanar = false;
|
parser_material_triplanar = false;
|
||||||
// node_shader_write_frag(kong, string("var height: float = %s.r;", sout->out_basecol));
|
|
||||||
node_shader_write_frag(kong, string("var disp: float3 = %s;", sout->out_basecol));
|
node_shader_write_frag(kong, string("var disp: float3 = %s;", sout->out_basecol));
|
||||||
|
|
||||||
if (kong->frag_bposition) {
|
if (kong->frag_bposition) {
|
||||||
|
|||||||
@@ -1175,7 +1175,6 @@ slot_layer_t *layers_flatten(bool height_to_normal, slot_layer_t_array_t *layers
|
|||||||
|
|
||||||
// Merge height map into normal map
|
// Merge height map into normal map
|
||||||
if (height_to_normal && make_material_height_used) {
|
if (height_to_normal && make_material_height_used) {
|
||||||
|
|
||||||
draw_begin(layers_temp_image, false, 0);
|
draw_begin(layers_temp_image, false, 0);
|
||||||
draw_set_pipeline(pipes_copy);
|
draw_set_pipeline(pipes_copy);
|
||||||
draw_image(l0->texpaint_nor, 0, 0);
|
draw_image(l0->texpaint_nor, 0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user