Package ca.eandb.jmist.framework.color

Examples of ca.eandb.jmist.framework.color.Color


//    private Color joinInnerToLight(ScatteringNode eyeNode, LightNode light) {
//      return joinInnerToInner(eyeNode, light);
//    }

    private Color join(PathNode lightTail, PathNode eyeTail, double lightImageWeight) {
      Color score = null;

      PathNode lightNode = lightTail;
      while (true) {

        PathNode eyeNode = eyeTail;
        while (true) {

          Color c = joinAt(lightNode, eyeNode, lightImageWeight);
          score = ColorUtil.add(score, c);

          if (eyeNode == null) {
            break;
          }
View Full Code Here


    }

    private Color joinAt(PathNode lightNode, PathNode eyeNode, double lightImageWeight) {
      int l = lightNode != null ? lightNode.getDepth() : -1;
      int e = eyeNode != null ? eyeNode.getDepth() : -1;
      Color c = null;
      if (e == 0 && l == 0) {
        c = joinLightToEye((LightNode) lightNode, (EyeNode) eyeNode,
            lightImageWeight);
      } else if (e <= 0 && l <= 0) {
        c = null;
      } else if (e < 0) {
        c = lightPathOnCamera((ScatteringNode) lightNode,
            lightImageWeight);
      } else if (l < 0) {
        c = eyePathOnLight((ScatteringNode) eyeNode);
      } else if (e == 0) {
        c = joinInnerToEye(lightNode, (EyeNode) eyeNode,
            lightImageWeight);
      } else if (l == 0) {
        c = joinLightToInner((LightNode) lightNode, eyeNode);
      } else {
        c = joinInnerToInner((ScatteringNode) lightNode, eyeNode);
      }

      if (c != null) {
//        synchronized (contribList) {
//          contribList.add((float) c.luminance());
//        }

        if (c.luminance() < 0.0) {
          bp();
        }
      }

      return c;
View Full Code Here

        Material mat = context.getMaterial();
        Vector3 v = x.getPosition().unitVectorFrom(p);
        Vector3 n = context.getShadingNormal();
        double d2 = x.getPosition().squaredDistanceTo(p);
        double atten = Math.max(n.dot(v), 0.0) * totalWeight / (4.0 * Math.PI * d2);
        Color ri = mat.emission(context, v, lambda).times(atten);
        LightSample sample = new PointLightSample(x, p, ri);

        target.addLightSample(sample);
      }

View Full Code Here

    }

    private Color joinInnerToInner(PathNode lightNode, PathNode eyeNode) {
      double w = strategy.getWeight(lightNode, eyeNode);
      if (w > 0.0) {//MathUtil.EPSILON) {
        Color c = measure.evaluate(lightNode, eyeNode);
        return ColorUtil.mul(c, w);
      } else {
        return null;
      }
    }
View Full Code Here

        double weight) {
      double w = strategy.getWeight(lightNode, eyeNode);
      if (w > 0.0) {//MathUtil.EPSILON) {
        Point2 p = eyeNode.project(lightNode.getPosition());
        if (p != null) {
          Color c = measure.evaluate(lightNode, eyeNode);
          c = ColorUtil.mul(c, weight * w);
          if (c != null) {
//            synchronized (contribList) {
//              contribList.add((float) c.luminance());
//            }
            if (c.luminance() < 0.0) {
              bp();
            }
            RasterUtil.addPixel(raster.get(), p, c);
          }
        }
View Full Code Here

        return null;
      }

      double w = strategy.getWeight(null, eyeNode);
      if (w > 0.0) {// MathUtil.EPSILON) {
        Color c = measure.evaluate(null, eyeNode);
        return ColorUtil.mul(c, w);
      } else {
        return null;
      }
    }
View Full Code Here

  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

    } 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

   */
  @Override
  public Color bsdf(SurfacePoint x, Vector3 in, Vector3 out,
      WavelengthPacket lambda) {
    if ((in.dot(x.getNormal()) < 0.0) == (out.dot(x.getNormal()) > 0.0)) {
      Color kd = kdPainter.getColor(x, lambda);
      Color d = kd.divide(Math.PI);

      Vector3 r = Optics.reflect(in, x.getNormal());
      double rdoto = r.dot(out);
      if (rdoto > 0.0) {
        Color ks = ksPainter.getColor(x, lambda);
        Color s = ks.times(((n + 2.0) / (2.0 * Math.PI)) * Math.pow(rdoto, n));
        return d.plus(s);
      } else {
        return d;
      }
    } else {
View Full Code Here

    double odotn = out.dot(x.getNormal());
    if ((vdotn > 0.0) != (odotn > 0.0)) {
      return 0.0;
    }

    Color kd = kdPainter.getColor(x, lambda);
    Color ks = ksPainter.getColor(x, lambda);
    double kdY = ColorUtil.getMeanChannelValue(kd);
    double rhod = kdY;

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

TOP

Related Classes of ca.eandb.jmist.framework.color.Color

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.