Module gpuFlux

Class PhysicalLight

All Implemented Interfaces:
Icon, IconSource, Raytraceable, Light, Scattering, Manageable, Shareable, RenderedIcon, Emitter, Light, Scattering

public class PhysicalLight extends PointLight implements IconSource, Icon, RenderedIcon
  • Field Details

  • Constructor Details

    • PhysicalLight

      public PhysicalLight()
      physical light constructor
    • PhysicalLight

      public PhysicalLight(LightDistributionIF distribution)
      physical light constructor
      Parameters:
      distribution - is the light emission distribution over the unit sphere
    • PhysicalLight

      public PhysicalLight(double[][] distribution)
      physical light constructor
      Parameters:
      distribution - is the 2D discretized light emission distribution over the unit sphere
  • Method Details

    • getManageableType

      public ManageableType getManageableType()
      Specified by:
      getManageableType in interface Manageable
      Overrides:
      getManageableType in class PointLight
    • getDistribution

      public LightDistributionIF getDistribution()
    • setDistribution

      public void setDistribution(LightDistributionIF value)
    • setDistribution

      public void setDistribution(double[][] distribution)
      sets the light emission dsitribution
      Parameters:
      distribution - is the 2D discretized light emission distribution over the unit sphere
    • setDistribution

      public void setDistribution(Light light)
      sets the light emission dsitribution by discretizing the emission distribution of an existing light source
      Parameters:
      light - is used to construct a discretized emission distribution
    • draw

      protected void draw(Tuple3f color, RenderState rs)
      Overrides:
      draw in class PointLight
    • generateRandomRays

      public void generateRandomRays(Environment env, Vector3f out, Spectrum specOut, RayList rays, boolean adjoint, Random rnd)
      Description copied from interface: Scattering
      Pseudorandomly generates, for the given input, a set of scattered rays. The scattered rays are generated such that they can be used for a Monte Carlo integration of a function f(ω;ν) over cos θ BSDF(ωi, νi; ωo, νo) in the following way:
      • If adjoint is false, out = ωo describes the direction of an outgoing light ray. In this case, the integration is with respect to ωi. Let g(ω, ν; out, μ) = BSDF(ω, ν; out, μ)
      • Otherwise, adjoint is true. In this case, out = ωi describes the direction of an outgoing importance ray (an inverse light ray). Now the integration is with respect to ωo. Let g(ω, ν; out, μ) = BSDF(out, μ; ω, ν)
      Let di and si denote the directions and spectra of the N generated rays (N = rays.size). Then, for every frequency ν the sum
      1 / N ∑i si(ν) f(di; ν)
      is an unbiased estimate for the integral
      ∫ cos θ f(ω; ν) g(ω, ν; out, μ) specOut(μ) dμ dω
      θ is the angle between the surface normal and ω. The domain of integration is the whole sphere, since the bidirectional scattering distribution includes both reflection and transmission (BSDF = BRDF + BTDF).

      If this Scattering instance is in fact a Light source, adjoint is true, and the BSDF is defined as BSDF(out, μ; ω, ν) = L1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted radiance at env.point, see Emitter. In this case, out is not used.

      If this Scattering instance is in fact a Sensor, adjoint is false, and the BSDF is defined as BSDF(ω, ν; out, μ) = W1(ω, ν) δ(μ - ν), i.e., the directional distribution of the emitted importance at env.point, see Emitter. In this case, out is not used.

      Let pω be the probability density used for the ray direction (measured with respect to solid angle ω), then the field directionDensity of the ray i is set to pω(di). For ideal specular reflection or transmission, or for directional lights or sensors, pω is not a regular function, the value directionDensity will be set to a multiple of Scattering.DELTA_FACTOR.

      The ray properties which are not mentioned in the given formulas are neither used nor modified. These are the origin and its density.

      Specified by:
      generateRandomRays in interface Scattering
      Overrides:
      generateRandomRays in class PointLight
      Parameters:
      env - the environment for scattering
      out - the direction unit vector of the outgoing ray (i.e., pointing away from the surface)
      specOut - the spectrum of the outgoing ray
      rays - the rays to be generated
      adjoint - represents out a light ray or an importance ray?
      rnd - pseudorandom generator
      See Also:
    • getDensityAt

      protected float getDensityAt(Vector3f direction)
      Overrides:
      getDensityAt in class PointLight
    • getSizeRatio

      public float getSizeRatio()
      Specified by:
      getSizeRatio in interface RenderedIcon
    • renderImage

      public int renderImage(JobManager jm, BufferedImage image, int t)
      Specified by:
      renderImage in interface RenderedIcon
    • paintIcon

      public void paintIcon(Component c, Graphics2D g, int x, int y, int w, int h, int state)
      Specified by:
      paintIcon in interface Icon
    • prepareIcon

      public void prepareIcon()
      Specified by:
      prepareIcon in interface Icon
    • getIconSource

      public IconSource getIconSource()
      Specified by:
      getIconSource in interface Icon
    • getImage

      public Image getImage()
      Specified by:
      getImage in interface Icon
    • getImage

      public Image getImage(int w, int h)
      Specified by:
      getImage in interface Icon
    • isMutable

      public boolean isMutable()
      Specified by:
      isMutable in interface Icon
    • getImageSource

      public URL getImageSource()
      Specified by:
      getImageSource in interface Icon
    • getIconBounds

      public Rectangle getIconBounds()
      Specified by:
      getIconBounds in interface Icon
    • getIcon

      public Icon getIcon(Dimension size, int state)
      Specified by:
      getIcon in interface IconSource
    • getPreferredIconSize

      public Dimension getPreferredIconSize(boolean small)
      Specified by:
      getPreferredIconSize in interface IconSource