Package ca.eandb.jmist.framework.color

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


        double    cy = Math.cos(ny);

        Ray3    ray = new Ray3(
                  Point3.ORIGIN,
                  new Vector3(-sx * cy, sy, -cx * cy));
        Color    color = getWhite();
        double    pdf = 1.0 / solidAngle;
      return ScatteredRay.diffuse(ray, color, pdf);
    }
View Full Code Here


  @Override
  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {

    ScatteredRay sr = null;
    Color col = lambda.getColorModel().getWhite(lambda);

    for (Material e : inner) {
      sr = e.scatter(x, v, adjoint, lambda, rnd.next(), rnd.next(), rnd.next());
      if (sr == null) break;
      v = sr.getRay().direction();
      col = col.times(sr.getColor());
    }

    if (sr == null) {
      return null;
    } else if (sr.getRay().direction().dot(x.getNormal()) < 0.0) {
View Full Code Here

   */
  @Override
  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {

    Color col = absorptionCoefficient.sample(lambda);
//    double abs = ColorUtil.getMeanChannelValue(col);
//
//    if (abs > MathUtil.EPSILON) {
//      double p = -Math.log(1.0 - ru) * Math.abs(x.getNormal().dot(v)) / abs;
//
//      col = col.times(-thickness).exp();
//      col = col.divide(ColorUtil.getMeanChannelValue(col));
//
//      if (p > thickness) {
//        return ScatteredRay.transmitSpecular(new Ray3(x.getPosition(), v), col, 1.0);
//      }
//    }
//
//    return null;

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

  }
View Full Code Here

  private void reapplyVisualizer() {
    int w = ldrImage.getWidth();
    for (int i = recorded.nextSetBit(0); i >= 0; i = recorded.nextSetBit(i + 1)) {
      int x = i % w;
      int y = i / w;
      Color pixel = rawImage.getPixel(x, y);
      int rgb = visualizer.visualize(pixel).toR8G8B8();
      ldrImage.setRGB(x, y, rgb);
    }
    super.repaint();
  }
View Full Code Here

    if (!prepareVisualizer(w * h)) {
      BufferedImage ldrTile = ldrImage.getSubimage(x, y, w, h);
      for (int ry = 0; ry < h; ry++) {
        for (int rx = 0; rx < w; rx++) {
          Color pixel = pixels.getPixel(rx, ry);
          int rgb = visualizer.visualize(pixel).toR8G8B8();
          ldrTile.setRGB(rx, ry, rgb);
        }
      }
      repaintPartialImage(x, y, w, h);
View Full Code Here

    Vector3 N = x.getNormal();
    int  depth = (v.dot(N) > 0.0) ? (layers.size() - 1) : 0;
    int dir;

    ScatteredRay sr;
    Color col = lambda.getColorModel().getWhite(lambda);

    do  {

      Material layer = layers.get(depth);
      sr = layer.scatter(x, v, adjoint, lambda, rnd.next(), rnd.next(), rnd.next());

      if (sr == null) return null;
      v = sr.getRay().direction();

      dir = (v.dot(N) > 0.0) ? -1 : 1;
      depth += dir;

      col = col.times(sr.getColor());

    } while (depth >= 0 && depth < layers.size());

    return depth < 0
      ? ScatteredRay.diffuse(sr.getRay(), col, 1.0)
View Full Code Here

   */
  @Override
  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {

    Color col = absorptionCoefficient.sample(lambda);
//    double abs = ColorUtil.getMeanChannelValue(col);
//
//    if (abs > MathUtil.EPSILON) {
//      double p = -Math.log(1.0 - rnd.next()) * Math.cos(Math.abs(x.getNormal().dot(v))) / abs;
//
//      col = col.times(-thickness).exp();
//      col = col.divide(ColorUtil.getMeanChannelValue(col));
//
//      if (p > thickness) {
//        return ScatteredRay.transmitSpecular(new Ray3(x.getPosition(), v), col, 1.0);
//      }
//    }
//
//    return null;

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

  }
View Full Code Here

          for (int sensor = 0; sensor < worker.collector.sensors(); sensor++) {

            SphericalCoordinates  exitantAngle      = worker.collector.getSensorCenter(sensor);
            double          solidAngle        = worker.collector.getSensorSolidAngle(sensor);
            double          projectedSolidAngle    = worker.collector.getSensorProjectedSolidAngle(sensor);
            Color          raw            = sensorArray.getTotalWeight(sensor);
            Color          reflectance        = raw.divide(this.outstandingSamplesPerMeasurement);

            out.printf(
                "%d,%f,%f,%d,%d,%f,%f,%f,%f,%d,%s,%s,%s,%s",
                specimenIndex,
                incidentAngle.polar(),
                incidentAngle.azimuthal(),
                wavelengthIndex,
                sensor,
                exitantAngle.polar(),
                exitantAngle.azimuthal(),
                solidAngle,
                projectedSolidAngle,
                this.outstandingSamplesPerMeasurement,
                colorToCSV(raw),
                colorToCSV(reflectance),
                colorToCSV(reflectance.divide(projectedSolidAngle)),
                colorToCSV(reflectance.divide(solidAngle))
            );
            out.println();

          }
View Full Code Here

        Material mat = material;//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) * surfaceArea / (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

              double time    = RandomUtil.uniform(shutter, random);
              animator.setTime(time);
            }

            Point2 p      = RandomUtil.uniform(bounds, random);
            Color sample    = colorModel.sample(random);
            PathInfo path    = new PathInfo(scene, sample.getWavelengthPacket());
            PathNode eyeTail  = strategy.traceEyePath(lens, p,
                          path, random);

            for (int j = 0; j < lightPathsPerEyePath; j++) {

              PathNode lightTail  = strategy.traceLightPath(
                            light, path, random);

              Color score      = join(lightTail, eyeTail,
                            lightImageWeight);
              if (score != null) {
                raster.get().addPixel(x, y,
                    score.divide(samplesPerPixel));
              }

            }

          }
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.