Merge pull request #2125 from N8n5h/light-fix-2

Fix light visual artifact when close to the camera
This commit is contained in:
Lubos Lenco 2021-03-14 16:44:43 +01:00 committed by GitHub
commit 26c29fe15e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -8,6 +8,10 @@ int getClusterI(vec2 tc, float viewz, vec2 cameraPlane) {
float z = log(viewz - cnear + 1.0) / log(cameraPlane.y - cnear + 1.0);
sliceZ = int(z * (clusterSlices.z - 1)) + 1;
}
// address gap between near plane and cluster near offset
else if (viewz >= cameraPlane.x) {
sliceZ = 1;
}
return int(tc.x * clusterSlices.x) +
int(int(tc.y * clusterSlices.y) * clusterSlices.x) +
int(sliceZ * clusterSlices.x * clusterSlices.y);

View file

@ -253,7 +253,7 @@ project.addSources('Sources');
if wrd.arm_debug_console:
assets.add_khafile_def('arm_debug')
khafile.write(add_shaders(sdk_path + "/armory/Shaders/debug_draw/**", rel_path=do_relpath_sdk))
if not is_publish and state.target == 'html5':
khafile.write("project.addParameter('--debug');\n")
@ -711,7 +711,7 @@ const float voxelgiAperture = """ + str(round(rpdat.arm_voxelgi_aperture * 100)
f.write(
"""const int maxLights = """ + max_lights + """;
const int maxLightsCluster = """ + max_lights_clusters + """;
const float clusterNear = 4.0;
const float clusterNear = 3.0;
""")
f.write(add_compiledglsl + '\n') # External defined constants