Paint channels

This commit is contained in:
luboslenco
2018-10-09 19:44:14 +02:00
parent d5c32584c0
commit bc00ddd000
11 changed files with 196078 additions and 235898 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

-54
View File
@@ -1,54 +0,0 @@
# Blender v2.79 (sub 1) OBJ File: ''
# www.blender.org
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vt 0.331785 0.331785
vt 0.001548 0.001548
vt 0.331785 0.001548
vt 0.665119 0.331785
vt 0.334881 0.001548
vt 0.665119 0.001548
vt 0.001548 0.331785
vt 0.334881 0.331785
vt 0.331785 0.668215
vt 0.001548 0.998452
vt 0.001548 0.668215
vt 0.331785 0.998452
vt 0.331785 0.665119
vt 0.001548 0.334881
vt 0.331785 0.334881
vt 0.001548 0.665119
vt 0.665119 0.334881
vt 0.334881 0.665119
vt 0.334881 0.334881
vt 0.665119 0.665119
vt 0.998452 0.331785
vt 0.668215 0.001548
vt 0.998452 0.001548
vt 0.668215 0.331785
vn 0.0000 -1.0000 0.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn -1.0000 -0.0000 -0.0000
s off
f 2/1/1 4/2/1 1/3/1
f 5/4/2 2/5/2 1/6/2
f 2/1/1 3/7/1 4/2/1
f 5/4/2 6/8/2 2/5/2
f 6/9/3 3/10/3 2/11/3
f 6/9/3 7/12/3 3/10/3
f 8/13/4 6/14/4 5/15/4
f 8/13/4 7/16/4 6/14/4
f 1/17/5 8/18/5 5/19/5
f 1/17/5 4/20/5 8/18/5
f 3/21/6 8/22/6 4/23/6
f 3/21/6 7/24/6 8/22/6
-39788
View File
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

