Examples of SeedReference


Examples of ca.eandb.jmist.framework.random.SeedReference

      }

      public LightNode sample(PathInfo pathInfo, double ru, double rv, double rj) {
        ShadingContext context = new MinimalShadingContext(null);

        SeedReference ref = new SeedReference(rj);
        int index = rnd.next(ref);
        int primitive = primIndex[index];

        generateRandomSurfacePoint(primitive, context, ru, rv, ref.seed);
        context.getModifier().modify(context);
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Light#sample(ca.eandb.jmist.framework.path.PathInfo, double, double, double)
   */
  public LightNode sample(PathInfo pathInfo, double ru, double rv, double rj) {
    SeedReference ref = new SeedReference(rj);
    int index = RandomUtil.discrete(0, children().size() - 1, ref);
    return ScaledLightNode.create(1.0 / children().size(),
        children().get(index).sample(pathInfo, ru, rv, ref.seed), rj);
  }
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

   */
  public ScatteredRay emit(SurfacePoint x, WavelengthPacket lambda,
      double ru, double rv, double rj) {
    if (inner.isEmissive()) {
      double w = weight * strategy.getWeight(x, lambda);
      SeedReference ref = new SeedReference(rj);
      if (RandomUtil.bernoulli(w, ref)) {
        ScatteredRay sr = strategy.emit(x, lambda, ru, rv, ref.seed);
        if (sr != null) {
          if (sr.getType() == Type.SPECULAR) {
            return ScatteredRay.select(sr, w);
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

   * @see ca.eandb.jmist.framework.Material#scatter(ca.eandb.jmist.framework.SurfacePoint, ca.eandb.jmist.math.Vector3, boolean, ca.eandb.jmist.framework.color.WavelengthPacket, double, double, double)
   */
  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {
    double w = weight * strategy.getWeight(x, lambda);
    SeedReference ref = new SeedReference(rj);
    if (RandomUtil.bernoulli(w, ref)) {
      ScatteredRay sr = strategy.scatter(x, v, adjoint, lambda, ru, rv, ref.seed);
      if (sr != null) {
        if (sr.getType() == Type.SPECULAR) {
          return ScatteredRay.select(sr, w);
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

    ScatteredRay result = null;
    boolean aemit = a.isEmissive();
    boolean bemit = b.isEmissive();
    if (aemit && bemit) {
      double t = mask.opacity(x.getUV());
      SeedReference ref = new SeedReference(ru);
      if (RandomUtil.bernoulli(t, ref)) {
        result = b.emit(x, lambda, ref.seed, rv, rj);
        if (result != null) {
          result = new ScatteredRay(result.getRay(), result
              .getColor(), result.getType(), result.getPDF() * t,
 
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

    if (MathUtil.equal(t, 0.0)) {
      return a.scatter(x, v, adjoint, lambda, ru, rv, rj);
    } else if (MathUtil.equal(t, 1.0)) {
      return b.scatter(x, v, adjoint, lambda, ru, rv, rj);
    } else {
      SeedReference ref = new SeedReference(rj);
      return RandomUtil.bernoulli(t, ref) ?
          b.scatter(x, v, adjoint, lambda, ru, rv, ref.seed) :
          a.scatter(x, v, adjoint, lambda, ru, rv, ref.seed);
    }
  }
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

      }

      public LightNode sample(PathInfo pathInfo, double ru, double rv, double rj) {
        ShadingContext context = new MinimalShadingContext(null);

        SeedReference ref = new SeedReference(rj);
        int index = rnd.next(ref);
        int primitive = primIndex[index];

        generateRandomSurfacePoint(primitive, context, ru, rv, ref.seed);
        context.getModifier().modify(context);
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

   * @see ca.eandb.jmist.framework.Material#scatter(ca.eandb.jmist.framework.SurfacePoint, ca.eandb.jmist.math.Vector3, boolean, ca.eandb.jmist.framework.color.WavelengthPacket, double, double, double)
   */
  @Override
  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {
    SeedReference ref = new SeedReference(ru);
    boolean reflect = RandomUtil.bernoulli(reflectance, ref);
    Vector3 r = RandomUtil.diffuse(ref.seed, rv).toCartesian(x.getBasis());
    double pdf = 1.0 / Math.PI;

    if (!reflect) {
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

    }

    public Point3 generateRandomSurfacePoint(double ru, double rv, double rj) {
      decompose();
      SeedReference vref = new SeedReference(rv);
      int tri = 3 * rnd.next(vref);
      Point3 a = vertices.get(indices[decomp[tri]]);
      Point3 b = vertices.get(indices[decomp[tri + 1]]);
      Point3 c = vertices.get(indices[decomp[tri + 2]]);
      return RandomUtil.uniformOnTriangle(a, b, c, ru, vref.seed);
View Full Code Here

Examples of ca.eandb.jmist.framework.random.SeedReference

        }

        @Override
        public LightNode sample(PathInfo pathInfo, double ru,
            double rv, double rj) {
          SeedReference ref = new SeedReference(rj);
          int index = RandomUtil.discrete(0, lightCount - 1, ref);
          for (int i = 0, n = lights.size(); i < n; i++) {
            Light light = lights.get(i);
            if (light != null) {
              if (index-- == 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.