MPP - Emissive Color Cycle Script V1.2.2 - Documentation
Cycles the glow color of your materials through three colors of your choice, over a cycle that can last a tenth of a second or ten minutes: neon signs, sci-fi props, portals, shop displays, party lights. One material, several materials by name, or every material of the object at once.
This script is standalone - it does not require any other MPP script to function.
New in V1.2.2: a material is written only when its color really changes (with the default cycle, about four times fewer writes than v1.2, with no visible difference), the cycle follows the real elapsed time even on a busy server, a write refused by Sansar is simply retried instead of counting as a failure, and Debug Logging reports the measured write rate. Settings are grouped by category in the Build panel. Your settings are kept when you update: see "Updating from v1.2".
Quick Start
- After purchase, the script is in your Inventory in Build mode. Add it to the object whose material should glow.
- In the object's properties, set the mesh that carries the material Scriptable. The material must have a Tint (most glowing materials do).
- Build and visit: the first material of the object cycles from red to green to blue and back, over three minutes.
- Pick your own colors in
Cycle/Color 1 (Start),Color 2andColor 3, and the length of the cycle inCycle/Cycle Seconds.
That is all most objects need. The rest of this guide details every option.
How It Works
The tint of the driven materials goes from Color 1 to Color 2, then to Color 3, then back to Color 1, each leg taking a third of Cycle/Cycle Seconds. The cycle starts on Color 1 each time the scene starts.
In the Build panel the settings are grouped by category: Cycle/, Materials/, Performance/ and Debug/.
Colors
Each color is entered as red, green, blue and alpha values from 0 to 1, for example (1,0,0,1) for pure red or (0.05,0,0,1) for a very dark red. The alpha value is kept at 1 for a normal glow.
To hold a color for a third of the cycle, give the same color to two consecutive fields (for example Color 1 = Color 2): the held color is shown exactly as you typed it.
Cycle length
Cycle/Cycle Seconds goes from 0.1 second to 600 seconds (default 180). Short cycles give a fast pulse, long cycles a slow, ambient drift.
Materials
Materials/Target Materials chooses what is driven:
| Value | Materials driven |
|---|---|
| (empty) | The first material of the object |
* | Every material of every scriptable mesh of the object |
Glow, Neon Left, Neon Right | Those materials, by name (commas or semicolons, case does not matter) |
Neon* | Every material whose name starts with "Neon" |
Only materials that have a Tint are driven. A material without one is skipped; if the first material has no Tint and the field is empty, a warning tells you to use * or a name. A name that matches nothing gets a warning listing the material names found, so you can copy the right one; if the wanted material sits on a mesh that is not scriptable, the warning names that mesh too.
To find the exact material names, turn Debug/Debug Logging On: the script console lists every material discovered at start.
Performance
Performance/Update Interval Milliseconds(default 50, 20 to 1000): time between two color updates. At each update, a material is written only when its color moved by more than one 8-bit step since the last write it received: with the default 180-second cycle that is about 4 writes per second instead of 20, and a 3-second cycle writes at every update. Raise the interval when many materials are driven at once.Performance/Per-Write Lerp Seconds(default 0.05, 0 to 1): fade applied by Sansar to each write. Close to the update interval gives a smooth fade; much shorter gives small jumps; 0 = instant change.
A material that keeps refusing its writes is dropped after five failures in a row, with a warning; a write that Sansar merely delays is not a failure and is retried at the next update.
Editor Properties Reference (8 total)
Cycle
| Property | Type | Default | Description |
|---|---|---|---|
| Cycle/Cycle Seconds | number, 0.1-600 | 180 | Length of a full cycle (Color 1 to 2 to 3 to 1) |
| Cycle/Color 1 (Start) | Color | (1,0,0,1) | First color, shown at each start |
| Cycle/Color 2 | Color | (0,1,0,1) | Second color |
| Cycle/Color 3 | Color | (0,0,1,1) | Third color |
Materials
| Property | Type | Default | Description |
|---|---|---|---|
| Materials/Target Materials | string | (empty) | Empty = first material; * = all; names separated by commas; a trailing * matches a prefix |
Performance
| Property | Type | Default | Description |
|---|---|---|---|
| Performance/Update Interval Milliseconds | integer, 20-1000 | 50 | Time between two color updates |
| Performance/Per-Write Lerp Seconds | number, 0-1 | 0.05 | Fade of each write; 0 = instant |
Debug
| Property | Type | Default | Description |
|---|---|---|---|
| Debug/Debug Logging | bool | Off | Writes the materials found, the targets chosen and the measured write rate to the script console |
Version Notes
| Version | What changed |
|---|---|
| v1.1 | Three-color cycle on the first material, or on one exact material name |
| v1.2 | Target Materials (empty, *, name list, prefix), Tint and Scriptable checks, adjustable update interval, materials dropped after repeated failures, "MPP -" name. Sold until V1.2.2 |
| V1.2.1 | A material is written only when its color really moved (one exact write when it stops), the cycle follows the real elapsed time, a delayed write is retried instead of counting as a failure, quieter warnings, settings grouped by category |
| V1.2.2 (this version) | Version number only |
Updating from v1.2
- Your values carry over: the 8 settings of v1.2 keep their internal names, their defaults and their values. As with any update, take a screenshot of the Build panel first, update one object and check its panel before doing the others.
- Labels: the settings now sit in four groups. Same settings, same values:
| v1.2 | V1.2.2 |
|---|---|
| Cycle Seconds, Color 1 (Start), Color 2, Color 3 | Cycle/Cycle Seconds, Color 1 (Start), Color 2, Color 3 |
| Target Materials | Materials/Target Materials |
| Update Interval Ms, Per-Write Lerp Seconds | Performance/Update Interval Milliseconds, Per-Write Lerp Seconds |
| Debug Log | Debug/Debug Logging |
- What behaves differently: fewer writes with slow cycles (no visible change expected), a cycle that no longer slows down on a busy server, and warnings about non-scriptable meshes only when they matter (when nothing is selected, or a name is not found).
Recipes
A - Neon sign. Target Materials = Neon*, three vivid colors, Cycle Seconds 30.
B - Slow ambient drift. One material, three pastel colors, Cycle Seconds 600, Update Interval Milliseconds 100.
C - Two colors with a hold. Color 1 = Color 2 = your main color, Color 3 = the accent: the main color holds for a third of the cycle, then blends to the accent and back.
D - The whole object. Target Materials = *: every tintable material of every scriptable mesh follows the same cycle.
E - Fast pulse. Cycle Seconds 3, Update Interval Milliseconds 50, Per-Write Lerp Seconds 0.05.
Troubleshooting
| Symptom | Check |
|---|---|
| Nothing changes | The mesh must be set Scriptable; the script console shows "No valid RenderMaterial found on any scriptable MeshComponent" otherwise. Check that the material has a Tint |
| Only one part of the object changes | Materials/Target Materials is empty: only the first material is driven. Use * or the names |
| "No material matches '...'" in the console | Copy a name from the "Available:" list of that warning; if the mesh is listed as non-scriptable, set it Scriptable |
| The colors look wrong | Values go from 0 to 1, not 0 to 255: (1,0.5,0,1) is orange |
| The held color is not exact | It is, from the second cycle on: the first pass starts on Color 1 and blends |
| Steps are visible on very dark colors | Lower Update Interval Milliseconds or raise Per-Write Lerp Seconds |
| I want to see what is driven | Turn Debug/Debug Logging On: the materials found, the targets chosen and, every 10 seconds, the number of writes |
Limits
- Two objects are not synchronized: each cycle starts on Color 1 when its script starts.
- Materials without a Tint cannot be driven.
- The cycle has no pause or trigger: it runs as long as the scene runs.
Related MPP Items
| Item | What it adds |
|---|---|
| Light Drain And Restore Script | A rainbow and a dimming light on a prop that visitors pick up. Store: https://www.sansar.com/store/listings/95238b17-f553-4656-88b6-6bf10e4070b9/light-drain-and-restore-script |
| Light Switch Script | Turn lights and glowing materials on and off with fades. Store: https://www.sansar.com/store/listings/7379d48c-2b6f-45f6-b6f1-205ce95aec1c/light-switch-script |
MPP - My Pretty Pixels. Emissive Color Cycle Script V1.2.2 (script MPP - Emissive Color Cycle). Store: https://www.sansar.com/store/listings/23b8b34f-c12a-47ac-930f-5765b1cbcaf9/emissive-color-cycle-script