Module imp3d

Class SkyDome

All Implemented Interfaces:
Transformation, Pickable, Renderable, Manageable, PersistenceCapable, Shareable, UserFields, XObject, Map, Serializable
Direct Known Subclasses:
PerezSunSky, SpectralSkyDome

public class SkyDome extends Null implements Renderable, Pickable
A scene node that models a uniform (isotropic) overcast sky hemisphere as 72 directional light sources arranged in 6 rings × 12 azimuths.

The ring geometry and per-ring solid-angle weights follow the Turtle sky discretization used in the Sun_Sky.rgg model (Buck-Sorlin & Henke, 2009/2013). For each ring r, the power density of each of the 12 constituent directional lights is:

   powerDensity_i = totalPower × RING_FRACTION[r] / sin(elevation[r])
 
so that the sum ∑powerDensity_i × sin(elevation_i) over all 72 lights equals totalPower (total diffuse horizontal irradiance).

Usage:

   SkyDome sky = new SkyDome(2000.0f, 15.0f, 0.0f);
 

Subclasses can override buildLightEntries() to provide an anisotropic sky radiance distribution (e.g. PerezSunSky).

Based on Sun_Sky.rgg by G. H. Buck-Sorlin and M. Henke (2009/2013).

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

    • N_LIGHTS

      public static final int N_LIGHTS
      Total number of sky directional lights (6 rings × 12 azimuths).
      See Also:
    • totalPower

      protected float totalPower
      Total diffuse sky irradiance on a horizontal surface [W m⁻²].
    • distance

      protected float distance
      Hemisphere radius / distance of light nodes from the scene origin [m].
    • visualizeDome

      protected boolean visualizeDome
    • jitter

      protected float jitter
      Azimuth jitter applied to all ring lights [degrees]. A small random offset (0–15°) avoids regular sampling artefacts.
    • colour

      protected RGBColor colour
      Colour of the emitted sky light (default white).
    • $TYPE

      public static final Node.NType $TYPE
    • totalPower$FIELD

      public static final Node.NType.Field totalPower$FIELD
    • distance$FIELD

      public static final Node.NType.Field distance$FIELD
    • visualizeDome$FIELD

      public static final Node.NType.Field visualizeDome$FIELD
    • jitter$FIELD

      public static final Node.NType.Field jitter$FIELD
  • Constructor Details

    • SkyDome

      public SkyDome()
      Creates a sky dome with default parameters.
    • SkyDome

      public SkyDome(float totalPower, float distance, float jitter)
      Parameters:
      totalPower - total diffuse sky irradiance [W m⁻²]
      distance - hemisphere radius [m]
      jitter - azimuth jitter [degrees, 0–15]
  • Method Details

    • calcDirection

      protected static Matrix3d calcDirection(Vector3d position)
      Builds the 3×3 rotation matrix that orients a DirectionalLight so that its rays travel from position toward the origin.

      Uses the same convention as Sun: column 2 (z-axis) of the orthogonal basis is aligned with position by Math2.getOrthogonalBasis(javax.vecmath.Tuple3f, javax.vecmath.Matrix3f, boolean), then negated so that the light's local +z points inward.

    • draw

      public void draw(Object object, boolean asNode, RenderState rs)
      Draws a line from the origin to each of the 72 sky-element positions in the 3D viewport so the hemisphere sampling pattern is visible.

      Uses RenderState.drawLine(javax.vecmath.Tuple3f, javax.vecmath.Tuple3f, javax.vecmath.Tuple3f, int, javax.vecmath.Matrix4d) (always drawn) rather than RenderState.drawPoint(javax.vecmath.Tuple3f, int, javax.vecmath.Tuple3f, int, javax.vecmath.Matrix4d) (gated by the "show points" viewport option) so the visualization is always visible.

      Specified by:
      draw in interface Renderable
    • update

      public void update(float totalPower)
      Updates the total sky power and reuses existing distance and jitter.
      Parameters:
      totalPower - total diffuse sky irradiance [W m⁻²]
    • update

      public void update(float totalPower, float distance, float jitter)
      Updates all sky dome parameters.
      Parameters:
      totalPower - total diffuse sky irradiance [W m⁻²]
      distance - hemisphere radius [m]
      jitter - azimuth jitter [degrees, 0–15]
    • buildLightEntries

      public SkyDome.LightEntry[] buildLightEntries()
      Computes the 72 sky SkyDome.LightEntry records for this sky dome in the node's local coordinate frame.

      The coordinate frame is GroIMP's standard z-up system: x = east, y = north, z = up.

      Override in subclasses to provide an anisotropic sky radiance distribution.

      Returns:
      array of 72 SkyDome.LightEntry objects
    • wrapLight

      protected Light wrapLight(DirectionalLight dl)
      Hook for subclasses to wrap each DirectionalLight before it is stored in a SkyDome.LightEntry. The default returns dl unchanged; override in e.g. SpectralSkyDome (GPUFlux module) to return a SpectralLight carrying a custom SPD.
    • getColour

      public RGBColor getColour()
      Returns the sky light colour.
    • setColour

      public void setColour(RGBColor value)
      Sets the sky light colour.
    • setColour

      public void setColour(float r, float g, float b)
      Sets the sky light colour from RGB components in [0, 1].
    • pick

      public void pick(Object object, boolean asNode, Point3d origin, Vector3d direction, Matrix4d t, PickList list)
      Description copied from interface: Pickable
      Computes intersections of a given ray with this shape.
      Specified by:
      pick in interface Pickable
      Parameters:
      object - the object of which this shape is an attribute
      asNode - true iff object is a node
      origin - the origin of the ray, in local coordinates
      direction - the direction of the ray, in local coordinates
      t - the transformation from local coordinates to world coordinates
      list - the list to which intersections have to be added
    • 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 Null
      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 Null
      Returns:
      new instance of class of this node
    • isVisualizeDome

      public boolean isVisualizeDome()
    • setVisualizeDome

      public void setVisualizeDome(boolean value)
    • getTotalPower

      public float getTotalPower()
    • setTotalPower

      public void setTotalPower(float value)
    • getDistance

      public float getDistance()
    • setDistance

      public void setDistance(float value)
    • getJitter

      public float getJitter()
    • setJitter

      public void setJitter(float value)