Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/core/configcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// @}
///
Expand Down
4 changes: 2 additions & 2 deletions source/core/render/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
25 changes: 13 additions & 12 deletions source/core/scene/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down