Package limn.render3d

Record Class Material.Pbr

java.lang.Object
java.lang.Record
limn.render3d.Material.Pbr
All Implemented Interfaces:
Material
Enclosing interface:
Material

public static record Material.Pbr(Vec4 baseColor, float metallic, float roughness, Vec3 emissive, GpuTexture baseColorTexture, Material.NormalMap normalMap, BlendMode blend) extends Record implements Material
Metallic-roughness PBR (Cook-Torrance GGX), lit by every Light on the pass plus a flat ambient term. baseColor is authored in sRGB (the shader linearizes it) and, when baseColorTexture is set, modulated by that texture, including its alpha. metallic/roughness are in [0,1]; emissive is added after lighting (linear). A normalMap perturbs the shading normal in tangent space; null shades with the interpolated geometric normal.

A mesh carrying VertexAttribute.COLOR modulates base colour and emissive per vertex, linear and unclamped; see StandardSurface.

  • Constructor Details

    • Pbr

      public Pbr(Vec4 baseColor, float metallic, float roughness, Vec3 emissive, GpuTexture baseColorTexture, Material.NormalMap normalMap, BlendMode blend)
      Creates an instance of a Pbr record class.
      Parameters:
      baseColor - the value for the baseColor record component
      metallic - the value for the metallic record component
      roughness - the value for the roughness record component
      emissive - the value for the emissive record component
      baseColorTexture - the value for the baseColorTexture record component
      normalMap - the value for the normalMap record component
      blend - the value for the blend record component
  • Method Details

    • of

      public static Material.Pbr of(float r, float g, float b)
      An opaque dielectric of the given sRGB color (roughness 0.5, no texture).
    • metallic

      public Material.Pbr metallic(float metallic)
      A copy with a different metallic value, 0 dielectric to 1 metal.
    • roughness

      public Material.Pbr roughness(float roughness)
      A copy with a different roughness, 0 mirror to 1 fully diffuse.
    • emissive

      public Material.Pbr emissive(Vec3 emissive)
      A copy that also emits light, in linear scene-referred units, unaffected by lighting.
    • baseColor

      public Material.Pbr baseColor(Vec4 baseColor)
      A copy with a different base colour; its w is opacity.
    • textured

      public Material.Pbr textured(GpuTexture texture)
      A copy sampling texture for base colour, modulated by the base colour value.
    • normalMapped

      public Material.Pbr normalMapped(Material.NormalMap normalMap)
      null clears the map and shades with the geometric normal.
    • blend

      public Material.Pbr blend(BlendMode blend)
      null restores opaque.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • baseColor

      public Vec4 baseColor()
      Returns the value of the baseColor record component.
      Returns:
      the value of the baseColor record component
    • metallic

      public float metallic()
      Returns the value of the metallic record component.
      Returns:
      the value of the metallic record component
    • roughness

      public float roughness()
      Returns the value of the roughness record component.
      Returns:
      the value of the roughness record component
    • emissive

      public Vec3 emissive()
      Returns the value of the emissive record component.
      Returns:
      the value of the emissive record component
    • baseColorTexture

      public GpuTexture baseColorTexture()
      Returns the value of the baseColorTexture record component.
      Returns:
      the value of the baseColorTexture record component
    • normalMap

      public Material.NormalMap normalMap()
      Returns the value of the normalMap record component.
      Returns:
      the value of the normalMap record component
    • blend

      public BlendMode blend()
      Returns the value of the blend record component.
      Specified by:
      blend in interface Material
      Returns:
      the value of the blend record component