
Sometimes, when you render a surface, you may find that you get nothing like
what you expect. This is supposed to be a "Bicorn" surface, but it looks
absolutely nothing like it.
What you're actually seeing is the "contained_by" surface.
isosurface {
function {f_bicorn(x,y,z,1,1)}
max_gradient 2
contained_by{sphere {0,R}}
pigment {rgb .9}
finish {phong 0.5 phong_size 10}
}


To see what's going on, we can slice the object in half. (Note, in passing
that when we perform CSG operations on an isosurface we need to specify
a max_trace parameter, otherwise some parts of the surface may be missing.
In this case max_trace 3 is just sufficient to cause the full surface to appear.
We can see that the surface that we wanted is buried inside, and it's hollow.
intersection {
plane {z, 0 }
isosurface {
function { f_bicorn(x,y,z,1,1) }
max_gradient 20
contained_by{sphere {0,R}}
max_trace 3
}
pigment {rgb .9}
finish {phong 0.5 phong_size 10}
}


This effect is caused by the fact that the inside of the surface is defined as the
region of space where the function is less
than the threshold (i.e. in this case the region where the function evaluates to a negative value).
For many functions, the inside is where you would expect it to be, but
some complicated functions are defined inside out.
We can invert the isosurface by making the function negative. (Note that we can't use the "inverse" command
because that inverts the contained_by surface as well and the result looks the same apart from the
"Camera is inside a nonhollow object" warning.) If we were using a threshold value
we would have to make that negative also.
isosurface {
function { 0  f_bicorn(x,y,z,1,1) }
max_gradient 5
contained_by{sphere {0,R}}
pigment {rgb .9}
finish {phong 0.5 phong_size 10}
}


Another way of solving the problem is to make the contained_by surface "open".
When you specify "open", the contained_by surface becomes invisible.
isosurface {
function { f_bicorn(x,y,z,1,1) }
max_gradient 2
contained_by{sphere {0,R}} open
pigment {rgb .9}
finish {phong 0.5 phong_size 10}
}

