Voxels in scene mode
This commit is contained in:
@@ -8,20 +8,9 @@ import arm.utils
|
||||
|
||||
def on_make_renderpath():
|
||||
arm.assets.add_shader_pass('copy_mrt3_pass')
|
||||
arm.assets.add_shader_pass('copy_mrt4_pass')
|
||||
arm.assets.add(arm.utils.get_sdk_path() + '/armory/Assets/noise256.png')
|
||||
arm.assets.add_embedded_data('noise256.png')
|
||||
bpy.data.worlds['Arm'].world_defs += '_CGrainStatic'
|
||||
|
||||
if bpy.data.worlds['Arm'].arm_project_name == 'ArmorPaint':
|
||||
if arm.make_state.target.startswith('krom'): # krom, krom-windows,..
|
||||
arm.material.mat_utils.add_mesh_contexts = ['voxel'] # Defaults to make_ao
|
||||
arm.write_data.add_compiledglsl = """
|
||||
const ivec3 voxelgiResolution = ivec3(256, 256, 256);
|
||||
const vec3 voxelgiHalfExtents = vec3(1.0, 1.0, 1.0);
|
||||
"""
|
||||
else:
|
||||
arm.material.mat_utils.add_mesh_contexts = []
|
||||
|
||||
def register():
|
||||
arm.make_renderpath.callback = on_make_renderpath
|
||||
|
||||
+1
-19
@@ -9,15 +9,7 @@ class Config {
|
||||
C.rp_ssgi = UITrait.inst.hssgi.selected;
|
||||
C.rp_ssr = UITrait.inst.hssr.selected;
|
||||
C.rp_bloom = UITrait.inst.hbloom.selected;
|
||||
// var wasOff = C.rp_shadowmap_cascade == 1;
|
||||
// C.rp_shadowmap_cascade = getShadowMapSize(UITrait.inst.hshadowmap.position);
|
||||
// var light = iron.Scene.active.lights[0];
|
||||
// if (C.rp_shadowmap_cascade == 1) {
|
||||
// light.data.raw.strength = 0;
|
||||
// }
|
||||
// else if (wasOff) {
|
||||
// light.data.raw.strength = 6.5;
|
||||
// }
|
||||
C.rp_gi = UITrait.inst.hvxao.selected;
|
||||
C.rp_supersample = getSuperSampleSize(UITrait.inst.hsupersample.position);
|
||||
|
||||
var current = @:privateAccess kha.graphics4.Graphics2.current;
|
||||
@@ -30,15 +22,6 @@ class Config {
|
||||
UITrait.inst.ddirty = 2;
|
||||
}
|
||||
|
||||
// public static inline function getShadowQuality(i:Int):Int {
|
||||
// // 0 - Ultra, 1- High, 2 - Medium, 3 - Low, 4 - Off
|
||||
// return i == 8192 ? 0 : i == 4096 ? 1 : i == 2048 ? 2 : i == 1024 ? 3 : 4;
|
||||
// }
|
||||
|
||||
// public static inline function getShadowMapSize(i:Int):Int {
|
||||
// return i == 0 ? 8192 : i == 1 ? 4096 : i == 2 ? 2048 : i == 3 ? 1024 : 1;
|
||||
// }
|
||||
|
||||
public static inline function getSuperSampleQuality(f:Float):Int {
|
||||
return f == 1.0 ? 0 : f == 1.5 ? 1 : f == 2.0 ? 2 : 3;
|
||||
}
|
||||
@@ -74,7 +57,6 @@ class Config {
|
||||
if (i == 4096) return 2;
|
||||
if (i == 8192) return 3;
|
||||
if (i == 16384) return 4;
|
||||
if (i == 20480) return 5;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ class RenderPathDeferred {
|
||||
}
|
||||
|
||||
path.loadShader("shader_datas/copy_mrt3_pass/copy_mrt3_pass");
|
||||
path.loadShader("shader_datas/copy_mrt4_pass/copy_mrt4_pass");
|
||||
|
||||
{ // Material preview
|
||||
{
|
||||
@@ -170,7 +169,12 @@ class RenderPathDeferred {
|
||||
|
||||
if (kha.System.windowWidth() == 0 || kha.System.windowHeight() == 0) return;
|
||||
|
||||
armory.data.Config.raw.rp_gi = UITrait.inst.worktab.position == 1;
|
||||
// Only enable vxao in scene mode
|
||||
var restoreGI = false;
|
||||
if (armory.data.Config.raw.rp_gi && UITrait.inst.worktab.position == 0) { // paint
|
||||
armory.data.Config.raw.rp_gi = false;
|
||||
restoreGI = true;
|
||||
}
|
||||
|
||||
var ssaa4 = armory.data.Config.raw.rp_supersample == 4 ? true : false;
|
||||
|
||||
@@ -636,10 +640,10 @@ class RenderPathDeferred {
|
||||
var crot = cam.transform.rot;
|
||||
var ratio = iron.App.w() / iron.App.h();
|
||||
var P = cam.P;
|
||||
cam.P = iron.math.Mat4.ortho(-6 * ratio, 6 * ratio, -6, 6, -2, 2);
|
||||
cam.P = iron.math.Mat4.ortho(-8 * ratio, 8 * ratio, -8, 8, -2, 2);
|
||||
gizmo.visible = true;
|
||||
gizmo.parent = cam;
|
||||
gizmo.transform.loc = new iron.math.Vec4(5.2 * ratio, -5.6, -1);
|
||||
gizmo.transform.loc = new iron.math.Vec4(7.2 * ratio, -7.6, -1);
|
||||
gizmo.transform.rot = new iron.math.Quat(-crot.x, -crot.y, -crot.z, crot.w);
|
||||
gizmo.transform.buildMatrix();
|
||||
|
||||
@@ -713,6 +717,8 @@ class RenderPathDeferred {
|
||||
UITrait.inst.ddirty--;
|
||||
UITrait.inst.pdirty--;
|
||||
UITrait.inst.rdirty--;
|
||||
|
||||
if (restoreGI) armory.data.Config.raw.rp_gi = true;
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
+21
-17
@@ -180,7 +180,7 @@ class UITrait extends iron.Trait {
|
||||
public var paintVisible = true;
|
||||
public var mirrorX = false;
|
||||
public var showGrid = false;
|
||||
public var showCompass = false;
|
||||
public var showCompass = true;
|
||||
public var autoFillHandle = new Zui.Handle({selected: false});
|
||||
public var fillTypeHandle = new Zui.Handle();
|
||||
public var resHandle = new Zui.Handle({position: 1}); // 2048
|
||||
@@ -216,8 +216,8 @@ class UITrait extends iron.Trait {
|
||||
public var hssgi:Zui.Handle = null;
|
||||
public var hssr:Zui.Handle = null;
|
||||
public var hbloom:Zui.Handle = null;
|
||||
public var hshadowmap:Zui.Handle = null;
|
||||
public var hsupersample:Zui.Handle = null;
|
||||
public var hvxao:Zui.Handle = null;
|
||||
var textureExport = false;
|
||||
var textureExportPath = "";
|
||||
public var projectExport = false;
|
||||
@@ -227,7 +227,7 @@ class UITrait extends iron.Trait {
|
||||
public var menuHandle = new Zui.Handle({layout:Horizontal});
|
||||
public var workspaceHandle = new Zui.Handle({layout:Horizontal});
|
||||
|
||||
public var cameraControls = 0;
|
||||
public var cameraControls = 1;
|
||||
public var htab = Id.handle({position: 0});
|
||||
public var worktab = Id.handle({position: 0});
|
||||
|
||||
@@ -2061,6 +2061,10 @@ class UITrait extends iron.Trait {
|
||||
iron.Scene.active.world.envmap = showEnvmap ? savedEnvmap : emptyEnvmap;
|
||||
}
|
||||
|
||||
// ui.separator();
|
||||
// if (ui.panel(Id.handle({selected: false}), "History", 1)) {
|
||||
// }
|
||||
|
||||
// Draw plugins
|
||||
for (p in Plugin.plugins) if (p.drawUI != null) p.drawUI(ui);
|
||||
}
|
||||
@@ -2275,33 +2279,33 @@ class UITrait extends iron.Trait {
|
||||
hssgi = Id.handle({selected: C.rp_ssgi});
|
||||
hssr = Id.handle({selected: C.rp_ssr});
|
||||
hbloom = Id.handle({selected: C.rp_bloom});
|
||||
// hshadowmap = Id.handle({position: Config.getShadowQuality(C.rp_shadowmap_cascade)});
|
||||
hsupersample = Id.handle({position: Config.getSuperSampleQuality(C.rp_supersample)});
|
||||
hvxao = Id.handle({selected: C.rp_gi});
|
||||
ui.separator();
|
||||
if (ui.panel(Id.handle({selected: true}), "Viewport", 1)) {
|
||||
ui.row([1/2, 1/2]);
|
||||
ui.combo(Id.handle(), ["Off"], "Shadows", true);
|
||||
// ui.combo(hshadowmap, ["Ultra", "High", "Medium", "Low", "Off"], "Shadows", true);
|
||||
// if (hshadowmap.changed) Config.applyConfig();
|
||||
ui.combo(hsupersample, ["1.0x", "1.5x", "2.0x", "4.0x"], "Super Sample", true);
|
||||
if (hsupersample.changed) Config.applyConfig();
|
||||
ui.row([1/2, 1/2]);
|
||||
var vsyncHandle = Id.handle({selected: C.window_vsync});
|
||||
C.window_vsync = ui.check(vsyncHandle, "VSync");
|
||||
if (vsyncHandle.changed) armory.data.Config.save();
|
||||
ui.combo(hsupersample, ["1.0x", "1.5x", "2.0x", "4.0x"], "Super Sample", true);
|
||||
if (hsupersample.changed) Config.applyConfig();
|
||||
ui.row([1/2, 1/2]);
|
||||
ui.check(hvxao, "Voxel AO");
|
||||
if (ui.isHovered) ui.tooltip("Scene mode only");
|
||||
if (hvxao.changed) Config.applyConfig();
|
||||
ui.check(hssgi, "SSAO");
|
||||
if (hssgi.changed) Config.applyConfig();
|
||||
ui.row([1/2, 1/2]);
|
||||
ui.check(hbloom, "Bloom");
|
||||
if (hbloom.changed) Config.applyConfig();
|
||||
ui.check(hssr, "SSR");
|
||||
if (hssr.changed) Config.applyConfig();
|
||||
var cullHandle = Id.handle({selected: culling});
|
||||
culling = ui.check(cullHandle, "Cull Backfaces");
|
||||
if (cullHandle.changed) {
|
||||
UINodes.inst.parseMeshMaterial();
|
||||
ddirty = 2;
|
||||
}
|
||||
ui.row([1/2, 1/2]);
|
||||
ui.check(hssgi, "SSAO");
|
||||
if (hssgi.changed) Config.applyConfig();
|
||||
ui.check(hssr, "SSR");
|
||||
if (hssr.changed) Config.applyConfig();
|
||||
ui.check(hbloom, "Bloom");
|
||||
if (hbloom.changed) Config.applyConfig();
|
||||
}
|
||||
|
||||
ui.separator();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user