diff --git a/source/core/configcore.h b/source/core/configcore.h index bee21bdde..d856367b0 100644 --- a/source/core/configcore.h +++ b/source/core/configcore.h @@ -198,7 +198,7 @@ /// @note /// Some algorithms use @ref SMALL_TOLERANCE instead. /// -#define MIN_ISECT_DEPTH 1.0e-4 +#define MIN_ISECT_DEPTH 0.0 /// @} /// diff --git a/source/core/render/trace.cpp b/source/core/render/trace.cpp index 337a941ed..2c673411d 100644 --- a/source/core/render/trace.cpp +++ b/source/core/render/trace.cpp @@ -366,7 +366,7 @@ bool Trace::FindIntersection(ObjectPtr object, Intersection& isect, const Ray& r { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH)) { isect = depthstack->top(); closest = tmpDepth; @@ -419,7 +419,7 @@ bool Trace::FindIntersection(ObjectPtr object, Intersection& isect, const Ray& r { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) { isect = depthstack->top(); closest = tmpDepth; diff --git a/source/core/scene/object.cpp b/source/core/scene/object.cpp index 16130bf9e..265cb9c21 100644 --- a/source/core/scene/object.cpp +++ b/source/core/scene/object.cpp @@ -137,7 +137,7 @@ bool Find_Intersection(Intersection *isect, ObjectPtr object, const Ray& ray, Tr { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH)) { *isect = depthstack->top(); closest = tmpDepth; @@ -191,7 +191,7 @@ bool Find_Intersection(Intersection *isect, ObjectPtr object, const Ray& ray, co { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) { *isect = depthstack->top(); closest = tmpDepth; @@ -237,7 +237,7 @@ bool Find_Intersection(Intersection *isect, ObjectPtr object, const Ray& ray, BB { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH)) { *isect = depthstack->top(); closest = tmpDepth; @@ -283,7 +283,7 @@ bool Find_Intersection(Intersection *isect, ObjectPtr object, const Ray& ray, BB { tmpDepth = depthstack->top().Depth; // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] - if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth >= MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) + if(tmpDepth < closest && (ray.IsSubsurfaceRay() || tmpDepth > MIN_ISECT_DEPTH) && postcondition(ray, object, tmpDepth)) { *isect = depthstack->top(); closest = tmpDepth; @@ -904,24 +904,25 @@ ObjectPtr CompoundObject::Invert() bool ObjectBase::Intersect_BBox(BBoxDirection variant, const BBoxVector3d& origin, const BBoxVector3d& invdir, BBoxScalar maxd) const { // TODO FIXME - This was SMALL_TOLERANCE, but that's too rough for some scenes [cjc] need to check what it was in the old code [trf] + // reverting to SMALL_TOLERANCE and using a far smaller MIN_ISECT_DEPTH with a strictly greater check, for FS324 [jg] switch(variant) { case BBOX_DIR_X0Y0Z0: // 000 - return Intersect_BBox_Dir<0, 0, 0>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<0, 0, 0>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X0Y0Z1: // 001 - return Intersect_BBox_Dir<0, 0, 1>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<0, 0, 1>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X0Y1Z0: // 010 - return Intersect_BBox_Dir<0, 1, 0>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<0, 1, 0>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X0Y1Z1: // 011 - return Intersect_BBox_Dir<0, 1, 1>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<0, 1, 1>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X1Y0Z0: // 100 - return Intersect_BBox_Dir<1, 0, 0>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<1, 0, 0>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X1Y0Z1: // 101 - return Intersect_BBox_Dir<1, 0, 1>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<1, 0, 1>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X1Y1Z0: // 110 - return Intersect_BBox_Dir<1, 1, 0>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<1, 1, 0>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); case BBOX_DIR_X1Y1Z1: // 111 - return Intersect_BBox_Dir<1, 1, 1>(BBox, origin, invdir, MIN_ISECT_DEPTH, maxd); + return Intersect_BBox_Dir<1, 1, 1>(BBox, origin, invdir, SMALL_TOLERANCE, maxd); } return false; // unreachable