POV-Ray / povray

The Persistence of Vision Raytracer: http://www.povray.org/
GNU Affero General Public License v3.0
1.35k stars 282 forks source link

Shadow makes isosurface part disappear instead of being a projected shadow. #375

Closed zebulon-1st closed 5 years ago

zebulon-1st commented 5 years ago

Summary

A shadow from an isosurface object, projected onto one of itself's part, is not a shadow but a disappeared region of the isosurface, instead.

Environment

Render Settings

+isimple.pov +osimple.png -w1024 -h1024 -c +d +p +fn +a -am2

Scene

simple.pov :

#version 3.7;

#include "colors.inc"
#include "consts.inc"
#include "functions.inc"

#default {
  finish { ambient 0.2 diffuse 0.4 }
}

#local CAMERA_TRANSFORM = transform {
  translate -z * 7
  rotate     z * 5
  rotate     x * 30
  rotate     y * 20
}

camera {
  location  -z * 3
  look_at    o
  direction  z * 3
  sky y // left hand coords system
  right  x
  up     y
  transform { CAMERA_TRANSFORM }
}

light_source {
  < -1/4, 1/2, -1 > * 8
  color Gray85
  /*area_light
  x, z, 11, 11
  adaptive 2
  area_illumination on
  circular
  orient*/
  transform { CAMERA_TRANSFORM } // follow camera moves
}

#local Arrow = union {
  cylinder { o, x*(1.5-0.15), 0.01 }
  cone { x*(1.5-0.15), 0.03, x*1.5, 0 }
}

union {
  object { Arrow                pigment { Blue   } } // X direction
  object { Arrow rotate  z * 90 pigment { Green  } } // Y direction
  object { Arrow rotate -y * 90 pigment { Yellow } } // Z direction
}

difference {
  intersection {
    isosurface {
      function {
        min(
          f_sphere(x,0,z, 1/2),
          f_sphere(x,y,0, 1/3)
        )
        #local Scale = 1/100;
        + f_noise3d(x / Scale, y / Scale, z / Scale) * Scale
      }
      #if (0)
        max_gradient 0.1
      #else
        #local Max_Gradient = 3;
        #local Min_factor   = 0.6;
        evaluate Max_Gradient * Min_factor, sqrt(1 / Min_factor), 0.7
        accuracy 0.001
      #end
      contained_by {
        box {
          < -1.1, -1/2 - 0.1, -1.1 >,
          <  1.1,  1/2 + 0.1,  1.1 >
        }
      }
      pigment { color Red }
    }
    box {
      < -1.2, -1/2, -1.2 >,
      <  1.2,  1/2,  1.2 >
      pigment { color Cyan }
    }
  }
  union {
    cylinder { -y, y, 1/3 }
    cone { o, 1/2, +y/2, 0 translate -y * (1/2 + 0.15) }
    cone { o, 1/2, -y/2, 0 translate  y * (1/2 + 0.15) }
    pigment { color Cyan }
  }
}

Result

zebulon-1st commented 5 years ago

By reading a previous old issue (#70) about parametric that have holes, I found the solution about my problem : adding all_intersections in the isosurface statement makes the hole disappear :

Sadly, when I opened this issue, no other issue related to my problem had been shown in a list.