+13 -8
View File
@@ -405,11 +405,15 @@ class UINodes extends iron.Trait {
alpha_blend_source: 'blend_one',
alpha_blend_destination: eraser ? 'blend_zero' : 'blend_one',
alpha_blend_operation: 'add',
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
con_paint.data.color_writes_red = [true, true, true, true];
con_paint.data.color_writes_green = [true, true, true, true];
con_paint.data.color_writes_blue = [true, true, true, true];
if (UITrait.inst.brushType == 3) { // Bake AO
con_paint.data.color_write_green = false; // R
con_paint.data.color_write_blue = false; // M
con_paint.data.color_writes_green[2] = false; // No rough
con_paint.data.color_writes_blue[2] = false; // No met
}
var vert = con_paint.make_vert();
@@ -598,8 +602,9 @@ class UINodes extends iron.Trait {
if (!UITrait.inst.paintBase) frag.write('fragColor[0].a = 0.0;');
if (!UITrait.inst.paintNor) frag.write('fragColor[1].a = 0.0;');
if (!UITrait.inst.paintRough) frag.write('fragColor[2].a = 0.0;');
// if (!UITrait.inst.paintHeight) frag.write('fragColor[3].a = 0.0;');
if (!UITrait.inst.paintOcc) con_paint.data.color_writes_red[2] = false;
if (!UITrait.inst.paintRough) con_paint.data.color_writes_green[2] = false;
if (!UITrait.inst.paintMet) con_paint.data.color_writes_blue[2] = false;
if (UITrait.inst.brushType == 3) { // Bake AO
frag.write('fragColor[0].a = 0.0;');
@@ -631,7 +636,7 @@ class UINodes extends iron.Trait {
compare_mode: 'less',
// cull_mode: 'clockwise',
cull_mode: 'none',
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
var vert = con_mesh.make_vert();
var frag = con_mesh.make_frag();
@@ -711,7 +716,7 @@ class UINodes extends iron.Trait {
color_write_green: false,
color_write_blue: false,
color_write_alpha: false,
vertex_structure: [{"name": "pos", "size": 3}]
vertex_structure: [{name: "pos", size: 3}]
});
var vert = con_depth.make_vert();
@@ -774,7 +779,7 @@ class UINodes extends iron.Trait {
depth_write: true,
compare_mode: 'less',
cull_mode: 'clockwise',
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
var vert = con_mesh.make_vert();
var frag = con_mesh.make_frag();
+30 -13
View File
@@ -377,7 +377,7 @@ class UITrait extends iron.Trait {
function linkTex(object:Object, mat:MaterialData, link:String):kha.Image {
if (link == "_texcolorid") {
if (UITrait.inst.assets.length == 0) return bundled.get("mat_empty.jpg");
if (UITrait.inst.assets.length == 0) return bundled.get("mat_slot.jpg");
else return UITrait.inst.getImage(UITrait.inst.assets[colorIdHandle.position]);
}
return null;
@@ -459,7 +459,7 @@ class UITrait extends iron.Trait {
var scale = armory.data.Config.raw.window_scale;
ui = new Zui( { theme: arm.App.theme, font: arm.App.font, scaleFactor: scale, color_wheel: arm.App.color_wheel } );
loadBundled(['cursor.png', 'mat.jpg', 'mat_empty.jpg', 'brush_draw.png', 'brush_erase.png', 'brush_fill.png', 'brush_bake.png', 'brush_colorid.png', 'cay_thumb.jpg'], done);
loadBundled(['cursor.png', 'mat_slot.jpg', 'brush_draw.png', 'brush_erase.png', 'brush_fill.png', 'brush_bake.png', 'brush_colorid.png', 'cay_thumb.jpg'], done);
}
var haxeTrace:Dynamic->haxe.PosInfos->Void;
@@ -1404,7 +1404,7 @@ class UITrait extends iron.Trait {
}
if (ui.panel(Id.handle({selected: true}), "Material")) {
var img2 = bundled.get("mat_empty.jpg");
var img2 = bundled.get("mat_slot.jpg");
for (row in 0...Std.int(Math.ceil(materials2.length / 5))) {
ui.row([1/5,1/5,1/5,1/5,1/5]);
@@ -1528,8 +1528,10 @@ class UITrait extends iron.Trait {
ui.row([1/2, 1/2]);
brushScale = ui.slider(Id.handle({value: brushScale}), "UV Scale", 0.0, 2.0, true);
brushStrength = ui.slider(Id.handle({value: brushStrength}), "Strength", 0.0, 1.0, true);
}
ui.row([1/4,1/4,1/4,1/4]);
if (ui.panel(Id.handle({selected: true}), "Paint Channels")) {
ui.row([1/3,1/3,1/3]);
var baseHandle = Id.handle({selected: paintBase});
paintBase = ui.check(baseHandle, "Base");
@@ -1545,14 +1547,6 @@ class UITrait extends iron.Trait {
UINodes.inst.parsePaintMaterial();
}
var roughHandle = Id.handle({selected: paintRough});
// TODO: Use glColorMaski() to disable specific channel
paintRough = ui.check(roughHandle, "ORM");
if (roughHandle.changed) {
UINodes.inst.updateCanvasMap();
UINodes.inst.parsePaintMaterial();
}
var heightHandle = Id.handle({selected: paintHeight});
paintHeight = ui.check(heightHandle, "Height");
if (heightHandle.changed) {
@@ -1563,13 +1557,36 @@ class UITrait extends iron.Trait {
UINodes.inst.parsePaintMaterial();
}
ui.row([1/3,1/3,1/3]);
var occHandle = Id.handle({selected: paintOcc});
paintOcc = ui.check(occHandle, "Occlusion");
if (occHandle.changed) {
UINodes.inst.updateCanvasMap();
UINodes.inst.parsePaintMaterial();
}
var roughHandle = Id.handle({selected: paintRough});
paintRough = ui.check(roughHandle, "Roughness");
if (roughHandle.changed) {
UINodes.inst.updateCanvasMap();
UINodes.inst.parsePaintMaterial();
}
var metHandle = Id.handle({selected: paintMet});
paintMet = ui.check(metHandle, "Metallic");
if (metHandle.changed) {
UINodes.inst.updateCanvasMap();
UINodes.inst.parsePaintMaterial();
}
paintVisible = ui.check(Id.handle({selected: paintVisible}), "Visible Only");
}
}
if (ui.panel(Id.handle({selected: true}), "Material")) {
var img2 = bundled.get("mat_empty.jpg");
var img2 = bundled.get("mat_slot.jpg");
for (row in 0...Std.int(Math.ceil(materials.length / 5))) {
ui.row([1/5,1/5,1/5,1/5,1/5]);
BIN
View File
Binary file not shown.