Fix deferred voxelgi
This commit is contained in:
parent
d64441b7d3
commit
d00f31ef8d
|
@ -414,14 +414,14 @@ class Inc {
|
|||
}
|
||||
path.clearImage("voxels", 0x00000000);
|
||||
}
|
||||
public static function computeVoxels(i:Int) {
|
||||
public static function computeVoxels() {
|
||||
var rts = path.renderTargets;
|
||||
var res = Inc.getVoxelRes();
|
||||
var lights = iron.Scene.active.lights;
|
||||
// for (i in 0...lights.length) {
|
||||
for (i in 0...lights.length) {
|
||||
var l = lights[i];
|
||||
// if (!l.visible) continue;
|
||||
// path.currentLightIndex = i;
|
||||
if (!l.visible) continue;
|
||||
path.light = l;
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh);
|
||||
kha.compute.Compute.setTexture(voxel_ta, rts.get("voxelsOpac").image, kha.compute.Access.Read);
|
||||
|
@ -478,7 +478,7 @@ class Inc {
|
|||
}
|
||||
|
||||
kha.compute.Compute.compute(res, res, res);
|
||||
// }
|
||||
}
|
||||
}
|
||||
public static function computeVoxelsEnd() {
|
||||
var rts = path.renderTargets;
|
||||
|
|
|
@ -545,6 +545,10 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
#if (rp_shadowmap)
|
||||
Inc.drawShadowMap();
|
||||
#end
|
||||
|
||||
// Voxels
|
||||
#if (rp_gi != "Off")
|
||||
var relight = false;
|
||||
|
@ -588,10 +592,9 @@ class RenderPathDeferred {
|
|||
|
||||
if (relight) {
|
||||
#if (rp_gi == "Voxel GI")
|
||||
// Inc.computeVoxelsBegin();
|
||||
// for (i in 0...lights.length) Inc.computeVoxels(i); // Redraws SM
|
||||
// Inc.computeVoxelsEnd();
|
||||
|
||||
Inc.computeVoxelsBegin();
|
||||
Inc.computeVoxels();
|
||||
Inc.computeVoxelsEnd();
|
||||
// #if (rp_gi_bounces)
|
||||
// voxels = "voxelsBounce";
|
||||
// #end
|
||||
|
@ -605,22 +608,6 @@ class RenderPathDeferred {
|
|||
// ---
|
||||
// Deferred light
|
||||
// ---
|
||||
var lights = iron.Scene.active.lights;
|
||||
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxelsBegin();
|
||||
// #end
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxels(i);
|
||||
// #end
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxelsEnd();
|
||||
// #end
|
||||
|
||||
#if (rp_shadowmap)
|
||||
Inc.drawShadowMap();
|
||||
#end
|
||||
|
||||
path.setDepthFrom("tex", "gbuffer1"); // Unbind depth so we can read it
|
||||
path.setTarget("tex");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
|
|
|
@ -267,7 +267,7 @@ class RenderPathForward {
|
|||
if (relight) {
|
||||
#if (rp_gi == "Voxel GI")
|
||||
Inc.computeVoxelsBegin();
|
||||
Inc.computeVoxels(0);
|
||||
Inc.computeVoxels();
|
||||
Inc.computeVoxelsEnd();
|
||||
// #if (rp_gi_bounces)
|
||||
// voxels = "voxelsBounce";
|
||||
|
|
Loading…
Reference in a new issue