Skip to content

Environment

Aeroluna edited this page Feb 11, 2024 · 12 revisions

Nothin but Chroma baby!

Set "PrintEnvironmentEnhancementDebug" to true in the Chroma.json config file to print environment enhancement information to your console.

Environment Enhancement

  • "customData" -> "environment" (array)
    • "id": (string) The ID to use when looking up the GameObject.
    • "lookupMethod": (string) How to use the ID to search. NOTE: Regex will cause the greatest performance hit, try to use other methods if possible. (Regex, Exact, Contains, StartsWith, EndsWith)
    • "components": See below.
    • "duplicate": (int) How many instances of this GameObject to create. Note: this changes the scope and all the following properties will affect the duplicated objects instead.
    • "active": (bool) When false, disables the GameObject.
    • "scale": [x, y, z] (float) Sets scale of GameObject.
    • "position": [x, y, z] (float) Sets position of GameObject.
    • "localPosition": [x, y, z] (float) Sets localPosition of GameObject.
    • "rotation": [x, y, z] (float) Sets rotation of GameObject.
    • "localRotation": [x, y, z] (float) Sets localRotation of GameObject.
    • "track": (string) Adds the object to a track, allowing you to animate it. See TransformController

All of the custom data is stored in the difficulty's json. Example:

"version": "3.0.0",
"customData": {
  "environment": [
    {
      "id": "^.*\\[\\d*[13579]\\]BigTrackLaneRing\\(Clone\\)$",
      "lookupMethod": "Regex",
      "scale": [0.1, 0.1, 0.1]
    }
  ]
}

Components

Allows you to change fields of components found on game objects.

  • "environment" -> "components"
    • component name: The name of the component to look for.
      • field: The field of the component to affect.

Available components:

  • "ILightWithId"
    • "lightID": Which ID to assign. For use with the lightID tag for lighting events (Not animateable)
    • "type": Which event type to active on. (Not animateable)
  • "BloomFogEnvironment": Will always be found on the [0]Environment object.
    • "attenuation": attenuation is the fog density. logarithmic
    • "offset": offset I have no idea
    • "startY": startY is starting Y of the gradient thing
    • "height": height is the gradient length of the dissolving plane fog
  • "TubeBloomPrePassLight"
    • "colorAlphaMultiplier"
    • "bloomFogIntensityMultiplier"

Example:

{
  "id": "DragonsEnvironment.[0]Environment",
  "lookupMethod": "Exact",
  "components": {
    "BloomFogEnvironment": {
      "attenuation": 0.2
    }
  }
},

Additionally, components can be animated using the AnimateComponent custom event.

Geometry

Tired of only being able to move existing objects? Geometry allows you to create your own primitive shapes. Instead of defining "id" and "lookupMethod", use "geometry". Example:

"version": "3.0.0",
"customData": {
  "environment": [
    {
      "geometry": {
        "type": "Cylinder",
        "material": {
          "color": [0, 1, 0, 0],
          "shader": "Standard",
        }
      },
      "scale": [0.1, 0.1, 0.1],
      "track": "cylindertrack"
    }
  ]
}
  • "environment" -> "geometry"
    • "type": (string) What kind of primitive to create. (Sphere, Capsule, Cylinder, Cube, Plane, Quad, Triangle)
    • "material": (string/object) What material to assign the object.
    • "collision": Whether or not the object has a collider. Useful if you want note debris to bounce off.

Material

  • "color": (float)
  • "shader": (string) What shader to use. OpaqueLight and TransparentLight will create a TubeBloomPrePassLightWithId and TubeBloomPrePassLight and can be controlled by standard lighting events. TransparentLight will be invisible when the light is turned off. (Standard, OpaqueLight, TransparentLight)
  • "track": (string) Assign the material to a track, allowing you to animate the color.
  • "shaderKeywords": (string) Array. By default, each shader has its default keywords. This allows overwriting the keywords of the shader. keyworddiff

Every object needs a material, however creating materials can be laggy! The best way to assign materials is to create one initially, and then reuse it whenever you need one. It is recommended you reuse materials whenever possible as it is the most performant way of creating many geometry objects.

"customData": {
  "materials": {
    "green standard": {
      "color": [0, 1, 0, 0],
      "shader": "Standard"
    }
  },
  "environment": [
    {
      "geometry": {
        "type": "Cylinder",
        "material": "green standard"
      },
      "scale": [0.1, 0.1, 0.1],
    },
    {
      "geometry": {
        "type": "Sphere",
        "material": "green standard"
      },
      "position": [1, 1, 1]
    }
  ]
}

TransformController

Any GameObject assigned a track will automatically be assigned a TransformController. This is a standard Component which will follow position, localPosition, rotation, localRotation, and scale properties on a Track. These are the standard Unity properties on a Transform.

NOTE: because position and localPosition both control position (and similiarly for rotation), only one of them can be set. If you attempt to set both at the same time, only localPosition will be set.