Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Ray3


   */
  @Override
  public ScatteredRay emit(SurfacePoint x, WavelengthPacket lambda,
      double ru, double rv, double rj) {
    Vector3 r = RandomUtil.diffuse(ru, rv).toCartesian(x.getBasis());
    Ray3 ray = new Ray3(x.getPosition(), r);
    double pdf = 1.0 / Math.PI;
    Color color = inner.emission(x, r, lambda).divide(pdf);
    return ScatteredRay.diffuse(ray, color, pdf);
  }
View Full Code Here


      pdf *= (1.0 - reflectance);
    } else {
      pdf *= reflectance;
    }

    Ray3 ray = new Ray3(x.getPosition(), r);
    Color color = inner.bsdf(x, v, r, lambda).divide(pdf);
    return ScatteredRay.diffuse(ray, color, pdf);
  }
View Full Code Here

    double ksY = ColorUtil.getMeanChannelValue(ks);
    double rhos = Math.min(1.0, ksY * Math.abs(vdotn) * (n + 2.0) / (n + 1.0));

    if (rj < rhod) {
      Vector3 out = RandomUtil.diffuse(ru, rv).toCartesian(x.getBasis());
      Ray3 ray = new Ray3(x.getPosition(), out);
      return ScatteredRay.diffuse(ray, kd.divide(rhod), getScatteringPDF(x, v, out, adjoint, lambda));
    } else if (rj < rhod + rhos) {
      Vector3 r = Optics.reflect(v, x.getNormal());
      Vector3 out = new SphericalCoordinates(Math.acos(Math.pow(ru, 1.0 / (n + 1.0))), 2.0 * Math.PI * rv).toCartesian(Basis3.fromW(r));
      double ndoto = x.getNormal().dot(out);
      Color weight = ks.times(((n + 2.0) / (n + 1.0)) * Math.abs(ndoto) / rhos);
      //double rdoto = r.dot(out);
      double pdf = getScatteringPDF(x, v, out, adjoint, lambda);//rhod / Math.PI + rhos * (Math.pow(rdoto, n) / ndoto) * (n + 1.0) / (2.0 * Math.PI);
      Ray3 ray = new Ray3(x.getPosition(), out);
      return ScatteredRay.glossy(ray, weight, pdf);
    }
    return null;
  }
View Full Code Here

    double g = microfacets.getShadowingAndMasking(v, out, m, n);
    double weight = (mdoti / (ndoti * mdotn)) * g;
    double pdf = getScatteringPDF(x, v, out, adjoint, lambda);

    return new ScatteredRay(new Ray3(x.getPosition(), out), lambda.getColorModel().getGray(weight, lambda), ScatteredRay.Type.GLOSSY, pdf, !reflected);

  }
View Full Code Here

    if (r != null) {

      Vector3 n = x.getNormal();
      Point3 p = x.getPosition();
      Ray3 ray = new Ray3(p, r);

      Color color = colorModel.getWhite(lambda);

      if (r.dot(n) > 0.0) {
        return ScatteredRay.specular(ray, color, 0.0);
View Full Code Here

  }

  protected final GeometryIntersection newSurfacePoint(Point3 p, boolean front, int surfaceId) {

    return new GeometryIntersection(this, new Ray3(p, Vector3.ZERO), 0.0,
        front, surfaceId);

  }
View Full Code Here

//      }
//
//      return null;

      col = col.times(-thickness.get() / Math.cos(Math.abs(x.getNormal().dot(v)))).exp();
      return ScatteredRay.transmitSpecular(new Ray3(x.getPosition(), v), col, 1.0);

    }
View Full Code Here

            2.0 * Math.PI * rv);
        w = perturb.toCartesian(basis);
      } while ((w.dot(N) > 0.0) != toSide);
    }

    return new ScatteredRay(new Ray3(x.getPosition(), w),
        lambda.getColorModel().getWhite(lambda),
        Double.isInfinite(specularity) ? Type.SPECULAR : Type.DIFFUSE,
        1.0, fromSide != toSide);
  }
View Full Code Here

    if (v.dot(N) < 0.0) {
      N = N.opposite();
    }

    return ScatteredRay.transmitDiffuse(new Ray3(x.getPosition(),
        RandomUtil.diffuse(ru, rv).toCartesian(Basis3.fromW(N))),
        lambda.getColorModel().getWhite(lambda), 1.0);
  }
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.math.Ray3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.