POV-Ray : Newsgroups : povray.general : CSG difference of isosurfaces : Re: CSG difference of isosurfaces Server Time
25 Apr 2024 09:25:58 EDT (-0400)
  Re: CSG difference of isosurfaces  
From: clipka
Date: 12 Nov 2016 07:50:56
Message: <58271030@news.povray.org>
Am 12.11.2016 um 11:57 schrieb John Greenwood:
> In my development of rounded objects I want to define two versions of a complex
> curvy shape, one bigger than the other, and take the smaller one away from the
> larger to leave a shell with (almost) uniform thickness.
> 
> I have tried to do this with CSG difference, but it appears that the smaller
> isosurface is transparent to rays meeting the inside surface. How can this
> surface be made visable? I think this could be a useful extension of this
> technique.

Computing isosurfaces is quite labour-intensive, and therefore the
algorithm is lazy by default: When computing where a ray intersects the
object's surface, it only searches for the intersection closest to the
observer, and ignores intersections further away.

As long as the isosurface is a stand-alone object, this goes unnoticed,
since the closest intersection point will translate into a surface,
hiding anything behind it.

However, when objects are used in a non-union CSG, some intersection
points may be discarded at a later stage, depending on whether they are
inside or outside the other objects in the CSG, and thus not translate
into a surface, leaving anything behind it exposed -- and in case of an
isosurface that "anything" may be the big gaping hole caused by the lazy
algorithm.


You can increase the number of intersections the isosurface algorithm
should search for before getting lazy, by specifying "max_trace NUMBER"
in the isosurface. Alternatively, you can specify "all_intersections" to
set the parameter to the highest value allowed (which in POV-Ray 3.7 is
equivalent to "max_trace 10".


Another approach to solve the problem would be to implement the
differencing operation in the isosurface function, rather than via CSG.
I reckon this might be faster.

In essence, the CSG difference between A and B is equivalent to an
intersection of A and the inverse of B. You can invert isosurface B by
flipping the sign of both the function and the threshold; you can then
adjust the threshold to match that of A by adding a constant to both the
function and threshold. And if I'm not mistaken you can intersect two
isosurfaces with identical thresholds and functions FnA() and FnB() by
using min(FnA(),FnB()) [or max(FnA(),FnB()), can't say off the top of my
head] as the function of a single isosurface.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.