This commit is contained in:
luboslenco
2020-03-23 17:08:48 +01:00
parent 95981f7e59
commit 7bb7e47bd5
3 changed files with 7 additions and 6 deletions
@@ -4,5 +4,4 @@
void main(SPIRV_Cross_Input stage_input) {
if (abs(stage_input.wpos.z) > 1.0 || abs(stage_input.wpos.x) > 1 || abs(stage_input.wpos.y) > 1) return;
voxels[int3(256, 256, 256) * (stage_input.wpos * 0.5 + 0.5)] = 1.0;
}
+6 -4
View File
@@ -189,9 +189,11 @@ vec3 brightcontrast(const vec3 col, const float bright, const float contr) {
//
public static var str_traceAO = "
static inline var voxRes = arm.render.Inc.getVoxelRes();
public static var str_traceAO = '
float traceConeAO(sampler3D voxels, const vec3 origin, vec3 dir, const float aperture, const float maxDist, const float offset) {
const ivec3 voxelgiResolution = ivec3(256, 256, 256);
const ivec3 voxelgiResolution = ivec3($voxRes, $voxRes, $voxRes);
const float voxelgiStep = 1.0;
const float VOXEL_SIZE = (2.0 / voxelgiResolution.x) * voxelgiStep;
dir = normalize(dir);
@@ -223,7 +225,7 @@ float traceAO(const vec3 origin, const vec3 normal, const float vrange, const fl
vec3 c1 = 0.5f * (o1 + o2);
vec3 c2 = 0.5f * (o1 - o2);
float MAX_DISTANCE = 1.73205080757 * 2.0 * vrange;
const ivec3 voxelgiResolution = ivec3(256, 256, 256);
const ivec3 voxelgiResolution = ivec3($voxRes, $voxRes, $voxRes);
const float voxelgiStep = 1.0;
const float VOXEL_SIZE = (2.0 / voxelgiResolution.x) * voxelgiStep;
float offset = 1.5 * VOXEL_SIZE * 2.5 * voffset;
@@ -238,7 +240,7 @@ float traceAO(const vec3 origin, const vec3 normal, const float vrange, const fl
col += traceConeAO(voxels, origin, mix(normal, c2, angleMix), aperture, MAX_DISTANCE, offset);
return col / 9.0;
}
";
';
public static var str_cotangentFrame = "
mat3 cotangentFrame(const vec3 n, const vec3 p, const vec2 duv1, const vec2 duv2) {
+1 -1
View File
@@ -182,7 +182,7 @@ class RenderPathPaint {
}
path.clearImage("voxels", 0x00000000);
path.setTarget("");
path.setViewport(256, 256);
path.setViewport(Inc.getVoxelRes(), Inc.getVoxelRes());
path.bindTarget("voxels", "voxels");
path.drawMeshes("voxel");
path.generateMipmaps("voxels");