Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Vector3.dot()


            public void prepareShadingContext(ShadingContext context) {
              Plane3 plane = Plane3.throughPoints(vertices[vertexIndex], vertices[vertexIndex+1], vertices[vertexIndex+2]);
              Vector3 n = plane.normal();
              Vector3 v = ray.direction();
              context.setPosition(ray.pointAt(t));
              context.setNormal(v.dot(n) > 0.0 ? n.opposite() : n);
              context.setMaterial(hairMaterial != null ? hairMaterial : emitterContext.getMaterial());
              context.setModifier(emitterContext.getModifier());
              context.setPrimitiveIndex(base + strandIndex);
              context.setShader(emitterContext.getShader());
              context.setUV(emitterContext.getUV());
View Full Code Here


        Point3 p = context.getPosition();
        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

    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 {
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));

    Vector3 r = Optics.reflect(in, x.getNormal());
    double rdoto = r.dot(out);

    double pdfd = rhod / Math.PI;
    double pdfs = rdoto > 0.0 ? rhos * (Math.pow(rdoto, n) / Math.abs(odotn)) * (n + 1.0) / (2.0 * Math.PI) : 0.0;

    return pdfd + pdfs;
View Full Code Here

    return lambda.getColorModel().getGray(bsdf(x, in, out), lambda);
  }

  public double bsdf(SurfacePoint x, Vector3 in, Vector3 out) {
    Vector3 n = x.getNormal();
    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);

    return (ndoti > 0.0) == (ndoto > 0.0)
        ? brdf(x, in, out, n)
        : btdf(x, in, out, n);
View Full Code Here

  }

  public double bsdf(SurfacePoint x, Vector3 in, Vector3 out) {
    Vector3 n = x.getNormal();
    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);

    return (ndoti > 0.0) == (ndoto > 0.0)
        ? brdf(x, in, out, n)
        : btdf(x, in, out, n);
  }
View Full Code Here

    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);

    /* Eq. (13) */
    Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
    hr = hr.dot(n) > 0.0 ? hr : hr.opposite();

    double g = microfacets.getShadowingAndMasking(in, out, hr, n);
    double d = microfacets.getDistributionPDF(hr, n);
    double f = Optics.reflectance(in, n1, n2, hr);

View Full Code Here

      no = n1;
    }

    /* Eq. (16) */
    Vector3 ht = in.times(ni).minus(out.times(no)).unit();
    ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

    double hdoti = -ht.dot(in);
    double hdoto = ht.dot(out);
    double ndoto = n.dot(out);

View Full Code Here

    /* Eq. (16) */
    Vector3 ht = in.times(ni).minus(out.times(no)).unit();
    ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

    double hdoti = -ht.dot(in);
    double hdoto = ht.dot(out);
    double ndoto = n.dot(out);

    double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
    double c = ni * hdoti + no * hdoto;
 
View Full Code Here

    /* Eq. (16) */
    Vector3 ht = in.times(ni).minus(out.times(no)).unit();
    ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

    double hdoti = -ht.dot(in);
    double hdoto = ht.dot(out);
    double ndoto = n.dot(out);

    double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
    double c = ni * hdoti + no * hdoto;

 
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.