public Color traceRefraction(ShadingState previous, Ray r, int i) { // limit path depth and disable caustic paths if (previous.getRefractionDepth() >= maxRefractionDepth || previous.getDiffuseDepth() > 0) { return(Color.BLACK); } IntersectionState istate = previous.getIntersectionState(); scene.trace(r, istate); return(istate.hit() ? shadeHit(ShadingState.createRefractionBounceState(previous, r, i)) : Color.BLACK); }
public void traceRefractionPhoton(ShadingState previous, Ray r, Color power) { if (previous.getRefractionDepth() >= maxRefractionDepth) { return; } IntersectionState istate = previous.getIntersectionState(); scene.trace(r, istate); if (previous.getIntersectionState().hit()) { // create a new shading context ShadingState state = ShadingState.createRefractionBounceState(previous, r, 0); shadePhoton(state, power); } }