threejs-worldgen
    Preparing search index...

    Function createCornUniforms

    • Creates the uniform set shared by a Corn field's stalk and canopy materials. Corn calls this for you and drives the values from Corn.set(); it is exported so the CornUniforms type is documented in full.

      Returns {
          colorVariation: UniformNode<"float", number>;
          debugLods: UniformNode<"float", number>;
          dryColor: UniformNode<"color", Color>;
          flatten: TextureNode<"vec4">;
          flattenBounds: UniformNode<"vec4", Vector4>;
          growth: UniformNode<"float", number>;
          harvested: UniformNode<"float", number>;
          height: UniformNode<"float", number>;
          heightVariation: UniformNode<"float", number>;
          interactionStrength: UniformNode<"float", number>;
          interactorCount: UniformNode<"int", number>;
          interactors: UniformArrayNode<string>;
          leafColor: UniformNode<"color", Color>;
          lodDensities: UniformNode<"vec4", Vector4>;
          lodDistances: UniformNode<"vec4", Vector4>;
          patchiness: UniformNode<"float", number>;
          soilColor: UniformNode<"color", Color>;
          stiffness: UniformNode<"float", number>;
          stubbleHeight: UniformNode<"float", number>;
          sunColor: UniformNode<"color", Color>;
          sunDirection: UniformNode<"vec3", Vector3>;
          tasselColor: UniformNode<"color", Color>;
          translucency: UniformNode<"float", number>;
          viewPosition: UniformNode<"vec3", Vector3>;
          windDirection: UniformNode<"vec2", Vector2>;
          windScale: UniformNode<"float", number>;
          windSpeed: UniformNode<"float", number>;
          windStrength: UniformNode<"float", number>;
          youngColor: UniformNode<"color", Color>;
      }

      • colorVariation: UniformNode<"float", number>

        Per-plant brightness variation, 0..1.

      • debugLods: UniformNode<"float", number>

        1 tints corn by level of detail.

      • dryColor: UniformNode<"color", Color>

        Dry leaf, husk and stubble colour.

      • flatten: TextureNode<"vec4">

        Where corn was flattened (see FlattenMap).

      • flattenBounds: UniformNode<"vec4", Vector4>

        minX, minZ, sizeX, sizeZ of the flatten map in world space.

      • growth: UniformNode<"float", number>

        Growth stage: 0 seedling … ~0.65 full height … 0.8 mature … 1 dry.

      • harvested: UniformNode<"float", number>

        1 = harvested: stubble only.

      • height: UniformNode<"float", number>

        Mature stalk height in metres, tassel included.

      • heightVariation: UniformNode<"float", number>

        0..1 random height spread per plant.

      • interactionStrength: UniformNode<"float", number>

        Global multiplier on interactor push (and flattening).

      • interactorCount: UniformNode<"int", number>

        Number of active entries in interactors.

      • interactors: UniformArrayNode<string>

        xyz = world position, w = radius (0 = unused slot).

      • leafColor: UniformNode<"color", Color>

        Mature leaf colour.

      • lodDensities: UniformNode<"vec4", Vector4>

        The four LOD density fractions.

      • lodDistances: UniformNode<"vec4", Vector4>

        The four LOD distances (x, y, z, w = LOD 0..3); stalks end at w.

      • patchiness: UniformNode<"float", number>

        Field-scale brightness and dryness variation, 0..1.

      • soilColor: UniformNode<"color", Color>

        Bare soil colour between young rows and under the canopy.

      • stiffness: UniformNode<"float", number>

        Resistance to wind and interaction (never below 0.05).

      • stubbleHeight: UniformNode<"float", number>

        Stubble height in metres after harvest.

      • sunColor: UniformNode<"color", Color>

        Sun colour × intensity.

      • sunDirection: UniformNode<"vec3", Vector3>

        Direction towards the sun.

      • tasselColor: UniformNode<"color", Color>

        Tassel colour.

      • translucency: UniformNode<"float", number>

        Back-lit glow of the leaves.

      • viewPosition: UniformNode<"vec3", Vector3>

        Position LOD is measured from (the Corn camera), so shadow passes see the same plants.

      • windDirection: UniformNode<"vec2", Vector2>

        Normalised XZ wind direction.

      • windScale: UniformNode<"float", number>

        Gust noise frequency (1/metres).

      • windSpeed: UniformNode<"float", number>

        Gust travel speed.

      • windStrength: UniformNode<"float", number>

        How far stalks bend in the wind.

      • youngColor: UniformNode<"color", Color>

        Young leaf colour (seedlings).