armory3d/armory

Reflections artifacts

e2002e opened this issue · 1 comments

When ssr is on, parts of objects that reflect but are not directly touching the object they reflect on have strange artifacts:

Capture d’écran du 2023-08-26 10-46-50

This most probably comes from this part of the code:

float getDeltaDepth(const vec3 hit) {
	depth = textureLod(gbufferD, getProjectedCoord(hit), 0.0).r * 2.0 - 1.0;
	vec3 viewPos = getPosView(viewRay, depth, cameraProj);
	return viewPos.z - hit.z;
}

It's telling the rayCast function whether we'r hitting an object or not. It must be tweaked in some way so that it doesn't return a positive value in the middle of nowhere.

this doesn't seem to happen with the official version.