Module gpuFlux

Class SpectralPerezSunSky

All Implemented Interfaces:
Transformation, Pickable, Renderable, Manageable, PersistenceCapable, Shareable, UserFields, XObject, Map, Serializable

public class SpectralPerezSunSky extends PerezSunSky
A PerezSunSky node with user-defined spectral power distributions.

Two independent SPDs can be set: one for the 72 diffuse sky-element lights and one for the direct sun light. If only setSpectrum(de.grogra.gpuflux.imp3d.spectral.SpectralCurve) is called, the same curve is used for both. The power values (DHI / DNI) inherited from PerezSunSky continue to control the radiometric quantities; the SPD shapes define the spectral composition.

Defaults: CIE D65 for the diffuse sky (standard daylight, CCT ≈ 6504 K) and a blackbody at 5778 K for the direct sun beam (solar photosphere temperature).

Usage example in RGG:

   SpectralPerezSunSky pss = new SpectralPerezSunSky(
       52f, 170, 12, 0, 200f, 800f, 15f, 0f);
   // defaults already apply; override if needed:
   pss.setSunSpectrum(new BlackbodySpectralCurve(6000f));
 

Author:
MH at YNL 2026
See Also:
  • Field Details

  • Constructor Details

    • SpectralPerezSunSky

      public SpectralPerezSunSky()
      Creates a spectral Perez sun+sky node with default parameters.
    • SpectralPerezSunSky

      public SpectralPerezSunSky(float latitude, int dayOfYear, int hourOfDay, int minuteOfHour, float dhi, float dni, float distance, float jitter)
      Parameters:
      latitude - geographic latitude [degrees]
      dayOfYear - day of year [1..365]
      hourOfDay - hour [0..23]
      minuteOfHour - minute [0..59]
      dhi - diffuse horizontal irradiance [W m⁻²]
      dni - direct normal irradiance [W m⁻²]
      distance - hemisphere radius [m]
      jitter - azimuth jitter [degrees, 0–15]
  • Method Details

    • setSpectrum

      public void setSpectrum(SpectralCurve curve)
      Sets the same SPD for both the sky dome elements and the direct sun light. To give the sun a different spectrum, call setSunSpectrum(de.grogra.gpuflux.imp3d.shading.SPDIF) afterwards.
      Parameters:
      curve - spectral curve (null resets both to flat white)
    • getSpectrum

      public SpectralCurve getSpectrum()
      Returns the sky-dome SPD.
    • setSkySpectrum

      public void setSkySpectrum(SpectralCurve curve)
      sets the spectral distribution of the sky
      Parameters:
      curve - is the spectral distribution
    • setSkySpectrum

      public void setSkySpectrum(SPDIF spd)
      sets the spectral distribution of the sky
      Parameters:
      curve - is the spectral distribution
    • setSunSpectrum

      public void setSunSpectrum(SPDIF spd)
      sets the spectral distribution of the sun
      Parameters:
      curve - is the spectral distribution
    • setSunSpectrum

      public void setSunSpectrum(SpectralCurve curve)
      sets the spectral distribution of the sun
      Parameters:
      curve - is the spectral distribution
    • wrapLight

      protected Light wrapLight(DirectionalLight dl)
      Called by PerezSunSky.buildLightEntries() for every directional light. Selects sky or sun SPD via the wrappingSun flag.
      Overrides:
      wrapLight in class SkyDome
    • buildLightEntries

      public SkyDome.LightEntry[] buildLightEntries()
      Overrides PerezSunSky.buildLightEntries() so that wrapLight(de.grogra.imp3d.objects.DirectionalLight) uses the correct SPD for sky elements (indices 0–71) vs. the direct sun light (index ).

      The sun entry is built last via a second pass with wrappingSun set to true.

      Overrides:
      buildLightEntries in class PerezSunSky
      Returns:
      array of 72 SkyDome.LightEntry objects
    • getNTypeImpl

      protected Node.NType getNTypeImpl()
      Description copied from class: Node
      This method returns the Node.NType which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      getNTypeImpl in class PerezSunSky
      Returns:
      type describing the managed fields of the class of this node
    • newInstance

      protected Node newInstance()
      Description copied from class: Node
      This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      newInstance in class PerezSunSky
      Returns:
      new instance of class of this node
    • isWrappingSun

      public boolean isWrappingSun()
    • setWrappingSun

      public void setWrappingSun(boolean value)
    • getSkySpectrum

      public SpectralLightMap getSkySpectrum()
    • setSkySpectrum

      public void setSkySpectrum(SpectralLightMap value)
    • getSunSpectrum

      public SpectralLightMap getSunSpectrum()
    • setSunSpectrum

      public void setSunSpectrum(SpectralLightMap value)